Redirect a user roll to a page after login in mutlisite network
Redirect a user roll to a page after login in mutlisite network
Redirect a user roll to a page after login in mutlisite network
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
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
How to make this custom capability work? [duplicate]
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
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
So, I went and found a plugin called Adminimize https://wordpress.org/plugins/adminimize/ that allows me to show/hide admin menu items based on user roles. This allowed me to show the Options Page as editable for the custom user role I made but prevent them from editing other parts of the site.
How to Moderate Edits to User Profiles?
Adding user using admin ajax by a user with custom role
With the wp_login hook the logged in user might not be set as the current user yet, so instead of using wp_get_current_user(), use the user object that’s passed to the hook callback. Then you can be certain that you’re setting the role on the correct user, rather than relying on the global state, which is … Read more