I would hook into user_register
similarly to how you hooked into gform_post_submission_1
before. For example:
add_action( 'user_register', 'awesome_function_name', 10, 1 );
function awesome_function_name( $user_id ) {
// Conditional logic for testing user role
update_user_meta( $user_id, 'dokan_enable_selling', 'yes' );
}
For your conditional logic, if you’re trying to make every role do this except customer I typically use the following function which I don’t remember where I got so I can’t credit them unfortunately.
function check_user_role( $role, $user_id = null ) {
if( is_numeric( $user_id ) ) {
$user = get_userdata( $user_id );
} else {
$user = wp_get_current_user();
}
return in_array( $role, (array)$user->roles );
}
So your action above would be modified to:
add_action( 'user_register', 'awesome_function_name', 10, 1 );
function awesome_function_name( $user_id ) {
if( !check_user_role( 'customer', $user_id ) ) {
update_user_meta( $user_id, 'dokan_enable_selling', 'yes' );
}
}