• Resolved camrinp

    (@camrinp)


    Hello AAM Support,

    I am currently having an issue where when I assign a user a custom role on registration, the capabilities are not being transfered to the user correctly and the user is not able to access anything. Do you have any ideas of what I could do to resolve this?

    Also another issue is the role is not able to trash posts, I get a notice stating the post has been trashed, but the custom post is never actually moved to the trash. Trashing works fine for admins so I believe this is a role based issue.

    Thanks for your help!

    https://wordpress.org/plugins/advanced-access-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter camrinp

    (@camrinp)

    I managed to find the issue with the user role not being assigned on registration, it appears the user that works as expected has:

    a:2:{s:11:”classifieds”;b:1;s:21:”aamrole_532dbbfa34f77″;b:1;} in the yjtaadz1t_capabilities.

    The user that does not seem to work properly has:

    a:1:{s:11:”classifieds”;b:1;}

    Once I copied the working users yjtaadz1t_capabilities over to the newly created user in the database I am now able to access everything properly. How do I make this work so that the new user is assigned the role properly?

    Currently I am assigning the users role programatically using:

    //update meta data when registration form is submitted
    		function register_role($user_id, $password="", $meta=array()) {
    
    		   $userdata = array();
    		   $userdata['ID'] = $user_id;
    		   $userdata['role'] = $_POST['role'];
    		   $userdata['first_name'] = $_POST['first_name'];
    		   $userdata['last_name'] = $_POST['last_name'];
    		   $userdata['address'] = $_POST['address'];
    		   $userdata['city'] = $_POST['city'];
    		   $userdata['province'] = $_POST['province'];
    		   $userdata['country'] = $_POST['country'];
    		   $userdata['postal_code'] = $_POST['postal_code'];
    		   $userdata['phone_number'] = $_POST['phone_number'];
    		   $userdata['cellphone_number'] = $_POST['cellphone_number'];
    
    		   // allow if a role is selected
    		   if ( $userdata['role'] ){
    		      wp_update_user($userdata);
    		   }
    		}

    I haven’t been able to figure out the trash issue unfortunately 🙁

    Thread Starter camrinp

    (@camrinp)

    Fixed trash issue, now just stuck on the registration issue…

    Hi camrinp,
    AAM does not support multiroles. Looks like in your examples about your user has two roles: Clasifieds and AAM Custom Role.
    You have to make sure that only one role is assigned per user during registration.

    Regards,
    Vasyl

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User Not Being Assigned Role On Registration’ is closed to new replies.