Hide Admin Menu for Specific User ID who has administrator Role

I am trying to hide almost every single admin menu from wordpress dashboard for a specific user id who has administrator role. I want to give that user only option to edit a certain custom post type named lessons and other custom post type Events. I am using LMS wordpress theme from themeforest by designthemes. I am not sure why this theme just don't give access to the WP-admin for other role except administrator, like Editor, Contributor etc. So I …
Category: Web

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

I have this problem, I've completely deleted all plugins, themes and changed php to 7.1. Nothing is helping. I have the same message: "The site is experiencing technical difficulties. Please check your site admin email inbox for instructions." Are there other areas I can check and see if it works?
Category: Web

Parent User and Child User - relate users

I need to create a system in which I have 2 types of users: Company User (C) and Employee User (E). I need C to be able to register as many E as necessary and for C users to be able to publish articles that will only be visible to E users, children of C users. I figured it would be possible to do this with meta fields so I created the ACF DAD and CHILD field with Jet Engine …
Category: Web

how to update current logged user username

I need to keep in sync the username and the email of my users. I don't know if there is a better way so I have tried running this code right after the user updates his profile data: global $wpdb; $wpdb->update( $wpdb->users, array('user_login' => $email), array('ID' => $user->ID) ); but this way the auth cookie becomes invalid and the user is logged out. I have also tried forcing the creation of the auth cookie right after the update, like this: …
Category: Web

How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?

My requirement is to create a survey in wordpress, and the user needs to log in before answering. But the login page uses our own business account, so we created a login page ourselves (using .net core). Therefore After logging in, we migrated to the wordpress survey page . But before entering the wordpress page, the wordpress side needs to check whether the user is logged in through a cookie. Go to the survey page if you have logged in, …
Category: Web

if role is logged in then do something

I need some pro eyes please. Over all, I'm adding one button/link to the MAIN NAV depending on the logged in role. I have this “working” code: if ( ! function_exists( 'add_extra_item_to_nav_menu' ) ){ function add_extra_item_to_nav_menu( $items, $args ) { if (current_user_can('administrator') && is_user_logged_in() && $args->menu-5) { $items .= '<li><a href="/product-category/public/SCHOOL_NAME/" class="navShopNow fungula">SHOP NOW ADMIN</a></li>'; } //School ROLEABC elseif (current_user_can('ROLEABC') && is_user_logged_in && $args->menu-5) { $items .= '<li><a href="/product-category/public/SCHOOL_NAME/" class="navShopNow fungula">SHOP NOW ABC</a></li>'; } //School ROLEXYZ elseif (current_user_can('ROLEXYZ') && is_user_logged_in …
Category: Web

How to create new permission for custom post types for doing specific tasks

I am in the need to create new permissions with the following access: Post_Type_A (Custom post type): Access to Post_Type_A content type Post_Type_B (Custom post type): Access to Post_Type_B content type I am new to WordPress and no idea where to start. If someone please guide me about this I would be grateful. Regards
Category: Web

How to generate expiring URL of the page?

I have a Wordpress site with sensitive private data and I email the link of the whole page to a client via email etc. How can I expire the link after 1 Session, So if a client opened the link to visit the site and closed the page that link wont work anymore and the Wordpress is not accessible, saying the session has expired Please ask for another session. How can I do that?
Category: Web

How to show private pages based on a user's role?

For example. User "Mary" should be able to view to the private page "marys page" after logging in, "Tom" should be able to view the private page "toms page", etc I created new users and am using the "user role editor" plugin to assign them to their own role. Each user will be able to see their own private page. I am using "peters login redirect" to redirect each user to their own private page. My problem is that I …
Category: Web

How to customize wp_signon()

I am trying to get a customized sign on process. The features that are absent in WordPress by default are the following: Allow user to choose a password at the time of registration. Allow user to sign in using social networks particularly Facebook, Twitter and Google plus. Verify user's Cell Phone number using sms for activating account. Let the default role of every new user, irrespective of the sign in method, be elevated to contributor. Upon successful log in, the …
Category: Web

How do I create a custom role capability?

I wish to create a custom capability for accessing the interface of my plugin. Should the plugin manage adding this capability to all the administrator accounts on activation? If so: Does WordPress manage adding the capability to all administrators of sub blogs and super administrators in multisite installations, or does that function need to be handled by the plugin?
Category: Web

Make pages visible to only logged in members

I want to make a page for each user on my website. When a user logs in, I want them to be able to click on pages that are just designed for them (basically when they log in, I want them to be able to view their own profile). When another user logs in, I want them to be able to view their own profile. Note: I want their profile called 'MY ACCOUNT' and I need to show that on …
Category: Web

Why does get_posts only show results for Admins or logged-out users?

I use a get_posts() call with these arguments: array(6) { ["include"]=> string(14) "1633,1634,1635" ["post_status"]=> string(3) "any" ["post_type"]=> string(10) "attachment" ["post_mime_type"]=> string(5) "image" ["order"]=> string(3) "ASC" ["orderby"]=> string(8) "post__in" } While logged out or logged in as an Admin, it works fine and returns the objects for 3 images. However, when the user is just a Subscriber/Author/Editor/Contributor, it returns an empty array. All plugins enabled/disabled doesn't make a difference. When switching the theme to an official WP theme, the error no …
Category: Web

Give editors access to particular plugin - turn "admin.php" into "edit.php"

I'm using the Business Opening Hours plugin. I made it appear in the sidebar using the Client Dash plugin, but when the Editor clicks it, they cannot access it, only the Admins, how can I change that? I found some code snippets in the plugin, can I change something here? if( is_admin() ) $bizohours_settings_page = new BizoHoursSettingPage(); public function __construct() { add_action( 'admin_menu', array( $this, 'bizohours_plugin_page' ) ); add_action( 'admin_init', array( $this, 'bizohours_page_init' ) ); } /** * Add plugin …
Category: Web

Access on specific pages in wordpress for a specific user

My Question is regarding User access control in wordpress I have two user - admin (admin access) and user1(editor). My requirement is admin can do any modification in admin site. But user1 can only edit and update some pages and no access other access except assigned pages. I have no idea how to implement this functionality so your help is required? My working environment : wordpress v 3.2.1 Theme is twenty ten
Category: Web

How to restrict CPT post's fronted view only for specific user roles?

I have a CPT named 'book' and I would like to restrict front-end view of this book, like specific role users can only view this book contents from front-end, by default anyone can see CPT posts from frontend, I have tried with capabilities and map_meta_cap but not getting expected result. CPT code: $args = array( 'labels' => $labels, 'hierarchical' => true, 'description' => 'test book', 'supports' => array( 'title', 'editor', 'author'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, …
Category: Web

Plugin to restrict access to pages in wp-admin

I've searched all day for this and couldn't find a plugin that allow me to restrict the access to specific pages in the wp-admin backed by user role. Example: I have several users on my website and I want them to only see the pages that they are allowed to edit. I've done this manually by code and it's working (see code below), but I wanted a plugin that allowed me to the same thing. Why? Because I have a …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.