_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( 'cisy_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( 'cisy_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( '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( 'cisy_submission', $args ); //Grades $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 class grade schemes.', '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' => true, 'menu_position' => 10, 'show_ui' => true, ); register_post_type( 'cisy_grade', $args ); }//END function register_post_types /** * Prevent students from using personal email accounts. */ public static 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 }//END CISY Class ?>