mhoc2022
Forum Replies Created
-
Replying to see if there is any other help I can get on this topic. Thanks.
@aswingiri Thank you for your help. I still am not getting the result.
I am putting this code into code snippets plugin in functions.php and it still is not working. Is this the correct location?
I do not have a custom validation code in my functions.php can you help with this? Or are you saying that it is not needed with the other code you provided?
Right now in UM I edit the registration form and in my custom form field “Partner Code” I set Validate as Custom Validation and Custom Activation as partner_code
In my user roles section of UM I made the new user role Partner but the user ID is um_partner
I want the code that new user to put into the Parter Code field to be “chocolate” so that they will become a Partner instead of a Subscriber account when entered.
Thank you for your time
Does not seem to work. New user is still just a standard subscriber and not a partner. I think maybe I’m misunderstanding.
This is a separate code from the custom validation code? So I still need a custom validation code with um_custom_field_validation_partner_code in my functions.php for the custom validation? What would the code for this look like?
Or sorry. I am looking at the code now.
So if I make the partner access code “chocolate” and the user role “partner” for example:
add_action( 'um_registration_complete', function( $user_id, $args ){ $partner_code = get_user_meta( $user_id ,'chocolate',true ); if( $partner_code ){ /* revalidate partner code */ /* assign new role if partner code is valid */ UM()->roles()->set_role( $user_id, 'partner'); } },30, 2 );Is this correct? And the custom action in the form field would be “partner_code” ?
Thanks for your reply,
So there is no way to automate the process with your plugin? It has to be done manually to upgrade a user role?