Interesting functionality, you will need something that does this:
- Will need to use the hook
set_user_role
to detect when user role change - Then will need to query all posts from that user
- Then use
wp_update_post
to change the post status
Related Posts:
- wp_update_user not updating
- Is WordPress’ is_user_logged_in() secure?
- Temporarily disable user role login and replace with message
- how to add custom user capabilities using add_user_meta or something else?
- Is there a way to set the user Role based on email domain
- pre_get_posts Remove posts based on meta value with ‘post__not_in’
- What is the difference between “create_users” and “add_users” capabilities?
- Access on specific pages in wordpress for a specific user
- Hide Specific User Page
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- How do I remove the Other Roles field (from User Role Editor plugin) in wp-admin/user-new.php
- How to redirect specific post type with user role
- wordpress editor role remove all but ‘menus’ in appearance menu
- Parent User and Child User – relate users
- How to create user specific pages (not user role!)?
- Assigning certain authors to specific editors
- Restrict Access in Admin Panel
- Limit a user to have access to only specified pages?
- Plugin creation – how to add user rights?
- User restricted only show posts assigned to current user
- Restrict custom post content to specific user
- Hide front-end from every logged out user and redirect them to the default login page
- How to restrict an admin page, if the user is not superadmin?
- Need to block user role from accessing bbPress all together
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Infinite redirects at front end if logged in user is not an Admin (Toolset Access)
- Is there a way to allow users with “Subscriber” user role to access media library in backend and frontend
- How to make WP page accessile only to specific user roles
- grant multiple roles access to specific admin menu item
- Check what capabilitie(s) an action requires
- Is it possible to restrict a specific user to edit a specific custom post.
- New folder and file permissions are not correct
- How to change user role setting in members plugin so that user can only edit his own post?
- How to change a user’s role?
- Allow member to have access to custom post type only. Permission to only edit their own posts
- Is it possible to add new user Roles?
- Troubleshooting a “You do not have sufficient permissions to access this page” error
- Restrict admin access to certain pages for certain users
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- Temporarily give ‘manage_options’ capability
- Only allow administrators and editors to access wp-admin
- Hide specific admin users’ posts
- How to allow registered users to change their user role through frontend?
- if role is logged in then do something
- how to change user roles for users who doesn’t have any. (about 8000 users)
- Shold I manually add ‘cap’ to admin role ?
- Getting a user role from the user login name
- Why is wp-login redirecting to the home page when I use this function?
- Allow contributor to view own scheduled post
- Editor and contributor roles not correct after adding function
- How are roles stored in the database?
- How to delete user roles?
- Set default page for user account in admin
- Users Role and Access
- Restricting access to content
- Only allow administrators and editors to access wp-admin
- Why does this check to see if user is authorized to edit a post fail for all but super admins?
- Hide everything on site for visitors except specific page IDs
- How to allow a user to make their post (ad) a draft, and then publish again without needing approval?
- Customized role that allows users to “Submit for Review” instead of “Publish”
- Adding an additional role to an Administrator
- Allow editors to post iframes [duplicate]
- Restrict Author role to only 3 wp-admin pages
- if user has a certain role then display image
- My subscriber has the “edit comment” capability but can’t edit comment
- Why does get_posts only show results for Admins or logged-out users?
- Add custom role across network in multisite
- how to remove some permissions from a shop “manager role” in woocommmerce?
- reset the users roles – is there a way to do this?
- Custom wordpress admin page/url “You do not have sufficient permissions to access this page.”
- user_can() not working for comment authors
- WordPress add_rewrite_rule redirection match GET variable not passing through to custom template
- Redirect admin 403 “Cheatin uh?” admin pages
- Migrating Roles from one environment to another
- Letting users create a post that is a custom post type from a page
- Is WordPress secure enough for a multi-user article directory?
- Learndash change user role after completing the course
- How to disable activation email to specific user role?
- logout users with specific role after close browser tab
- Admin user name not showing up in author dropdown
- Separate user bases or hide users of another role or connected to another minisite
- How to restrict subscriber editing other posts but read specific posts in backend
- Publishing post strips custom html element when user is not admin
- Best practices to handle multilpe roles and capabilities?
- Allow multiple roles to specific user
- How do I restrict a second admin certain access?
- user has permission to read a custom post but it is not being shown in wordpress plugin
- Restrict custom fields based on user roles
- Select dropdown with 2 choices from foreach
- translate_user_role doesn’t work
- How to assign role to a custom registration form?
- How to add user roles? [closed]
- Check if specific role exists
- Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
- How to assign a custom gender to a user role?
- assign roles to users in custom drop down in signup form
- Hide block of HTML if the users role is a certain role
- How might I enable a user to view Draft pages from a different Author, without the ability to edit?
- Display users by role