Group as Group Moderator (2.x)

Started by Vala, June 28, 2010, 02:55:50 PM

Previous topic - Next topic

Vala

Hi,

What I'd like to be able to do in 2.0 RC3 (and beyond) is assign a group as the group moderator of another.  An example would be I have board "A" and membergroups "A Leaders", and "A Members."  "A leaders" has moderator roles over board "A."  I would like to be able to set the group "A Leaders" as the group moderator of "A Members" so that as the leadership/moderators of board A change they are granted/removed as group moderators of the members group via their addition/subtraction from the leadership group.

Thank you for your time and consideration.

Vala

Acans

This can be done, however not buy group.

You must add members that you wish to be group leaders by (Admin > membergroups > Modify)

You'll see a field called group moderators, they can add, remove members from that group.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Norv

I think I've seen this in IPB IIRC.
However, I haven't seen it requested any other time than this, thus I suspect that it's not a widespread usefulness...

Thank you for the suggestion, Vala. I doubt it will be in default SMF, but I'm sure a mod could be done to fit this need.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

SD-X

#3
Sorry for the bump, but to be honest this would actually be very useful and much more secure. PHPBB3 has it as well, and it doesn't make a whole lot of sense to me that users specifically can moderate groups but group ranks can't be set to do it. On many forums where one group is the lead of another, having it set by user could become a security issue because if the user loses their said leading rank, they would still be able to have control over who is in the member's group, which is a big problem. Same thing with not having another option for groups to moderate specific boards without changing the entire permissions system method being used. If the options for these two were added, forums that have such systems set up could easily just set a user with a specific rank that has these permissions already granted to the rank, and that would make life much easier for admins, not to mention reduce the chance of forgetting to remove multiple rights from many different places just for one user. When you moderate a large forum, it's hard to remember all of this at times...especially when you are only an admin on the forum and you don't actually participate in the forum's focus itself.

Norv

Thank you for the feedback, SugarD. :)
TBH, this has come back lately a few more times as well... (in other topics).

More opinions are appreciated.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

SD-X

Quote from: Norv on July 03, 2011, 02:50:04 AM
Thank you for the feedback, SugarD. :)
TBH, this has come back lately a few more times as well... (in other topics).

More opinions are appreciated.
No problem man. SMF and PHPBB have always been my favorite forum softwares, and I used to lean more towards PHPBB3, but ever since SMF 2 came out, I've been becoming more fond of it instead. ;)

Given that SMF is open source now, maybe it would be a good idea, (with the other softwares' permission), to maybe take a look at what the other softwares have that SMF doesn't, and maybe implement your own version of it if users like it enough. Overall most things are universal between them these days, but it's the little things, like this, that make those defining reasons behind which one a user chooses.

Omega_K2

I think the capability to appoint actual groups as moderators for other groups instead of invdividual users would be a great improvement. I support the idea aswell.

SD-X

Quote from: Omega_K2 on December 01, 2011, 05:03:29 PM
I think the capability to appoint actual groups as moderators for other groups instead of invdividual users would be a great improvement. I support the idea aswell.
* SugarD-x hopes it gets added.

SD-X

I'm sorry to bump this, but I'm curious if this has this been accepted or denied. :)

The board it is in is not very clear on it's status, and it's been idle for almost a year without any official comments.

Kindred

Since it is not in 2.1, to the he's of my knowledge, I would say it was not accepted
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

emanuele

I think someone was working on something, but not for 2.1.

This belongs to the batch of this topic.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

SD-X

Oh crap, my mistake guys. Sorry about that. Thanks for whoever moved this, and thanks to all who have replied! :)

moparisthebest

I needed this functionality on my forum, and went ahead and implemented it as a simple shell script I run once an hour, you could have it run more often if you like, but it's good enough for me.

This script generates the SQL:

#!/bin/bash

# put groups to modify here, syntax is 'mod_group1,group1 mod_group2,group2' etc
groups='83,77'

# don't touch anything under here...

