News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Group Moderators v1.0 for SMF 1.0.5

Started by Dannii, June 26, 2005, 08:25:14 AM

Previous topic - Next topic

Dannii

In this thread I'll post about the development of my Group Moderators mod, until it's ready for release. This mod will enable to you have group moderators in the phpBB style, which has been regularly requested by many people.


25 July - version 1.0 released
el_groupmods_03.tar.gz
changelog.txt

18 July - version 0.3 released
el_groupmods_03.tar.gz

17 July - version 0.2 released
el_groupmods_02.tar.gz

28 June - version 0.1 released
el_groupmods_01.tar.gz








QuoteFatal error: Call to a member function exists() on a non-object in /home/ftpuser/eldacar/ftgforum/Sources/Subs-Package.php on line 1072
is all I am getting.

My mod is here: http://web.aanet.com.au/eldacar/data/groups2.zip

Any help would be apprechiated. Meanwhile I'll try looking up that line..

Quote$searches = $temp_searches;
$regexp = !$undo && $searches[0]->exists('@regexp') && trim($searches[0]->fetch('@regexp')) == 'true';
Okay i have no idea.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

[Unknown]

Your xml isn't valid; you're not closing some of the elements.

-[Unknown]

Dannii

That's all? Oh, sorry everyone  :-[

heh, kept forgetting to close the operation tags. Oops.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

[Unknown]

It's an easy thing to forget.  As I've said before, if you want... just use the boardmod format.  It is a little easier, its only flaw being that it doesn't allow you to do as much.  In many cases, that's not a problem.

-[Unknown]

Dannii

#4
I don't really have any idea about this.
I need a database modification. I copied the UsersOnlineToday mod's php file for that (editing it of course), however it doesn't seem to have been run. Do I need to put it in the package-info.xml file somewhere?

also, this doesn't work, but I can't see why not. it's incredible simple code.
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="replace"><![CDATA[
?>
]]></search>
<add><![CDATA[

$txt['elgm1'] = 'Group moderator(s)';

?>
]]></add>
</operation>
</file>


Also, at the moment I'm using the exisiting moderators database, which isn't really that good. If someone could instruct how to add a whole table that would be good too.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

[Unknown]

<file name="$languagedir/Modifications.english.php">
<operation>
<search position="replace"><![CDATA[
?>]]></search>
<add><![CDATA[

$txt['elgm1'] = 'Group moderator(s)';

?>]]></add>
</operation>
</file>


You want the above.  The other way you were searching for a ?> with a break after it (which won't be present.)

You have to add a code element to the package-info - the package SDK describes a bit about this.  Have you looked at it?

-[Unknown]

Dannii

oh thanks :)

I saw "<code>cleanup.php</code>" in the uninstall section, but didn't understand what it was for.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Dannii

#7
Installation now works :)

However I am getting this error:
Quote2: EditMembergroup() [<a href='function.EditMembergroup'>function.EditMembergroup</a>]: Unable to access /ManageBoards.php
File: /home/ftpuser/eldacar/ftgforum/Sources/ManageMembers.php
Line: 363

which relates to:
// Validate and get the IDs of the new moderators.
if (isset($_POST['groupmods']) && trim($_POST['groupmods']) != '')
{
require_once($sourcedir . '/ManageBoards.php');
require_once($sourcedir . '/Subs-Boards.php');
insertModerators($_POST['groupmods'], $_POST[id], 1);
}


That should be working, or at least the require_once should. The file exists and is in the same folder. I can't see why it couldn't be accessed. It's currently set to 666, but i can't seem to change it to 777 (would that matter?)
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Dannii

#8
SQL troubles. Maybe I'm a little out of my league :P

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 4
File: /home/ftpuser/eldacar/ftgforum/Sources/ManageBoards.php
Line: 809

Note: It appears that your database may require an upgrade. Your forum files are currently at version SMF 1.0.5, whereas your database is at version SMF 1.0.2. It is recommended that you execute the latest version of upgrade.php.

Ignore the bottom, because I have upgraded correctly, and it has nothing to do with anything the ugrades would have done anyway because it's a new table.

I installed the table, and it seems to be working, and is correct in phpMyAdmin.
db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}groupmods (
`ID_GROUP` smallint(5) unsigned NOT NULL default '0',
`ID_MEMBER` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY ( `ID_GROUP` , `ID_MEMBER` )
)", __FILE__, __LINE__);


The lines that the error has come from are ( they are in the insertmoderators function): if ($boardorgroup == 1) {
    db_query("
    INSERT INTO {$db_prefix}groupmods
    (ID_GROUP, ID_MEMBER)
    VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);
} else {
db_query("
INSERT INTO {$db_prefix}moderators
(ID_BOARD, ID_MEMBER)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);
}

Which i moddified almost exactly the same from the orriginal: db_query("
INSERT INTO {$db_prefix}moderators
(ID_BOARD, ID_MEMBER)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);


These two database have exactly the same format, with the only difference being ID_GROUP and ID_BOARD. any suggestions?

[edit] The test user i was experimenting with had an ID of 3, so that is what I am guessing the ' 3)' was about.

[edit2] I am guessing the problem is with the board/group ID. It was originally called as "insertModerators($_POST['moderators'], $_POST['ID_BOARD'], 0);", with the ID_BOARD in quotes. However it is called for groups as "insertModerators($_POST['groupmods'], $_POST[id], 1);" It didn't seem correct to have id without quotes, however that was how it was used elsewhere in that function (EditMembergroup). Hmmmmm. Actually it only used id without quotes in SQL queries, whereas elsewhere it does have quotes, and as this is a function call, prehaps it should have quotes? I shall check.

[edit3] Still no success, but I have confirmed that the ' #)' is the ID of the member.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Dannii

#9
Argh, so simple. I just needed to change $_POST to $_GET  :( :-[ :'(

Version 0.1 is now ready for release
el_groupmods_01.tar.gz
changelog.txt

If a few people could download and check it works that would be great. At the moment you can add and delete group moderators to all groups with an ID > 4, including post-count based groups. They don't have any actual power yet though. Uninstallation will work, however the table will need to be deleted manually.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Harelin

Hey eldacar,

I'm not familiar with phpBB's group moderator feature... could you elaborate?

Dannii

In phpBB you can create public groups to which there is a group moderator who can add and delete members to the groups they have control over. You can also apply to groups and see the memberlist. In SMF however, you would need to be an admin to do any of this. This mod (when finished) will allow you to do this and more hopefully. This will be a big advantage for large boards because admins will no longer be required to change the member's groups around.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Harelin

Wow, that's exactly what I've been looking for - even made a thread about it.  I'll be following this one.

Dannii

Great. Would you like to help test it as I develop it further?

A question for the SMF mod community. I will be basing most of my code off the ManageMember sources and templates. Is it best to duplicate all the code and modify it where needed, or to put my changes directly into it with if/then/else statements? If it is better to duplicate, should I put it all into the ManageMember source, or create my own source file directly (it will end up being 25% of the size probably)?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Harelin

Hey eldacar, how's this progressing?

I'd be willing to help test it - could really use this right about now.

Dannii

#15
Version 0.2 is now ready for release
el_groupmods_02.tar.gz
changelog.txt

If a few people could download and check it works that would be great.
This version adds the new Groups action. With index.php?action=groups you can view the groups for which you are a moderator, although you can't do anything yet. The next step will be allowing mods to add and remove members of their group.
Uninstallation will work, however the table will need to be deleted manually, as will the new source files.

What is the best way to delete files on uninstalling the mod? Is there a reverse action for reqiore-file?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

dtm.exe

Hey eldacar, can you maybe post a screenshot of this mod in action?

-Dan The Man

Dannii



At the moment it's using almost identical templates. I am focusing on getting a functioning mod (hopefully in a week) but which will most likely be using the standard texts. After that is released I'll make it look good.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Harelin

So far so good... works fine on my end.  Looking forward to your next version.

Dannii

#19
Version 0.3 is now ready for release
el_groupmods_03.tar.gz
changelog.txt

Greatness has been achieved :)
If a few people could download and check it works that would be great.
This version adds the new Groups action. With index.php?action=groups you can view the groups for which you are a moderator, and you can now add and delete members to those groups. yaY
Uninstallation will work, however the table will need to be deleted manually, as will the new source files.

The mod has been submitted and is waiting for approval. When that happens, if a mod could merge this thread with the one that is created, that would be good.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Advertisement: