Add another role to a user when they click a button?
Add another role to a user when they click a button?
Add another role to a user when they click a button?
The exact solution depends on how you create a team. You will have to hook into that action. Supposing that creating a team is done by creating a post of the custom type “team” you would hook into save_post_team, leading to something like this: add_action (‘save_post_team’, ‘wpse314398_change_team_captain_role’, 10, 3); function wpse314398_change_team_captain_role ($post_id, $post, $update) { … Read more
By using this functionality we can able to remove the delete option of the page or post. function wp_restrict_page_deletion( $caps, $cap, $user_id, $args ) { $post_id = $args[0]; if ( $cap === ‘delete_post’ && $post_id === your post id* ) { $caps[] = ‘do_not_allow’; } return $caps; } add_filter( ‘map_meta_cap’, ‘wp_restrict_page_deletion’, 10, 4 ); I … Read more
Check what capabilitie(s) an action requires
For functionality like this I think you’ll have to go with premium plugins or code it yourself. If you want to go with custom code Pods might be able to help you out with creating relationships between doctors and patients: https://wordpress.org/plugins/pods/
Not allow add New Page for role ‘editor’
You need either a membership plugin or a user management plugin, you can try these: https://wordpress.org/plugins/restrict-content/ https://wordpress.org/plugins/user-specific-content/ https://www.paidmembershipspro.com This also can be handled pretty easily with a conditional PHP snippet.
I figured it out using this previous post: Issue with front-end ajax, getting a 302 redirect when accessing wp-admin/admin-ajax.php Basically, I had added an action to prevent subscribers from seeing certain wordpress pages. function limit_subscriber_access() { $redirect = home_url( “https://wordpress.stackexchange.com/” ); if ( ! ( current_user_can( ‘manage_options’ ) || current_user_can( ‘edit_posts’ ) )) exit( wp_redirect( … Read more
Please use this plugin for Roles see different top menu (nav menu) : https://wordpress.org/plugins/nav-menu-roles/
There’s quite a few issues with this code: $query is not defined in your callback function. role is not a valid argument for a query. You’re passing the $ids variable incorrectly. To query for multiple authors you need to use author__in. You’re checking is_category() incorrectly. For the first issue, the problem is that you’re not … Read more