How to check forr moderator in a cb plugin?

13 years 9 months ago #137782 by metricton
Hey,

I am currently having to develop a cb plugin, but I seem to be stuck on how to figure out if the current user logged in is a moderator / administrator.

I know how to check to see if the user is equal to the currently displayed profile such as $_CB_framework->myId() == $user->id

However, I also want to show the plugin if the user is a moderator / administrator. I figured there would be a function such as $_CB_framework->myIsModerator() however there does not seem to be.

Any help would be greatly appreciated.

Thanks,
Metric.

Please Log in to join the conversation.

13 years 9 months ago #137846 by heyai
One way to do it (and probably not the smartest method) is to check the Group ID of the user.
$user->gid

hey-ai - the community for asian guys and non-asian girls

The search bar is your friend, not just decoration!

Please Log in to join the conversation.

13 years 9 months ago #137881 by krileon
The following is how you check if a user is a moderator or not.

[code:1]
isModerator( USER_ID )
[/code:1]

So for example the following could be used.

[code:1]
isModerator( $_CB_framework->myId() )
[/code:1]

OR

[code:1]
isModerator( $user->id )
[/code:1]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.254 seconds

Facebook Twitter LinkedIn