How to create different views for different user roles?

If you are looking for a programming solution I can follow up in the comments with examples, but I think the best “plug and play” solution would be an existing solution like Learndash(https://www.learndash.com/) or Sensei (https://woocommerce.com/products/sensei/). These have different roles, quizzes with grading, and other features that you may find useful. Here are some additional … Read more

TCPDF only exports .pdf when user is administrator

This was due to 2 mistakes in code restricting client access to wp-admin. There was no exception for admin-post.php , so after a request to admin-post the client was redirected back to client area. Hence the ‘reloads’ after clicking the link. After the redirect in the restriction code, there was no die() or exit statement. … Read more

Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]

Issue #1 This line of code define( ‘DISALLOW_FILE_EDIT’, true); does not go into functions.php. It should be removed from function.php and put in your config file, wp-config.php in the root of your WP install. Here is more info on what DISALLOW_FILE_EDIT does. Issue #2 You are removing the menu items for admins. if(current_user_can( ‘administrator’ )){ … Read more

How to show only specific category post by user role without plugin and restrict all other cats

If you’re using global loop for displaying the posts, then you can easily modify which posts are shown using pre_get_posts action. function restrict_categories_for_user( $query ) { if ( ! is_admin() && $query->is_main_query() && get_current_user_id() ) { $user = wp_get_current_user(); if ( in_array( ‘viewer_a’, (array) $user->roles ) ) { // The user has the “viewer_a” role … Read more

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