Show Biographical Info while creating new user

No. There are no hooks or filters to add an input field to the create user form. Maybe it is possible to add an input field via jQuery. I have not tested it. If it is pssible to add an input field, than it should be possible to save this information because the process of … Read more

get_users meta_query

meta_query parameter is an array of arrays, $args = array( ‘meta_query’=> array( array( ‘relation’ => ‘AND’, array( ‘key’ => ‘minbeds’, ‘value’ => $rooms, ‘compare’ => “<=”, ‘type’ => ‘numeric’ ), array( ‘key’ => ‘maxbeds’, ‘value’ => $rooms, ‘compare’ => “>=”, ‘type’ => ‘numeric’ ), array( ‘key’ => ‘minprice’, ‘value’ => $price, ‘compare’ => “<=”, ‘type’ … Read more

Order the users by the date of their latest post

Put this in your functions.php: function get_users_ordered_by_post_date($args=””) { // Prepare arguments if (is_string($args) && ” !== $args) parse_str($args, $args); $asc = (isset($args[‘order’]) && ‘ASC’ === strtoupper($args[‘order’])); unset($args[‘orderby’]); unset($args[‘order’]); // Get ALL users $users = get_users($args); $post_dates = array(); if ($users) { // For EACH user … foreach ($users as $user) { $ID = $user->ID; // … Read more

How to set custom upload directory per user after moving content directory

With credits to petermolnar via irc://freenode.net/wordpress I can answer my own question. The key is to set an upload-dir filter in the theme’s functions.php: function per_user_upload_dir( $original ){ // use the original array for initial setup $modified = $original; // set our own replacements if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $subdir = $current_user->user_login; … Read more

pre_user_query meta_query admin user list

You are using pre_user_query according to WordPress documentation Fires after the WP_User_Query has been parsed, and before the query is executed Then you should use pre_get_users just like pre_get_posts when your arguments have some meaning to WordPress. pre_get_users Fires before the WP_User_Query has been parsed Replace your hook with add_action(‘pre_get_users’, ‘modify_user_list’);

How to add custom query filters in WP_User_Query

The pre_user_query action hook in WordPress will allow you alter the SQL statements in the WP_User_Query object before they are run against the database. Note, this is an action, not a filter, so there’s no need to return the $user_query that gets passed in. add_action( ‘pre_user_query’, ‘add_my_custom_queries’ ); function add_my_custom_queries( $user_query ) { $user_query->query_fields .= … Read more

How does WordPress connect sites and the wp_users table?

On multisite it’s still a single user table for all websites. It identify user relationship with sites on the table wp_usermeta, under the following user meta keys: wp_x_capabilities wp_x_user_level There are other meta keys for user options. But I guess there is no difference on other meta fields (like name, display name and etc), so … Read more

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