function ui_user_roles()
 {
     if (!is_user_administrator_rs() && !scoper_get_option('display_user_profile_roles')) {
         return;
     }
     global $profileuser, $current_rs_user;
     $profile_user_rs = $profileuser->ID == $current_rs_user->ID ? $current_rs_user : new WP_Scoped_User($profileuser->ID);
     include_once dirname(__FILE__) . '/profile_ui_rs.php';
     ScoperProfileUI::display_ui_user_roles($profile_user_rs);
 }
 function display_ui_group_roles($group_id)
 {
     $users = ScoperAdminLib::get_group_members($group_id, COL_ID_RS);
     $args = array('disable_user_roles' => true, 'filter_usergroups' => array($group_id => true), 'disable_wp_roles' => true);
     $user_id = $users ? $users[0] : 0;
     $user = new WP_Scoped_User($user_id, '', $args);
     if (!$users) {
         $user->groups = array($group_id => true);
     }
     if ($group = ScoperAdminLib::get_group($group_id)) {
         if (!strpos($group->meta_id, '_nr_')) {
             global $wpdb;
             echo '<div class="rs-group-profile">';
             if (IS_MU_RS && scoper_get_option('mu_sitewide_groups')) {
                 global $blog_id;
                 $blog_ids = scoper_get_col("SELECT blog_id FROM {$wpdb->blogs} ORDER BY blog_id");
                 $orig_blog_id = $blog_id;
             } else {
                 $blog_ids = array('1');
             }
             foreach ($blog_ids as $id) {
                 if (count($blog_ids) > 1) {
                     switch_to_blog($id);
                 }
                 if (!$wpdb->get_results("SHOW TABLES LIKE '{$wpdb->user2role2object_rs}'")) {
                     continue;
                 }
                 ScoperProfileUI::display_ui_user_roles($user, true);
                 //arg: groups only
             }
             echo '</div>';
             if (count($blog_ids) > 1) {
                 switch_to_blog($orig_blog_id);
             }
         }
     }
 }