Skip Navigation

[Resolved] conditional output, where current user is post author

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

Problem:
The user would like to display some output when the current user is the author of the post.

Solution:
Note that the wpv-current-user short code does not accept "user_login" in info attribute. It accepts "login" instead.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views/views-shortcodes/#vf-153354

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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+00:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Lara 4 years ago.

Assisted by: Jamal.

Author
Posts
#1564995

Tell us what you are trying to do?


<!-- Conditional output for user, who is not the post author of the current post in the loop -->

[wpv-conditional if="( '[wpv-current-user info='user_login']' ne '[wpv-post-author format='meta' meta='user_login']' )"][cred-relationship-form form='relationship-form-reitanlage-benutzer' child_item='$current'][/wpv-conditional] 

<!-- Conditional output for user, who is the post author of the current post in the loop -->
  
[wpv-conditional if="( '[wpv-current-user info='user_login']' eq '[wpv-post-author format='meta' meta='user_login']' )"][cred-relationship-form form='relationship-form-reitanlage-benutzer-author' child_item='$current'][/wpv-conditional]
    

Somehow it doesn't work. I think there is a mistake in it. But I can't figure out, what's wrong.

Is there any documentation that you are following?
Yes. But I can't remember where I found it.

Is there a similar example that we can see?
See above

What is the link to your site?
hidden link

#1565301

Jamal
Supporter

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

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

Hello and thank you for contacting the Toolset support.

You will need to change "user_login" to "login" in your condition shortcode. Your code will be:

<!-- Conditional output for user, who is not the post author of the current post in the loop -->
 
[wpv-conditional if="( '[wpv-current-user info='login']' ne '[wpv-post-author format='meta' meta='user_login']' )"][cred-relationship-form form='relationship-form-reitanlage-benutzer' child_item='$current'][/wpv-conditional] 
 
<!-- Conditional output for user, who is the post author of the current post in the loop -->
   
[wpv-conditional if="( '[wpv-current-user info='login']' eq '[wpv-post-author format='meta' meta='user_login']' )"][cred-relationship-form form='relationship-form-reitanlage-benutzer-author' child_item='$current'][/wpv-conditional]
    

Check the shortcode documentation on this page for the supported attributes for the shortcode "wpv-current-user"
https://toolset.com/documentation/user-guides/views/views-shortcodes/#vf-153354

I hope this helps. Let me know if you have any doubts.

#1565361

Thanks you so much, Jamal. Now it works 🙂

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