Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I set a wordpress user role when a member joins a buddypress group?

  • I’m using wordpress/buddypress on my site http://fanart.tv currently in the plugin I created It defines a new user role which I can then set a user as (global_moderator) which has the capability moderate_fanart.

    When a member is a global_moderator then can go to the dashboard and approve/deny other users uploads.

    I also have created a Moderators group so the mods can talk amongst themselves and it also allows people to request to become mods.

    So my plan was instead of checking if the user had the capability moderate_fanart to just see if they were a member of the moderators group

    public function user_is_mod() {
    $modgroup = groups_get_group( array(“group_id” => 1) );
    if (bp_group_is_member($group)) return true;
    else return false;
    }

    However, if I use this then I still have to manually set the member as a global_moderator as add_menu_page and add_submenu_page need to have the capability required to view them.

    So is there any way to set it so when a member joins a group it also sets their user role to global_moderator and when they leave it sets it back to subscriber?

    The other issue is that editors also have the moderate_fanart capability so I’m not sure how I would deal with that.

Viewing 1 replies (of 1 total)
  • hmm, actually, would a better way to deal with this be to set the capability to view the menu to read and put an if (user_is_mod()) add_submenu_page

Viewing 1 replies (of 1 total)
  • The topic ‘How do I set a wordpress user role when a member joins a buddypress group?’ is closed to new replies.
Skip to toolbar