Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using code to change user's role

  • @counterfoxx

    Participant

    Hi,

    As I needed to have a customisable register form for BBPress, I changed the registration to the customisable fields I needed and altered the database. This works fine.

    However now when a new user registers and logs in, they cannot view the profile page as a “You do not have sufficient permissions to access this page.”

    When I look in the back end as an admin the user is automatically given the role of “subscriber”. If changed to “Forum Participant” the user is allowed to view the profile page, however I want the role to be set automatically, rather than the admin doing it.

    So I have got to the point where in the registration process I have this code so far to fix this:

    //Where $u is the newly registered user who has been added to the database

    $u->remove_role( ‘subscriber’ );

    $u->add_role( ” );

    The problem is I don’t know the parameter in the add_role function for Forum Participants (or any other way to do this).

    If anyone could tell me this it would be greatly appreciated!

    Thanks in advance

Viewing 1 replies (of 1 total)
  • @johnjamesjacoby

    Keymaster

    I’m working on this now for bbPress 2.2, which I’ll most likely fast-track to address this exact issue. I consider it all a big bug, if not just quickly behavior.

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