How to test for Super Admin

I got it to work as follows — in mu-plugins directory, my superAdmin.php script looks like this: <?php function check_for_superAdmin($user_login, $user) { $current_user = get_userdatabylogin($user_login); if ( is_super_admin( $current_user->ID ) ) { // do these things } else { // do other things } } add_action( ‘wp_login’, ‘check_for_superAdmin’, 10, 2 ); ?> Hope this helps … Read more

Making shortcode of filtered number of comments by user role

The code below adds the counts for user roles. It’s commented pretty well to explain what’s happening. It should give you a good starting point for further customization (maybe you want to hide 0 counts, change the HTML output, etc.). function comments_shortcode($atts) { $current_user = wp_get_current_user(); extract( shortcode_atts( array( ‘id’ => ” ), $atts ) … Read more

Hide Specific User Page

I’m assuming you want to hide the author page on the site itself (and not in wp-admin). To do that, just create a new template file called author-{$id}.php, where {$id} is replaced by the ID of the author you want to hide. So if the author ID is 6, the template file should be called … Read more

If specific user role then sticky post

It looks like it is possible. Sticky posts are stored as array of IDs in an option called ‘sticky_posts`, and you can modify options using hooks, so… There is a chance that something like this would work: function fake_sticky_posts_for_author() { $user = wp_get_current_user(); if ( get_current_user_id() && in_array(‘author’, $user->roles) ) { // Return the IDs … Read more

Prevent custom user role to add new pages

Post types in WordPress have a list of capabilities that govern permissions surrounding them. These are: edit_post read_post delete_post edit_posts edit_others_posts publish_posts read_private_posts read delete_posts delete_private_posts delete_published_posts delete_others_posts edit_private_posts edit_published_posts create_posts Internally each post type matches these to the actual capabilities that can be given in WordPress. Most of the time these have the exact … Read more

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