Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding other user’s role at (or after) Group Promotion


  • itsasiak
    Participant

    @itsasiak

    Hi all,

    I am currently developing a site in WP4.5 + BuddyPress2.5.2 + BBPress2.5.8.

    I need that upon member promotion to Group Admin, s/he is also promoted to BBPress Keymaster (I know, I know, some will say I should ask in BBpress forums, but what if I wanted to promote to Site Admin, uh? :).

    This should be really simple (I think) and this is the code I am using in my bp-custom.php (currently not working):


    add_action('groups_promoted_member' , 'bp_custom_update_role',206,3);

    function bp_custom_update_role($user_id,$group_id){

    $updateuser = WP_user($user_id);

    if(groups_is_user_admin($user_id,$group_id))
    $updateuser->add_role('bbp_keymaster');

    }

    Any hint? It would be highly appreciated. Thanks a lot!

  • You must be logged in to reply to this topic.
Skip to toolbar