Skip Navigation

[Resolved] Show text to specific user and admin

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

Problem:

I tried the solution proposed in the ticket above but unfortunately it didn't work. When I applied it the text didn't show at all to any role/user. I have included the code that I added below would it be possible to take a quick look and confirm what i'm doing wrong! Just

Solution:

There is a missing "(" in your codes, please replace it with below, and test again:

https://toolset.com/forums/topic/show-text-to-specific-user-and-admin/#post-1809927

Relevant Documentation:

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

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by stewartE 4 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1808601
cond.png

https://toolset.com/forums/topic/show-text-to-specific-user/

Apologies for the delay in response. I tried the solution proposed in the ticket above but unfortunately it didn't work. When I applied it the text didn't show at all to any role/user. I have included the code that I added below would it be possible to take a quick look and confirm what i'm doing wrong! Just to recap I am trying to wrap a piece of text in conditional code so that it is only visible to one specific user plus admin and editors should also be able to see it. Thanks!

<wpv-loop>

  • [wpv-post-body view_template="loop-item-in-td-quick-links"]
  • </wpv-loop>

    <!-- wpv-loop-end -->
    [wpv-conditional if="( '[wpv-current-user info="login"]' eq 'example@example.com' ) OR ( '[wpv-current-user info="role"]' eq 'editor' ) OR ( '[wpv-current-user info="role"]' eq 'administrator' ) )"]TEXT HERE[/wpv-conditional]

    [/wpv-items-found]
    [wpv-no-items-found]
    [wpml-string context="wpv-views"]No items found[/wpml-string]
    [/wpv-no-items-found]
    [wpv-layout-end]

    #1809927

    Hello,

    Thanks for the details, there is a missing "(" in your codes, please replace it with below, and test again:

    [wpv-conditional if="( ( '[wpv-current-user info="login"]' eq 'example@example.com' ) OR ( '[wpv-current-user info="role"]' eq 'editor' ) OR ( '[wpv-current-user info="role"]' eq 'administrator' ) )"]
    TEXT HERE
    [/wpv-conditional]
    
    #1810161

    My issue is resolved now. Thank you!