Skip Navigation

[Resolved] Hide page and Menu from user role

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 11 replies, has 3 voices.

Last updated by Minesh 3 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1737259

How do I hide a page from a Role and how do I find a Menu item from that role too?

Thank you

#1737363

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

please check our tutorial on how to use Toolset Access to customize how a page is viewed by the different user types of your website.
- https://toolset.com/course-chapter/controlling-access-to-content-in-directory-sites/
- https://toolset.com/home/types-access/

Regarding menus, Toolset plugins do not have a wat to customize how WordPress menus are customized, please check this 3rd party plugin, it may offer what you need:
- https://wordpress.org/plugins/if-menu/
- https://wordpress.org/plugins/admin-menu-editor/
- https://wordpress.org/plugins/wp-custom-admin-interface/

I hope this helps. Let me know if you have any questions.

#1737389

Hi,

I followed all steps here and still doenst work. User role still sees the page:

- https://toolset.com/course-chapter/controlling-access-to-content-in-directory-sites/
- https://toolset.com/home/types-access/

This looks good but how doest it actually work? Any tutorial videos maybe?
https://toolset.com/home/types-access/

Any ideas

#1737645

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Would you allow me temporary access to your website to check this closely? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

Please explain which page should be visible to which role and inaccessible to which role?

#1738389

Test

#1738393

Replies are not set to private...

#1738561

Did you get my last message?

#1739067

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Jamal is on Vacation. This is Minesh here and I will take care of this ticket. Hope this is OK.

Can you please clarify what you want to hide exactly?

Basically - if you are using access, you can not hide the specific page until and unless you assigned that page to post group.

Please check the section "Create a post group for pages restricted to logged-in users" with the following link:
=> https://toolset.com/lesson-placement/lesson-placements-1621543-1655635/

if you want to hide something within the page - you can use the [toolset_access] shortcode.

I will require to know first what exactly you want to hide from the frontend.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1739415

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I dont think there is any feature available to check or get the pending users.

The easiest way is you should use the standard wordpress hook "login_redirect" and check the the user who try to login is pending and if the user is pending then redirect the user to your desired URL.

The following link may help you:
=> hidden link
=> hidden link

#1739431

On this code. What are the numers 10 and 3 - on th elast line?

<?php
function my_login_redirect( $redirect_to, $request, $user ) {
//validating user login and roles
if (isset($user->roles) && is_array($user->roles)) {
//is this a gold plan subscriber?
if (in_array('gold_member', $user->roles)) {
// redirect them to their special plan page
$redirect_to = "hidden link";
} else {
//all other members
$redirect_to = "hidden link";;
}
}
return $redirect_to;
}

add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
?>

#1739593

Thank you I will try this and will update you in a couple of weeks.

#1741913

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok great - please let me know if you require further assistance.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.