Skip Navigation

[Resolved] Claim ownership of a specific post while submitting registration form

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to add a registration form that allows people to claim ownership of a post. Once an admin approves their ownership, the registrant becomes author of that post.

Solution:
If I were trying to do something like this, I would follow this process:
- Create a new CPT called Pending Approvals
- Add custom fields to the Pending Approval CPT - user ID, university ID, college ID, and school ID
- Use cred_save_data to create a Pending Approval post whenever someone submits the User Registration form while trying to claim ownership of a University, College or School.
- Save the new User's ID and the appropriate University, College or School ID in the Pending Approval post
- Create a View of Pending Approval posts. In the Loop of results, include a "Delete Post" link that can be used to decline the ownership request. Also include an Edit CRED form that edits the University, College, or School. Hide or remove all the visible inputs from this form except the submit button, and give it a name like "Approve Ownership"
- Use the cred_save_data hook to update the University, College, or School post author when this form is submitted, and trash the Pending Approval post.
- Insert the View of Pending Approval posts in a page that is restricted to site administrators.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

This support ticket is created 6 years, 9 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#614900

Hi !
I am setting up educational project.In this project I am going to publish pages of university/college/schools.For that purpose I am going to use different cpts with custom roles.
Initially I am going to submit some university/colleges/schools.But when any university/colleges/schools authority will see their page they can claim to become official author to edit/delete content.
So for this purpose I want to use registration form which will assign new user/Claimant as a author of any published post .
(Note: I think one more step is needed...manual verification.Because its risky to give authorship without verifying designation of that person.)
Is it possible ?

#615030

Hi, I think a significant amount of custom code will be required to accomplish something like this. There is no built-in post modification approval workflow, so you would be required to create this workflow yourself by creating and modifying posts with CRED. It's not possible to submit a post change for approval when submitting a User CRED form. To create or modify a post when a User CRED form is submitted, you must use the cred_save_data API: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

If I were trying to do something like this, I would follow this process:
- Create a new CPT called Pending Approvals
- Add custom fields to the Pending Approval CPT - user ID, university ID, college ID, and school ID
- Use cred_save_data to create a Pending Approval post whenever someone submits the User Registration form while trying to claim ownership of a University, College or School.
- Save the new User's ID and the appropriate University, College or School ID in the Pending Approval post
- Create a View of Pending Approval posts. In the Loop of results, include a "Delete Post" link that can be used to decline the ownership request. Also include an Edit CRED form that edits the University, College, or School. Hide or remove all the visible inputs from this form except the submit button, and give it a name like "Approve Ownership"
- Use the cred_save_data hook to update the University, College, or School post author when this form is submitted, and trash the Pending Approval post.
- Insert the View of Pending Approval posts in a page that is restricted to site administrators.

As you can see, this process is complex. If you have questions, please create separate tickets where we can discuss each issue in detail.

#615753

Thanks a lot for showing proper way.