Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to change forum roles programmatically


  • sanjaynakate
    Participant

    @sanjaynakate

    I have two user role
    1)student
    2)paid student
    I have situation after the payment i am changing role student to paid student it work good but here i have also change the forum role pro grammatically to participent for paid student here i searched lots but didnt find anything regrading this please any body can tell how do ichange forum role pro grammatically using query, function any thing.

Viewing 2 replies - 1 through 2 (of 2 total)

  • sanjaynakate
    Participant

    @sanjaynakate

    Finally i have got the answer.
    Bellow are the step.
    1) Get user current user id.

    <?php $user_id = get_current_user_id(); ?>

    2)set new user forum role you wish to change

    <?php $new_role_forum_role="bbp_participant"; ?>

    3)fire function.

    <?php bbp_set_user_role( $user_id, $new_role_forum_role );?>

    now check your user in back end and see forum user role.

    Full snippet code

    <?php
    $user_id = get_current_user_id();
    $new_role_forum_role=”bbp_participant”;
    bbp_set_user_role( $user_id, $new_role_forum_role );
    ?>


    Robin W
    Moderator

    @robin-w

    great glad you’re fixed

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar