Beispiel #1
0
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
}
    while ($base != '/') {
        $base = dirname($base);
        if (@file_exists($base . "/wp-config.php")) {
            return $base;
        }
    }
    return false;
}
$wp_path = seu_get_wp_config_path();
//load WP features
include_once $wp_path . '/wp-config.php';
include_once $wp_path . '/wp-load.php';
include_once $wp_path . '/wp-includes/wp-db.php';
//load eval sections
global $wpdb;
$dept_id = get_user_major();
//get_option('student_major');//changed to site option feature //get_user_meta( $_GET['studentid'], 'major', false );
//find the major abbr of the blog
$depts = get_depts();
foreach ($depts as $dept) {
    if ($dept_id[0] == $dept->id) {
        $major_abbr = $dept->abbr;
    }
}
//sql query for eval sections from dept
$sections_table_name = "wp_seufolios_eval_sections";
$sql = "SELECT * FROM {$sections_table_name} WHERE dept_id = {$dept_id['0']} ORDER BY order_loc ASC";
$sections = $wpdb->get_results($sql);
//sql query for eval questions from sections
$questions_table_name = "wp_seufolios_eval_questions";
foreach ($sections as $section) {
Beispiel #3
0
function seu_posts_default_content()
{
    $major = get_user_major();
    $pid = get_posttypes_id($major);
    $posttypes = get_tax_terms($pid);
    foreach ($posttypes as $ptype) {
        $pslug = strtolower(str_replace(' ', '_', $ptype->term_slug));
        if ($pslug == $_GET['post_type']) {
            $settings_arr = explode("\ndefault_content=", $ptype->term_settings, 2);
            return stripslashes(urldecode($settings_arr[1]));
        }
    }
}