um_add_user_role

The Ultimate Member um add user role function.

Description

um_add_user_role( $args ); 

Parameters (1)

0. $args
The args.

Usage

  1. if ( !function_exists( 'um_add_user_role' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ultimate-member/core/um-actions-register.php'; 
  3.  
  4. // The args. 
  5. $args = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = um_add_user_role($args); 
  9.  

Defined (1)

The function is defined in the following location(s).

/core/um-actions-register.php  
  1. function um_add_user_role( $args ) { 
  2.  
  3. global $ultimatemember; 
  4.  
  5. if ( isset( $args['custom_fields']['role_select'] ) || isset( $args['custom_fields']['role_radio'] ) ) return; 
  6.  
  7. $use_global_settings = get_post_meta( $args['form_id'], '_um_register_use_globals', true); 
  8.  
  9. if (isset($args['role']) && !empty($args['role']) && $use_global_settings == 0 ) { 
  10. $role = $args['role']; 
  11. } else if( $use_global_settings == 1 ) { 
  12. $role = um_get_option('default_role'); 
  13.  
  14. if( empty( $role ) ) return; 
  15.  
  16. $role = apply_filters('um_register_hidden_role_field', $role ); 
  17. if( $role ) { 
  18. echo '<input type="hidden" name="role" id="role" value="' . $role . '" />'; 
  19.