M_Roles_show_information

Addon Name: Integrated WP Roles Description: Allows members to be assigned different roles based on their levels Author: Barry (Incsub) Author URI: http://caffeinatedb.com.

Description

M_Roles_show_information( $level_id ); 

Parameters (1)

0. $level_id
The level id.

Usage

  1. if ( !function_exists( 'M_Roles_show_information' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/addons/integrated.wproles.php'; 
  3.  
  4. // The level id. 
  5. $level_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = M_Roles_show_information($level_id); 
  9.  

Defined (1)

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

/app_old/membershipincludes/addons/integrated.wproles.php  
  1. function M_Roles_show_information( $level_id ) { 
  2.  
  3. global $wp_roles; 
  4.  
  5. // Get the currentlt set ping for each level 
  6. $level = new M_Level( $level_id ); 
  7.  
  8. $levelrole = $level->get_meta( 'associated_wp_role', '' ); 
  9.  
  10. ?> 
  11. <h3><?php _e('Associated Role', 'membership'); ?></h3> 
  12. <p class='description'><?php _e('If you want a specific WP role to be assigned to users on this level select it below.', 'membership'); ?></p> 
  13.  
  14. <div class='level-details'> 
  15.  
  16. <label for='levelrole'><?php _e('Associated Role', 'membership'); ?></label> 
  17.  
  18. <select name='levelrole'> 
  19. <option value=''><?php _e('No associated role', 'membership'); ?></option> 
  20. <?php 
  21. $all_roles = $wp_roles->roles; 
  22.  
  23. // Preset variables 
  24. $p = ''; $r = ''; 
  25.  
  26. foreach ( $all_roles as $role => $details ) { 
  27. $name = translate_user_role($details['name'] ); 
  28. if ( $levelrole == $role ) { // preselect specified role 
  29. $p .= "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>"; 
  30. } else { 
  31. $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>"; 
  32. echo $p . $r; 
  33. ?> 
  34. </select> 
  35.  
  36. </div> 
  37. <?php