# ensure groups ends in a space, otherwise read below will skip the last one
last_character=${groups#${groups%?}}
[ "$last_character" == " " ] || groups="$groups "

# loop through them, printing the SQL
echo "$groups" | while IFS=',' read -d' ' mod_group group; do
    echo "-- group $mod_group moderating $group";
    echo "DELETE FROM smf_group_moderators WHERE id_group = $group;"
    echo "INSERT INTO smf_group_moderators SELECT $group AS id_group, id_member FROM smf_members WHERE id_group = $mod_group OR id_post_group = $mod_group OR FIND_IN_SET($mod_group, additional_groups);"
done


Which I actually execute with a script like this:

#!/bin/bash
/home/youruser/groupsModerateGroups.sh | mysql -umysql_user -pmysql_pass dbname >> /home/youruser/groupMods.log 2>&1
echo "ran $(date) successfully" >> /home/youruser/groupMods.log


The SQL generated of course looks like this:
-- group 83 moderating 77
DELETE FROM smf_group_moderators WHERE id_group = 77;
INSERT INTO smf_group_moderators SELECT 77 AS id_group, id_member FROM smf_members WHERE id_group = 83 OR id_post_group = 83 OR FIND_IN_SET(83, additional_groups);


If you have any questions, let me know.
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

Kindred

why didn't you just build this in php and trigger it using SMF's own scehduled tasks feature?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SD-X

I'm a little confused as to why that code needs to have a timer running at all. Wouldn't it just be easier to make a PHP modification to the forum permissions?

moparisthebest

Quote from: Kindred on March 12, 2013, 09:33:12 AM
why didn't you just build this in php and trigger it using SMF's own scehduled tasks feature?

I've never used SMF's scheduled tasks feature, seems like it tries to re-invent cron, so I'd rather just use cron.  Someone can do this by using my queries above and writing 4 or 5 lines of PHP code pretty easily though, if they don't have cron.

Quote from: SugarD-x on March 12, 2013, 09:35:49 AM
I'm a little confused as to why that code needs to have a timer running at all. Wouldn't it just be easier to make a PHP modification to the forum permissions?

Easier? I don't think so.  Quicker? Certainly not, this took me maybe 5 minutes.  Better? Yes, built-in support would be much better, but you would also need to do the interface work for specifying which group gets to moderate which group, and then store/load that information into/from the database as well.  So this requires a PHP change, HTML change (maybe javascript too), and a database change.  I didn't feel like doing any of that, so I wrote 2 SQL queries and a shell script. :)
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

Kindred

Actually Sugar, what he appears to be doing is checking to see who is in what group and then assiging the USERS in that group to the correct permissions.

So, he's not modifying anything in the core of SMF's permissions to allow the group to be a gropup moderator.
What he is doing is checking (once an hour) to see who is in the group which he has made as a group moderator and then granting each user in that group to group moderator permission (or removing it, if they are no longer in the group)

it's a decent way to do it, without mucking with the smf permissions system actually...
He's just doing it inefficiently, by using an external script, when he could be using the smf scheduled tasks to do the same thing without any external junk at all.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

And it's even possible to get cron to call SMF's scheduled tasks... the reason it was set up is because not everyone can configure cron jobs properly.

moparisthebest

Quote from: Arantor on March 12, 2013, 10:03:18 AM
And it's even possible to get cron to call SMF's scheduled tasks... the reason it was set up is because not everyone can configure cron jobs properly.

In that case I think a mini-tutorial on cron would have been a better way to go, but I figured it was for people who *shudder* run this on windows without cron.

I might make a more robust version in the future in PHP, it would make this much cleaner in a language that had actual array support. :)  Is the only requirement for SMF's scheduled tasks that it be written in PHP?
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

Arantor

QuoteIn that case I think a mini-tutorial on cron would have been a better way to go, but I figured it was for people who *shudder* run this on windows without cron.

You mean like most of the developers who actually develop and test the software do it on their home computers?

And quite honestly, I can't imagine a quicker way to create support issues. Most of the users here, to be honest, are not up to the task of configuring cron jobs and are not willing to learn. And by giving them a large hurdle, you're actually discouraging them from using the software.

Quoteit would make this much cleaner in a language that had actual array support

PHP DOES have actual array support. In fact its array support is better than other languages.

QuoteIs the only requirement for SMF's scheduled tasks that it be written in PHP?

Pretty much, since you need to get the credentials from Settings.php to be able to use it automatically.

Advertisement: