Updater user with multiple roles

Roles are assigned one per user. That’s default for WordPress. Instead of using roles, I recommend using capabilities to keep track of different types of users. You can assign multiple capabilities per user and set some default capabilities for the role. See: add_cap() and remove_cap()

Force modified contributor role to be re-approved on edit?

you can use ‘wp_insert_post_data’ hook to check if the user is not an admin, and if the post status is allready “published” change it to “pending”: add_filter(‘wp_insert_post_data’,’re_aprove’); function re_aprove($data , $postarr){ global $current_user; get_currentuserinfo(); //check if current user is not admin if (!current_user_can(‘manage_options’)){ if ($data[‘post_status’] = “publish”){ $data[‘post_status’] = “pending”; } } return $data; }

Paypal API and WordPress

Try working through the source code of a plugin such as PayPal Framework. From your question, the WP side is fairly trivial, but you should study general PayPal tutorials to understand the API, for example, here’s the first search result from Google for PayPal API tutorial: Using PayPal’s IPN with PHP Also some additional helpful … Read more

Plugin creation – how to add user rights?

Here how register a role specifically for a plugin and add plugin specific capabilities to selected core roles function my_plugin_install() { // add a new role for plugin with some capabilities add_role(‘my_plugin_role’, ‘My Plugin Role’, array( ‘manage_my_plugin’ => true, // plugin specific capability ‘read’ => true // core capability )); // add plugin capabilities for … Read more

How to get a users list by who created them?

I’ve found it. /*** Adding extra field to get the the user who creates the another user during ADD NEW USER ***/ function custom_user_profile_fields($user){ if(is_object($user)) $created_by = esc_attr( get_the_author_meta( ‘created_by’, $user->ID ) ); else $created_by = null; ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”created_by”>Created By</label></th> <td> <input type=”text” class=”regular-text” name=”created_by” value=”<?php echo $created_by; … Read more

Get and display a user’s profile info?

You could create a custom template page for this purpose and take advantage of the appropriate class provided by WordPress itself: WP_User_Query Eg: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array ( ‘role’ => ‘Manager’, ‘order’ => ‘ASC’, ‘orderby’ => ‘display_name’ )); // Get the results $managers = $wp_user_query->get_results(); // Looping managers if (!empty($managers)) … Read more

Check role of Username then echo something if administrator [closed]

@terminator answer might work but there’s no need to create an array and use array_intersect I think since you’re only looking for one role. This might be more comprehensible: $current_user = wp_get_current_user(); $roles = (array) $current_user->roles; if (in_array(‘administrator’, $roles) { /* echo whatever */ } Don’t forget to check that ‘administrator’ is acutally the role … Read more

reset the users roles – is there a way to do this?

The easiest way I know to reset roles and their associated capabilities is to use wp-cli. wp-cli has a built-in method for resetting roles. You can specify any that you want to reset. For example: wp role reset author contributor editor subscriber There is also an –all flag, which you can use like this: wp … Read more

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