• Resolved ScreenName

    (@screenname)


    Hi

    I need to automate the assignment of WP users to UAM groups. Manually assigning each user is not an option (there are way to many and more every day).

    The Role Affiliation will not work for this task, as all users are subscribers… and all users can not be given access to all/or even some posts.

    From what i can see in the settings of UAM there is no way to do this… however, I am sure there is a way for those of us that have some PHP skills to tap the UAM Class files to achive what we need.

    Here is my situation>

    We have a range of users for our website content.

    All subscribers have access to a small number of pages (This is controlled by a UAM Group)

    Then, various subscribers are added/remove to additional groups based on purchases, product demos, refunded purchases, etc

    I need to automate the process of adding an existing user/subscriber to an existing UAM Group when a new purchase/software download/etc event occurs.

    How can this be accomplished?

    I assume that I would first need to:

    1) query the WP User table for the Users ID
    2) query the UAM table for a list of groups
    3) parse WPUserID and the UAM Group of choice to an update() function in one of the UAM Class.php files.

    Can anyone point me in the right direction?

    https://www.ads-software.com/extend/plugins/user-access-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ScreenName

    (@screenname)

    Looks like i have found a solution… the below code updates the usergroup. As long as you know the WP_UID and the GROUP NUMBER.

    WP_UID can be pulled form the WP_DB with a simple username/password verification script (not included here).

    The group number(ID) can be found in the HTML souce code of any subscriber page. Look for the CheckBox formfield value.

    Example:
    <input type=”checkbox” id=”uam_usergroups-1″ value=”1″ name=”uam_usergroups[]” />

    You could potentially first query the UAM class for a list of all groups, but this was beyond my needs so I have not spent time investigating it.

    The below code updates the Groups associated with the access level.

    In this case the GroupID being update is Group 2.

    $wp_uid=25; //WordPress user ID
      $userGroupId=2; // Group ID to be updated
    
      global $userAccessManager;
    
      $uamAccessHandler = $userAccessManager->getAccessHandler();
      $uamUserGroup = $uamAccessHandler->getUserGroups($userGroupId);
    
      $uamUserGroup->addObject('user', $wp_uid);
      $uamUserGroup->save();

    Is there a way for the ‘group’ to be automaticly assigned so they do not get into a ‘wordpress’ log-on and into dashboard – i have to check the ‘user group’ box before they are sent to the proper site and view pages (not build or upload pages – just want them to have access to read and post comments)

    Re-worded: I dont want new users to get to a dashboard – only to the site that the usergroup has given them permission to read the pages.. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: User Access Manager] Advanced Use of UAM (Automation of Subscriber Roles)’ is closed to new replies.