Roles at registration (classipress)

In your functions.php file do this: add_action(‘register_form’,’register_role_field’); add_action(‘register_post’,’check_fields’,10,3); add_action(‘user_register’, ‘register_role_fieldforuser’); // This will register new field in registration form function register_role_field(){ ?> <label>Choose your role:<br/> <!— Let’s check if there role already set. If $_GET[‘role’] = 0 -then this is teacher if 1 = student —> <?php if ( isset( $_GET[‘role’] ) ) { ?> … Read more

Allow user to Publish, but not Edit or Delete

I am not sure what you’re trying to do by not allowing Edit. Its only a job of Publishing the post it seems. (or maybe add some Meta description etc) But, if you’re looking at creating a Moderator, you need to create additional user group & assign permissions. You can try http://wordpress.org/plugins/advanced-access-manager/ or similar plugins … Read more

how to add custom user capabilities using add_user_meta or something else?

Try passing the value without serializing it manually, because WordPress will do it for you anyway: add_user_meta( $user->id, ‘orewpst_capabilities’, array( ‘author’ => 1 ), true ); or update_user_meta( $user->id, ‘orewpst_capabilities’, array( ‘author’ => 1 ) ); // it will create the meta data for you if it doesn’t exist already. The s:23 means that you … Read more

Restrict Author to pick from media library, but not upload media

Just taking a rough stab at this… add_filter(‘media_upload_tabs’, ‘modify_media_tabs’); function modify_media_tabs($tabs) { if (is_super_admin()) return $tabs; return array( ‘type_url’ => __(‘From URL’), ‘gallery’ => __(‘Gallery’), ‘library’ => __(‘Media Library’) ); } add_filter(‘_upload_iframe_src’, ‘change_default_media_tab’); function change_default_media_tab($uri) { if (is_super_admin()) return $uri; return $uri.’&amp;tab=library’; } add_action(‘current_screen’, ‘check_uploading_permissions’); function check_uploading_permissions() { if (is_super_admin()) return; if (get_current_screen()->id == ‘media-upload’ … Read more

Ordering users of a specific role by last name

There is apparently an open ticket about this bug. Here is a workaround that I tested: $args = array( ‘meta_key’ => ‘last_name’, ‘role’ => ‘guest-teacher’ ); $wp_user_query = new WP_User_Query($args); $wp_user_query->query_orderby = str_replace( ‘user_login’, ‘wp_usermeta.meta_value’, $wp_user_query->query_orderby ); $wp_user_query->query(); $authors = $wp_user_query->get_results(); Problem with this is that it runs the query twice.