Is this code true or not

Best way to find if a code works or not is to actually try it 😉 On the face of it, it doesn’t look like you are trying to handle storing the user ids in an array or any serialized way at all.

How change user type from contributor to author

I recommend backing up the database before making any major/bulk changes to it. First you need to get all users with the role “contributors”, then update their roles to “author”. $contributors = get_users(array(‘role’=>’contributor’)); foreach($contributors as $contributor){ wp_update_user(array( ‘ID’ => $contributor->ID, ‘role’ => “author”) ); } echo “done updating contributors to authors”; You could have this … Read more

How to activate the user search

I have found a great tutorial here that have helped me to developing a custom user search. This is my solution: <?php /* Plugin Name: Simple User Listing Description: Create a simple shortcode to list our WordPress users. Author: Damiano Fossa Version: 1.6.3 */ function sul_user_listing($atts, $content = null) { global $post; global $wpdb; extract(shortcode_atts(array( … Read more

List users by meta_key and meta_value

What about putting the city/regions/whatever into an array you can loop through? Something like this: $cities = array( ‘Richmond’, ‘Chicago’, ‘New York’ ); foreach ( $cities as $city ) { ?> <h2><?php echo $city; ?></h2> <ul><?php foreach ( get_users_by_meta_data( ‘school_division’, $city ) as $user ) { ?> <li><?php echo $user->first_name; ?> <?php echo $user->last_name; ?></li> … Read more

Preventing auto-filling of e-mail addresses on profile.php

You can try to inject an autocomplete attribute into the form element on that page. There is a dedicated action for that: user_edit_form_tag. add_action( ‘user_edit_form_tag’, function() { print ‘ autocomplete=”off”‘; }); If that doesn’t help – and it looks like the new IE has a bug here – you could try the solution from this … Read more

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