Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action("gform_user_registered", "add_custom_user_meta", 10, 3);
- function add_custom_user_meta($user_id, $config, $entry) {
- // put form IDs into the $regforms array
- // if not one of these forms, skip this code
- $regforms = array(11,12);
- if(!in_array($entry['form_id'], $regforms))
- return;
- // if it's form 11, run this code
- if($entry['form_id'] == 11) {
- wp_set_current_user( $user_id );
- $user = wp_get_current_user();
- $user->add_cap("access_s2member_ccap_creditexpertpro");
- }
- // if it's form 12, run this code
- elseif($entry['form_id'] == 12) {
- wp_set_current_user( $user_id );
- $user = wp_get_current_user();
- // change your capability name here to the one for form 12
- $user->add_cap("access_s2member_ccap_form12registrantcap");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement