Skip to:
Content
Pages
Categories
Search
Top
Bottom

Link WordPress user role with bbpress user role


  • willysbd
    Participant

    @willysbd

    Hello!
    Is it possible to link WordPress user role with bbpress user role?
    For example, I have users on WordPress who are “subscribers”, but if they stop paying they automatically go to “customers”.
    I would like to automatically convert a “customer” in WordPress to “locked” in bbpress.
    This is possible? how?
    Thanks!!!

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    You’ll have to write a custom plugin that filters bbp_get_user_role_map and adds a key for the customers role.

    Something like:

    add_filter( 'bbp_get_user_role_map', function( $roles = array() ) {
        $roles['customer'] = 'blocked';
        return $roles;
    } );
    

    willysbd
    Participant

    @willysbd

    Hi John!
    Thanks for the quick response!
    I modified your code to:

    /* wp customer -> bbp block */
    add_filter( 'bbp_get_user_role_map', function( $roles = array() ) {
        $roles['customer'] = 'bbp_blocked';
        return $roles;
    } );
    
    /* wp suscriber -> bbp participant */
    add_filter( 'bbp_get_user_role_map', function( $roles = array() ) {
        $roles['subscriber'] = 'bbp_participant';
        return $roles;
    } );
    

    But doesn’t works fine… when I change a Wp user role they lost any user role at bbpress.. (I put the code in functions in my child theme, is correct?)

    Thanks again!


    willysbd
    Participant

    @willysbd

    I tried to make a custom plugin with this code, but it didn’t work so…Any solution?
    Thanks!


    willysbd
    Participant

    @willysbd

    Please, can someone help me?
    Thanks!

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