get random users each time based on the meta key

As get_users does not support the order_by random, you could shuffle the array after calling the function. If you want to distribute it even, you could make another meta_value, where you store the number of appearances per user, and call the get_users with this new meta_key in ascending sort_order – this way the user with … Read more

How to use `wp_insert_user` & `wp_insert_post` simultaneously without `headers already sent` error?

The header problem is actually this problem: Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in /home/wp-includes/wp-db.php on line 885 Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in /home/wp-includes/wp-db.php on line 885 You are getting those errors because somewhere you are sending an object when you shouldn’t be. When that … Read more

How to show a custom notification to a specific user?

You can show admin notices via the admin_notices action. You can display it for a specific user by checking the contents of the global $current_user: function wpa80367_admin_notice() { global $current_user; if ( ‘someusername’ == $current_user->user_login ): echo ‘<div class=”updated”><p>’; echo ‘This is an admin notice just for you, someusername.’; echo ‘</p></div>’; endif; } add_action( ‘admin_notices’, … Read more

Role based permission edit for plugins

I think the plugin include the possibility with one check for rights, for a capability. You see in the source of the plugin, that he include the menu items, if the user have the capability edit_theme_options. That makes not so easy for you to change this in different roles. You can create custom roles, like … Read more

Using get_user in wordpress with sorting

I think modifying the default tables in your WordPress install is a bad idea. Generally you should never modify the database or the core code, but instead use API functions to get the desired functionality. In this case that you be using the user meta fields to store a sort order for each user. The … Read more

Redirect to current user page upon link click

Thank you so much for the responses. Using both of the ideas received I started to play a little with the code, although I was not sure what to do with them. I came up with a solution that works very well for me, I created a new template in my theme called ‘redirect.php’. At … Read more

Select From wpdb – Author/User Directory page

You’re probably better off to use get_users which returns an array of <?php // get all users, regardless of roll. If you do need to restrict by // role you can use the `role` argument: get_users(array(‘role’ => ‘author’)); $uses = get_users(array(‘orderby’ => ‘nicename’)); foreach ($users as $user) { // do stuff with $user, will have … Read more