function include_professors() { $admin_id = get_user_id_from_string(get_blog_option($current_blog->blog_id, 'admin_email')); $blog_major = get_user_major(); //get_the_user_major($admin_id); //var_dump($blog_major); if ($GLOBALS['blog_id'] != 1) { //makes sure it's not the root blog $args = array('blog_id' => 1, 'role' => 'professor'); $professors = get_users($args); //get all profs from root blog //loop through profs, add as user if same major, delete if different major foreach ($professors as $professor) { $prof_major = get_the_user_major($professor->ID); //var_dump($prof_major); if ($prof_major == $blog_major) { $current_role = get_the_user_role($professor); if ($current_role != 'Administrator') { $result = add_existing_user_to_blog(array('user_id' => $professor->ID, 'role' => 'professor')); } } else { $result = remove_user_from_blog($professor->ID, $current_blog->blog_id); } } } //end if }
function toolbar_evaluation($wp_admin_bar) { if (is_admin()) { return false; } global $wpdb; $eval_table_name = "wp_seufolios_evaluations"; $current_user = wp_get_current_user(); $user_role = get_the_user_role($current_user); $admin_id = get_user_id_from_string(get_blog_option($current_blog->blog_id, 'admin_email')); $submit = "profid={$current_user->id}" . "&" . "studentid={$admin_id}" . "&"; $sql = "SELECT answers FROM {$eval_table_name} WHERE profid={$current_user->id} and studentid={$admin_id}"; $results = $wpdb->get_results($sql); if (count($results) > 0) { $submit .= $results[0]->answers; } if ($user_role == 'Professor' || $user_role == 'Super_admin') { $plugin_url = plugins_url() . '/seufolios/'; $args = array('id' => 'seufolios-evaluation', 'title' => 'Evaluate', 'href' => 'http://ryanhoover.net', 'meta' => array('onclick' => "insertIframe(\"{$plugin_url}\", \"{$submit}\"); return false;")); $wp_admin_bar->add_node($args); } }
function hide_comment_number($count) { global $current_user; $user_role = get_the_user_role($current_user); $comment_can_read = get_option('user_comment_visible', 'deny'); if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/') == true) { return $count; } global $post; if (post_should_be_hidden($post->ID)) { $count = 0; } if ($user_role == 'World' && $comment_can_read == 'deny') { $count = 0; } return $count; }