Support

Home Forums Event Espresso Premium Trying to Grant user access to a UAM group on registration

Trying to Grant user access to a UAM group on registration

Posted: August 19, 2015 at 1:32 pm


David Anderson

August 19, 2015 at 1:32 pm

So I have a couple questions:

I need to get a value of a custom field of the event they are registering for and then the field is the group id that I want them to be added too.

I have the UAM side of things I just need to get the EE4 event info in the function and I also don’t know if I am hooking into the correct action.

function GrantGroupAccess() {

global $oUserAccessManager;

$uam_group_ID = // Need to get Event Custom Field get_post_meta($post_id, $key, $single);

// Now obtain the User's User ID
$wp_uid = $user_ID;
$userGroupId = $uam_group_ID; // Group ID to be updated

// Now set the user's permissions to have access to the pages
global $oUserAccessManager;

if (isset($oUserAccessManager)) {
$oUamAccessHandler = $oUserAccessManager->getAccessHandler();
$uamUserGroup = $oUamAccessHandler->getUserGroups($userGroupId);
if ($record_status == "Archived" OR $record_status == "Pending" OR $record_status == "Rejected") {
$uamUserGroup->removeObject('user', $wp_uid);
} else {
$uamUserGroup->addObject('user', $wp_uid);
}
$uamUserGroup->save();
}

}

add_action('AHEE__SPCO__after_registration_steps','GrantGroupAccess');


Josh

  • Support Staff

August 19, 2015 at 3:05 pm

Hi David,

It turns out there’s an example that shows how to get a custom field from the event in this documentation wiki:

http://eventespresso.com/wiki/add-course-curriculum-events-using-advanced-custom-fields/

The AHEE__SPCO__after_registration_steps may not be suited for this job since that fires on the page where they fill out the registration form, and again on the page where they select a payment method. One of the hooks that fire on the Thank You page may be better suited, like AHEE__thank_you_page_registration_details_template__after_registration_details .

The support post ‘Trying to Grant user access to a UAM group on registration’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 4 years, 3 months ago ago

Topic Tags

Tagged: ,

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!