Different back-end language for different users?

We could try to filter the WPLANG option locale (see e.g. this approach from the related list here on the right by @brasofilo, that’s based on this one by @toscho ): /** * Override locale settings for the current (non-admin) user */ is_admin() && add_filter( ‘locale’, function( $locale ) { // Modify locale for non-admins … Read more

How to limit users to one comment per post

// Check if user has previously commented the post. global $current_user, $post; if ( ! is_user_logged_in() ) { // Show the comment form if the user is not logged in. comment_form(); } else { // The user is logged in… // Get the comments for the logged in user. $usercomment = get_comments( array ( ‘user_id’ … Read more

Disallowing Users of a Custom Role from Deleting or Adding Administrators?

Hi @NetConstructor: I think this is what you need. Note that I didn’t include the full setup of your ‘website_owner’ role, just the addition of a new capability called ‘manage_administrators’. Also, I only attempted to remove the “Delete” link from any users that don’t have the ‘manage_administrators’ capability (which you’ll need to add to the … Read more

How to do get_users() with multiple meta_keys

As it mentions in the Codex page for get_users, it works the same as a WP_Query meta_query, see that page for full arguments list and examples. $args = array( ‘meta_query’ => array( array( ‘key’ => ‘some_key’, ‘value’ => ‘foo’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘another_key’, ‘value’ => array( ‘bar’, ‘baz’ ) ‘compare’ => … Read more

how to use joomla password format in wordpress?

First of all you need to find out which hashing algorithm has been used on the Joomla site to store the passwords. Joomla – different to Worpdress – ships with a variety of hashing algorithms. If you have found out how the hashes have been generated, you can port the hashing function over into wordpress … Read more

Execute a function when admin changes the user role

You can use the set_user_role hook, that will only fire when the user role changes: add_action( ‘set_user_role’, function( $user_id, $role, $old_roles ) { // Your code … }, 10, 3 ); If you want to restrict this to a profile update, you can use: add_action( ‘set_user_role’, function( $user_id ) { add_action( ‘profile_update’, function( $user_id ) … Read more

Change the author slug from nickname to ID

Surprised to see this unanswered for this long. This is pretty simple to do with a simple block of code: function set_my_nice_name() { global $wpdb; $user_table = $wpdb->prefix . ‘users’; $wpdb->query(“UPDATE $user_table SET `user_nicename`=`ID`”); } add_action(‘init’, ‘set_my_nice_name’); This works because the visible portion of an author slug (or profile slug in BuddyPress) uses the user_nicename … Read more

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