Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
requests-topic
Admin and Moderator email notification
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Feb 11, 2009 - 5:27 pm

yes, thats the only change for notifications to optionally go to mods too...

Avatar
Oliver
Guest
Guests
Feb 11, 2009 - 10:57 pm

Thank you!

Of course I always have something else up my sleave 🙂

So I also thought of connected the above with another criteria which stems from a new (custom) user pfoile field I added to allow a moderator to opt-in/out of receiving these emails.

...in addition I would have to add

AND profile_customfield = true

, is this possible?

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Feb 12, 2009 - 12:48 am

You shouldn't need this I believe.
The notification to moderators should be triggered by their setting on the Manage Admins > Admin Options tab...
At least that is my understanding...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Oliver
Guest
Guests
Feb 12, 2009 - 1:08 am

hi andy!

right, but I don't want to make moderators admins, hence I can't use that setting (I think) - or could I possibly make them admins with "no capabilities" e.g. to ?

here is what I did and the code piece that works (changes are highlighted). the only drawback is, that it requires the custom field to be the first custom field since it's hardcoded below (I'm sure this could be done a tad more elegant to make it dynamic).

with this change, moderators can now opt-in via their profile.

$admins_email = '';
### oliver:
### $admins = $wpdb->get_results("SELECT user_id, admin_options FROM ".SFMEMBERS." WHERE admin = 1");
$admins = $wpdb->get_results("SELECT user_id, admin_options FROM ".SFMEMBERS." WHERE admin = 1 OR moderator = 1");

if ($admins)
{
   foreach ($admins as $admin)
   {
       if ($admin->user_id != $newpost['userid'])
       {
           $admin_opts = unserialize($admin->admin_options);
           ###oliver: 2 lines below changed
           $mod_opts = get_usermeta($admin->user_id, 'sfcustomfield0');    ### custom field hardcoded

           if ($admin_opts['sfnotify'] || $mod_opts=='on')

           {
               $email = $wpdb->get_var("SELECT user_email FROM ".SFUSERS." WHERE ID = $admin->user_id");
               if ($admins_email != '') $admins_email .= ', ';
               $admins_email .= $email;
           }
       }
   }
}

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Feb 12, 2009 - 1:22 am

I didn't write this part and I can't easily test at the moment as my local codebase is in upheaval from a big restructuring. But as I understand it, your Moderator should be able to have access to the manage Admins personal options tab without having any of the actual Admin capabilities turned on. So they should be able to opt in for email notifications on that panel.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Oliver
Guest
Guests
Feb 12, 2009 - 1:45 am

you're right! I somehow managed to overlook that part...this makes more sense, I'll see if I can get it to work - if it does, it'd of course be better than changing core code.

Avatar
Oliver
Guest
Guests
Feb 12, 2009 - 1:54 am

ok..this didn't work so well, because admins must at least have 1 capability in order to keep the admin status and being able to use the special admin features (admin bar, notifications).

so i may have to go with my code change for the time being...

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Feb 12, 2009 - 2:27 am

Ah. it may be that is a 4.1 change... I will check it out.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Feb 12, 2009 - 6:37 am

you do not have to be an admin to have access to the admin/moderator options (noitce the name of the tab).  if a user is a moderator (in a usergroup with the moderator flag checked), the user will be shown the tab with the options in the wp admin.   dont confuse the individual admin/moderator options with the global admin options.  just verified its working properly.

perhaps I am misunderstanding what you are trying to do...

Avatar
Oliver
Guest
Guests
Feb 12, 2009 - 9:11 am

You're right.

I've looked at the WP profile/admin pages several times and I swear I did not see the SF menu/tab.

So this will do of course and feel free to remove the above code snippet to not confuse anyone (even though it worked nicely 😉

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625