Remove the Edit button in posts for permalinks on certain user roles? WP 3.3

You could do something like (in your functions.php file); if(current_user_can(‘member’)){ add_filter(‘get_sample_permalink_html’, ‘perm’, ”,4); function perm($return, $id, $new_title, $new_slug){ $post = get_post( $id ); if( ! $post || ( $post->post_type !== ‘testimonials’ ) ) { return $return; } return preg_replace( ‘/<span id=”edit-slug-buttons”>.*<\/span>|<span id=\’view-post-btn\’>.*<\/span>/i’, ”, $return ); } To give credit where credit is due, everything between … Read more

edit role display name and label name without plugins

Those names are stored in the option wp_user_roles in the database table wp_options. So, the following will change the name of the subscriber role: $val = get_option( ‘wp_user_roles’ ); $val[‘subscriber’][‘name’] = ‘PeDeBoi’; update_option( ‘wp_user_roles’, $val ); Apparently, this is harmless, but caveat emptor… In your code, $wp_roles->roles[$role][‘name’] = $new_role_name; doesn’t work because it should be: … Read more

Downgrade user from role that allows post creation

You can add actions to the set_user_role hook: add_action( ‘set_user_role’, ‘wpse98904_remove_demoted_user_posts’, 10, 2 ); function wpse98904_remove_demoted_user_posts( $demoted_author_id, $role ) { if( ‘subscriber’ == $role ) { // In here you’d search for all the posts by the user $args = array( ‘numberposts’ => -1, ‘author’ => $demoted_author_id, ‘post_type’ => ‘{your custom post type name}’, // … Read more

Remove wordpress author’s capability to moderate comments on their own posts

From quick look at code the likely permissions check for that is edit_comment capability in edit_comment() function. Your options to remove that capability roughly are: customize the role with plugin, for example Members customize role with code, probably using remove cap functionality filter thiungs around map_meta_cap or user_has_cap if you need to achieve more elaborate … Read more

Hide everything on site for visitors except specific page IDs

If you want to show a message, use this code in your functions.php file- function se_236335_hide_content( $content ){ $pages = array( 8, 26, 35 ); // allowed page IDs if( ! in_array( get_the_id(), $pages ) ){ return ‘Message here..’; } return $content; } add_filter( ‘the_content’, ‘se_236335_hide_content’ ); If you want a page redirection, use this- … Read more

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