Skip Navigation

[Resolved] Display a button only for the post author

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

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by yosukeS 3 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1859721

Tell us what you are trying to do?

I would like to display a link button for only the post author.
I have two custom post types (public listing) and (restricted listing). I placed editing form at the bottom of the post template(elementor). I would like to place a button which will be displayed only for the post author.

Is there any documentation that you are following?

https://toolset.com/forums/topic/show-a-button-only-current-user-author/

https://toolset.com/forums/topic/hide-show-tabs-only-current-user-author/

I created view by following topic above. But the condition does't work for me. When I put conditional tag, the button disappears.
What would be possibly wrong?

Is there a similar example that we can see?

What is the link to your site?

#1860029

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting the Toolset support.

You can add the attribute debug=true to the condition to get more details about it on the frontend:

[wpv-conditional if="('[wpv-current-user]' eq '[wpv-post-author]' )" debug="true"]
Link goes here
[/wpv-conditional]

This can help finding the issue with the condition.

If you still encounter issues with it, allow me temporary access to check this closely. Let me know what view or content template you are working on it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1861747

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

You are using the conditional inside a view that queries listing and returns the first one(limit 1). As you can see in this screenshot, it returns the post with ID 17569 "A Chinese Restaurant" hidden link

The view is being used inside an Elementor single post template. A view is not intended for this use case. As you can read in our glossary, a view is meant to query and display a list of posts. While you want to display the edit link in a single post page.
https://toolset.com/glossary/view/

I would suggest using the conditional shortcodes directly inside an editor widget, check this screenshot hidden link

Or you can put the conditional shortcodes inside an unassigned content template and include it inside Elementor using a shortcode:

[wpv-post-body view_template="Name or slug of the content template"]

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153372

#1866091

With your help, I was able to fix my issue! I appreciate it so much!

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