_x( 'Topics', 'post type general name' ), 'singular_name' => _x( 'Topic', 'post type singular name' ), 'add_new' => _x( 'Add New', 'topic' ), 'add_new_item' => __( 'Add New Topic' ), 'edit_item' => __( 'Edit Topic' ), 'new_item' => __( 'New Topic' ), 'all_items' => __( 'All Topics' ), 'view_item' => __( 'View Topic' ), 'search_items' => __( 'Search Topics' ), 'not_found' => __( 'No topics found' ), 'not_found_in_trash' => __( 'No topics found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Topics' ); $args = array( 'labels' => $labels, 'description' => 'Holds class topics.', 'public' => true, 'publicly_queryable' => true, 'supports' => array( 'title', 'author', 'comments', 'revisions', 'editor', 'custom-fields'), 'has_archive' => true, 'capabilities' => array( 'publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options', ), 'hierarchical' => true, 'menu_position' => 10, 'show_ui' => true, ); register_post_type( 'topic', $args ); //Assignments $labels = array( 'name' => _x( 'Assignments', 'post type general name' ), 'singular_name' => _x( 'Assignment', 'post type singular name' ), 'add_new' => _x( 'Add New', 'assignment' ), 'add_new_item' => __( 'Add New Assignment' ), 'edit_item' => __( 'Edit Assignment' ), 'new_item' => __( 'New Assignment' ), 'all_items' => __( 'All Assignments' ), 'view_item' => __( 'View Assignment' ), 'search_items' => __( 'Search Assignments' ), 'not_found' => __( 'No assignments found' ), 'not_found_in_trash' => __( 'No assignments found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Assignments' ); $args = array( 'labels' => $labels, 'description' => 'Holds assignments.', 'public' => true, 'publicly_queryable' => true, 'supports' => array( 'title', 'author', 'comments', 'revisions', 'editor', 'custom-fields'), 'has_archive' => true, 'capabilities' => array( 'publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options', ), 'hierarchical' => false, 'menu_position' => 10, 'show_ui' => true, ); register_post_type( 'assignment', $args ); //Submission $labels = array( 'name' => _x( 'Submissions', 'post type general name' ), 'singular_name' => _x( 'Submission', 'post type singular name' ), 'add_new' => _x( 'Add New', 'submission' ), 'add_new_item' => __( 'Add New Submission' ), 'edit_item' => __( 'Edit Submission' ), 'new_item' => __( 'New Submission' ), 'all_items' => __( 'All Submissions' ), 'view_item' => __( 'View Submission' ), 'search_items' => __( 'Search Submissions' ), 'not_found' => __( 'No submissions found' ), 'not_found_in_trash' => __( 'No submissions found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Submissions' ); $args = array( 'labels' => $labels, 'description' => 'Holds student submissions.', 'public' => true, 'publicly_queryable' => true, 'supports' => array( 'title', 'author', 'comments', 'revisions', 'editor', 'custom-fields'), 'has_archive' => true, 'capabilities' => array( 'publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options', ), 'hierarchical' => false, 'menu_position' => 10, 'show_ui' => true, ); register_post_type( 'submission', $args ); $labels = array( 'name' => _x( 'Grades', 'post type general name' ), 'singular_name' => _x( 'Grade', 'post type singular name' ), 'add_new' => _x( 'Add New', 'book' ), 'add_new_item' => __( 'Add New Grade' ), 'edit_item' => __( 'Edit Grade' ), 'new_item' => __( 'New Grade' ), 'all_items' => __( 'All Grades' ), 'view_item' => __( 'View Grade' ), 'search_items' => __( 'Search Grades' ), 'not_found' => __( 'No grades found' ), 'not_found_in_trash' => __( 'No grades found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Grades' ); $args = array( 'labels' => $labels, 'description' => 'Holds student grades.', 'public' => false, 'publicly_queryable' => false, 'menu_position' => 5, 'supports' => array( 'title', 'editor', 'custom-fields'), 'has_archive' => false, 'capabilities' => array( 'publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options', ), 'hierarchical' => false, 'menu_position' => 10, 'show_ui' => true, ); register_post_type( 'grade', $args ); }//END function register_post_types /** * Prevent students from using personal email accounts. */ function restrict_domains( $errors, $login, $email ) { $whitelist = array( 'raritanval.edu', 'stu.raritanval.edu' ); if ( is_email($email) ) { $parts = explode('@', $email); $domain = $parts[count($parts)-1]; if ( !in_array(strtolower($domain), $whitelist) ) { $errors->add('email_domain', __('ERROR: You may ONLY register with an @raritanval.edu or @stu.raritanval.edu email address. No exceptions. THIS IS SPARTA!')); } } return $errors; }//END function restrict_domains /** * Set up students' Topics tab. */ function topics_tab() { }//END function topics_tab /** * Set up students' Assignments tab. */ function assignments_tab() { }//END function assignments_tab /** * Set up students' Grades tab. */ function grades_tab() { }//END function grades_tab /** * Set up professor's Topics tab. */ function topics_admin_tab() { global $bp; //If the user is not a group administrator, return. if (groups_is_user_admin( get_current_user_id(), $bp->groups->current_group->id )) return; //Calculate the group link. //$groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/'; //Add in the new subnav item to the group. bp_core_new_subnav_item( array( 'name' => 'Topics', 'slug' => 'topics', 'parent_slug' => $bp->groups->current_group->slug, 'parent_url' => bp_get_group_permalink( $bp->groups->current_group ), 'screen_function' => array(get_called_class(),'topics_admin_tab_template'), 'position' => 1001 ) ); }//END function topics_admin_tab /** * Display the professor's Topics tab. */ function topics_admin_tab_template() { //Hook in the title add_action( 'bp_template_title', array(get_called_class(),'topics_admin_tab_title') ); //Hook in the content add_action( 'bp_template_content', array(get_called_class(),'topics_admin_tab_content') ); //Nab the template $templates = array('groups/single/plugins.php','plugin-template.php'); //Load the template and fire the hooks. if( strstr( locate_template($templates), 'groups/single/plugins.php' ) ) { bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) ); } else { bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) ); } } /** * Print the tab title. */ function topics_admin_tab_title() { echo 'Topics'; } /** * Print the tab content. */ function topics_admin_tab_content() { global $bp; echo 'This is the professor\'s topics tab.'; } /** * Set up professor's Assignments tab. */ function assignments_admin_tab() { }//END function assignments_admin_tab /** * Set up professor's Grades tab. */ function grades_admin_tab() { }//END function grades_admin_tab }//END class CISY ?>