Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action(
- 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment',
- 'my_add_user_cap_for_ticket',
- 10,
- 2
- );
- function my_add_user_cap_for_ticket(
- $transaction,
- $update_params
- ) {
- if($transaction->status_ID() != 'TCM') {
- return;
- }
- $registrations = $transaction->registrations();
- foreach($registrations as $registration) {
- if($registration instanceof EE_Registration) {
- if($registration->get('TKT_ID') == 10) { // swap in your ticket ID here - This is for Early Bird Regular Membership
- $user = new WP_User(get_current_user_id());
- if( $user instanceof WP_User ) {
- $user->add_cap('foo'); // swap in your capability here
- }
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement