1
kjs222
[If User is Moderator] ...
  • 2003/10/29 14:08

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Can anyone tell me the syntax for checking if a forum viewer is moderator of the current forum?

Thanks,
Keith


2
ackbarr
Re: [If User is Moderator] ...

from /modules/newbb/functions.php
Quote:

/*
* Checks if a user (user_id) is a moderator of a particular forum (forum_id)
* Retruns 1 if TRUE, 0 if FALSE or Error
*/
function is_moderator($forum_id, $user_id) {

}

3
kjs222
Re: [If User is Moderator] ...
  • 2003/10/29 15:09

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


merci!

4
kjs222
Re: [If User is Moderator] ...
  • 2003/10/29 15:17

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Sorry, and can I use that in a template, or not? (if so, how)?

5
ackbarr
Re: [If User is Moderator] ...

sorry, ATM there is no current smarty variable available to specify if the current user is a moderator. Sounds like a decent addition / hack though.

6
lykoszine
Re: [If User is Moderator] ...
  • 2003/10/29 15:51

  • lykoszine

  • Module Developer

  • Posts: 244

  • Since: 2002/1/2 2


Can you not just assign the value of the test to a smart y variable, and then use that in the template?

7
kjs222
Re: [If User is Moderator] ... SOLUTION
  • 2003/11/1 11:47

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Thanks to everyone who lent a hand, I ended up having my programmer piece together the bits on this thread. For anyone who is interested, this is how you do it:

So in the template file u will have :
<{if $moderator == true}>
           <
p>blah blahp>
               <{/if}>

and in the php file newbb/viewtopic.php (I put it around 1/3rd of the way down):


if ( $xoopsUser ) {
   if ( 
$xoopsUser->isAdmin($xoopsModule->mid()) ||
is_moderator($forum$xoopsUser->getVar('uid')) ) {  
        
$xoopsTpl->assign('moderator'true);
   }
  }



Login

Who's Online

367 user(s) are online (293 user(s) are browsing Support Forums)


Members: 0


Guests: 367


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits