restrict admin panel sections to users

Add the following, to functions.php of the current theme (child theme is preferred!): CSS solution: function no_email_changes_in_profile() { $screen = get_current_screen(); if (‘profile’ == $screen->base && !current_user_can(‘manage_options’)) { echo ‘<style> input#email { pointer-events: none; } </style>’; } } add_action(‘admin_head’, ‘no_email_changes_in_profile’); jQuery solution: function no_email_changes_in_profile() { $screen = get_current_screen(); if (‘profile’ == $screen->base && !current_user_can(‘manage_options’)) { … Read more

How to block access to certain WordPress pages using a snippet

Try this, assuming that job_posting_access is a valid hook defines by some plugin: add_action( ‘job_posting_access’, function() { // $pages is Page ID, title, slug, or array of these for which access is restricted $pages = ( array (‘page 1’, 42, ‘page-2′) ); if ( ! current_user_can( ’employer’ ) && is_page( $pages ) ) wp_die(‘<div class=”job-manager-error”>Sorry, … Read more

ERROR message: “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”

I would reinstall WP (don’t overwrite your wp-config.php file). Then reinstall all themes/plugins from original source. You may have to do this with FTP if you don’t have access to admin area. Although FTP is slower (depends on your connection speed), that will ensure that all files have latest versions. Then, use File Manager to … Read more

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

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)