Skip Navigation

[Resolved] Want to Add Claim Your Business Button

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

Problem:

I am creating a Directory Listing of Restaurants, and want users to claim their business, but don't know if that is possible with Toolset.

Solution:

I think it is possible with Toolset plugins + some custom codes, here is my suggestion:

https://toolset.com/forums/topic/want-to-add-claim-your-business-button/#post-2264231

Relevant Documentation:

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

This support ticket is created 4 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Rahul Singh 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#2263821

Hello Team,

I am creating a Directory Listing of Restaurants, and want users to claim their business, but don't know if that is possible with Toolset.

By Claiming Their Business, They Can Edit Listing Which they have claimed and it will be assigned to them as their listing.

In this Process I want them to Register and Select The Listing they want to claim and provide some basic info and submit. After we cross verify the information they provided we can approve their Claim and it will be added to them as their listing.

Thank You

#2264231

Hello,

I think it is possible with Toolset plugins + some custom codes, here is my suggestion:
1) Setup two post types:
- Restaurants
- Claims(with custom field "verified")
https://toolset.com/course-lesson/creating-a-custom-post-type/
https://toolset.com/course-lesson/creating-custom-fields/

2) Setup one-to-many relationship between "Restaurants" and "Claims"
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/

3) Create a post form for creating new "Claim" post
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
Send an email notification to specific admin user:
https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/

4) In the single "Restaurant" post:
a) For normal user, display above child post form link:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/#creating-forms-when-a-parent-post-is-preselected
So user can create a "Claim" post and related it with "Restaurant" post
b) For admin user, display a post view:
- Query the "Claim" post
- Filter by:
Post type relationship between "Restaurants" and "Claims" post types.
- In views loop, display a post form for editing "Claims" post(and enable the custom field "verified")
https://toolset.com/course-lesson/front-end-forms-for-editing-content/
So admin user can enable the field "verified", after he submits this form, use action hook "cred_save_data" to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
In this PHP function:
a) get the "Claims" post author ID + parent "Restaurants" post ID
https://developer.wordpress.org/reference/functions/get_post_field/
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
b) change the "Restaurants" post author to the child "Claims" post author:
https://developer.wordpress.org/reference/functions/wp_update_post/

5) In the user's "My account" page, display a post view:
- query "Restaurants" posts
- Filter by post author is same as current logged-in user:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- In view's loop, display the editing "Restaurants" post form link

For your reference.

#2264299

Hello Luo,

That's great to hear that it's possible but instead of custom code can we use Zapier or Uncanny Automator or Integratly.

#2264323

The custom codes I mentioned above can be setup not too much difficultly, you can create new ticket when you need assistance for it.

For the "Zapier or Uncanny Automator or Integratly" issue, it is out the range of Toolset support, I am not sure if they can do the same task, but it will involve other unexpected compatibility problems.

#2264915

My issue is resolved now. Thank you!