Order users by custom user meta

Here’s the solution. Comments included: <?php $results = get_users(‘role=director’); foreach ($results as $result) { // Get data about each user as an object $user = get_userdata($result->ID); // Create a flat array with only the fields we need $directors[$user->ID] = array( ‘dir_order’ => $user->exit_director_order, ‘dir_id’ => $user->ID, ‘dir_name’ => $user->first_name.’ ‘.$user->last_name ); } // Sort sort($directors); … Read more

Remove Ability for Administrators to Delete Administrators

Your question seems to boil down to this I can’t figure out how to check that the $userids in question are an administrators user ID. Try user_can($id,’administrator’) http://codex.wordpress.org/Function_Reference/user_can The Codex has a warning about using role names with the current_user_can function and it is very similar to user_can so I suppose caution is order until … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)