MyBB Community Forums

Full Version: Php coding help for awaiting approval
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello can someone help me with a bit of php on 1.8.5, I'm not that good at it and can't work out how to get an awaiting approval notice for a forum moderator.

I have followed the advise here: http://community.mybb.com/thread-84847-p...#pid669564 and it works fine for admin and moderators, but not for Forum Moderators.

I also found this in my searches $mybb->user['usergroup']== but it didn't work, here is what I have in the global.php but can't seem to make it work. (*11 is the group I want to get the notification)

$awaiting_moderation = '';
// This user is a moderator, super moderator or administrator
if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'] && $mybb->user['usergroup']==11)
{

I have group 11 set as Moderators to forum ID 4 and their permissions are:
Can view unapproved threads and posts?
Can approve/unapprove threads?
Can approve/unapprove posts?

I don't want group 11 to have access to the ModCP or Mod Log, I just want them to get a notification and to be able to approve.

Or if anyone knows another way of letting group 11 know there is a post awaiting approval preferably by PM if possible I would be grateful.

Thank you
I do not understand it completely.
Did you define usergroup 11 as moderators of the forum with ID = 4 through:

AdminCP -> Forums $ Posts -> Forum with ID 4 -> tab Moderators -> Add Usergroup moderator -> Usergroup 11

As far as I know, $mybb->user['ismoderator']is then set to true.

Further, I do not know what this if statement must execute when evaluated as true, but the addition

&&$mybb->user['usergroup']==11

looks not good to me.
replacing && with || should make it work
if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] || $mybb->usergroup['canmodcp'] || $mybb->user['usergroup']==11)
@Ad Bakker Yes I set it up as you said, I've just tried adding another Usergroup in the same way and it doesn't show to them either.

@.M. Nope didn't work, still the same. Mods and Admin see it but not group 11 or the other one I just tried 8

Is there another way I could do what I'm trying to achieve via a PM or Email?

I want a group that has permission to approve (11) to be notified of a post awaiting approval.

Thank you both.
(2015-07-11, 11:53 AM)sarisisop Wrote: [ -> ]@.M. Nope didn't work, still the same.

That is amazing, because this if (as shown by .m.) must evaluate as true when the usergroup  is 11. Perhaps some debugging with echo statements?
hmm., check if below code works instead of the earlier
if(in_array($mybb->usergroup['gid'], array(4, 3, 6, 11))) 
(2015-07-11, 12:30 PM).m. Wrote: [ -> ]hmm., check if below code works instead of the earlier
if(in_array($mybb->usergroup['gid'], array(4, 3, 6, 11))) 

Nope worse that only allows Admin to see it, 3 6 & 11 can't see it.
^ looks like there is some fundamental mistake - may be spaces in array values !
if(in_array($mybb->usergroup['gid'], array(4,3,6,11)))
(2015-07-11, 01:04 PM).m. Wrote: [ -> ]^ looks like there is some fundamental mistake - may be spaces in array values !
if(in_array($mybb->usergroup['gid'], array(4,3,6,11)))

Sorry still Admin only.
please try once again !
if (in_array($mybb->user['usergroup'], array(4,3,6,11)))
Pages: 1 2