Skip Navigation

[Resolved] Creating "Claim Now" button for custom post type

This support ticket is created 4 years, 3 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
- 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/Karachi (GMT+05:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 4 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#1418987

Tell us what you are trying to do?
I'm trying to create a button that is visible to logged in users only that allows custom post types to be claimed by a registered user. Using the link below, I do have the button working properly. When another user clicks on the "Claim Now" button it does change the author of the post to the user who clicked it. However; I need that button to disappear once the post has been claimed by anyone other than the administrator.

Is there any documentation that you are following?
I have been following this link:
https://toolset.com/forums/topic/how-to-create-a-claim-function-with-admin-approval/

Is there a similar example that we can see?

What is the link to your site?
beta.iwebnow.net

#1421819

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Joshua,

Thank you for contacting us and I'd be happy to assist.

You can use the "wpv-post-author" shortcode, to get the "user_level" of the post's author:
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-post-author


[wpv-post-author format='meta' meta='user_level']

By default, only the users with the "administrator" role will have "user_level" equal to "10".

This shortcode can be used in a conditional code block so that the claim now button is only visible when that value is not equal to 10.
( ref: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/ )


[wpv-conditional if="( '[wpv-post-author format='meta' meta='user_level']' ne '10' )"] 
Claim now button's code
[/wpv-conditional]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.