News:

Wondering if this will always be free?  See why free is better.

Main Menu

Group as Group Moderator (2.x)

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

Previous topic - Next topic

SD-X

Quote from: Kindred on March 12, 2013, 10:02:08 AM
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.
Ah, thank you Kindred. I was a little confused as to why he was doing automated tasks instead of a direct database change upon actually setting something manually. Now I get why. :)

moparisthebest

Quote from: Arantor on March 12, 2013, 10:28:03 AM
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.

I know, I said it would be nice and more robust to write it in a language like PHP with actual array support, vs my hack in bash with IFS and friends... :)

I just stumbled across your thread here:
http://www.simplemachines.org/community/index.php?topic=329894.0
That explains it quite well, if I implement it that way though, is there a nice supported way to still run it from the command line (ie, cron)?
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

Arantor

There is not a "nice supported way" to run it from the command line. It requires a special bridge that has never, to my knowledge, been distributed.

But the point is, it'll still run... even without you using cron.

Kindred

actually, in SMF's scheduled tasks interface, there is a "run this now" option as well...

no command lin needed at all. add a scheduled task, it runs automatically. If you need to force it to run, trigger the run now option.
Сл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

Sure there is, but that's hardly convenient to run it every hour.

Kindred

but would you really need to run it every hour?   How often do you change a person's membergroup?
Сл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

Fair point.

Why not go one better and hook it into the code when you change a membergroup or the members in it?

Kindred

I was wondering how easy that would be to trigger........  it does seem tpo be the most logical place to trigger it, even more so than a scheduled task.
Сл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

Quote from: Kindred on March 12, 2013, 11:12:14 AM
I was wondering how easy that would be to trigger........  it does seem tpo be the most logical place to trigger it, even more so than a scheduled task.
That's what I was getting at too, although I probably didn't do a good job at wording it. That was the reason why the automated system didn't make sense to me to begin with.

Arantor

Theory says you should be able to do it off the integrate_change_member_data hook, except changes to secondary groups probably won't trigger it. The code's pretty labyrinthine, between Profile-Modify and Profile, but as far as I can tell, id_group won't change unless you specifically change it, and changing additional_groups won't automatically trigger an id_group change. But... you could add additional_groups to the list in updateMemberData just before the hook is called, and then do something based on the hook call.

moparisthebest

Getting it to run is one thing, it's fairly straightforward any way you go about it.  The thing I didn't want to mess with, making this not a 'nice' mod, is the UI and database changes for storing which group moderates which other groups.  Right now it's a simple string in a bash script, even if I did port it to PHP, it would be a hard-coded array in PHP.

This is the difference between a quick hack (my code above), and a proper mod. :)
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

Arantor

No, a proper mod is one that modifies the code. There are plenty of mods that are only a step up from 'dirty nasty hack' by simple virtue of being packaged into a list of find/replace statements in an XML container.

Kindred

it would be a pretty sunple UI.

Group to be moderated;group to be the moderators
store it in the mod settings array
do a foreach when you trigger the check and break apart the string at the semicolon
you could set as many as you want this way and have an array of 20 cross moderating groups.   lol



and lol Arantor....  yep...
Сл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

Quoteand lol Arantor....  yep...

You do realise I made some of the nastiest :P

QuoteGroup to be moderated;group to be the moderators
store it in the mod settings array

Pretty much.

moparisthebest

Quote from: Kindred on March 12, 2013, 11:42:29 AM
it would be a pretty sunple UI.

Group to be moderated;group to be the moderators
store it in the mod settings array
do a foreach when you trigger the check and break apart the string at the semicolon
you could set as many as you want this way and have an array of 20 cross moderating groups.   lol

I hate UI work, if you want to do that part, I'll write my stuff in PHP and we can package up a nice mod. :)
You can have my gun when you pry it from my cold, dead hands.
Linux users, we do it in the open.

SD-X

I would love you guys forever if you did it. :)

Dark Wizard

Hello, is any mod exists that can set group as group moderator yet?

Kindred

Сл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."

Oldiesmann

No there isn't, and there are no plans to add it to my knowledge.
Michael Eshom
Christian Metal Fans

Advertisement: