Skip Navigation

[Resolved] Change post status to draft or pending when its author role changes

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)

This topic contains 4 replies, has 2 voices.

Last updated by dominiqueM-3 3 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2119853

Tell us what you are trying to do?

Hello,

I am working on a directory of professionals very similar to the one explained here:
https://toolset.com/lesson-placement/lesson-placements-1622969-1929573/

I would like the status of the post which serves as a profile for the professional to be linked to the role of the user/professional (i.e. the author of the post).
More precisely I would like that when the role of the user (professional) account changes to 'subscriber' then the status of the post (the profile) of which he is the author changes from 'published' to 'pending' or 'draft'.

Do you think it is possible?
How could I do that?

Thank you

#2119875

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I would like to know first here at what action the role of the user from one role to another role will be changed? Is it a automatic process or it will be changed manfully or how exactly or you are using third party plugin that will change the role?

#2119899

Hi Minesh,

Thank you for your support.

I'm thinking of a manual action by an administrator from the WordPress admin interface.
The site administrator decides that a user no longer has the right to see his profile published on the site.
Rather than simply deleting the user, he could change his role and bring him back to 'subscriber'. The corresponding profile post would then change from 'published' to 'draft' or 'pending'.

Regards

#2119963

Minesh
Supporter

Languages: English (English )

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

There is no such feature available. This will need custom programming which is beyond the scope of our support policy.

However, you should check the following link and hook in the hook shared with the following link and try to adjust the code as per your requirement.
=> https://wordpress.stackexchange.com/questions/194324/execute-a-function-when-admin-changes-the-user-role

#2120749

Thank you!