Skip Navigation

[Resolved] condition for author page

This support ticket is created 5 years, 9 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1242906
freelance role.png
employer role.png

I created an author page to display author information and follow https://toolset.com/forums/topic/author-page-single/ which can display the information.

But I want to set conditions for users 'freelance role' and 'employer role' because the information is on the same page.
And other conditions, such as if no information is not shown. I try using the conditions

{!{wpv-conditional if="('{!{types usermeta='phone-freelance' user_is_author='true' user_id='[get_author_id_in_archive]'}!}{!{/types}!}' ne '')"}!} Show infomation {!{/wpv-conditional}!}

but not working.

Is there a way that can be possible?

hidden link >>> This is author page. (administrator role but same freelance role)

#1243018

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - You can identify the current role by two ways.

First option:
- you can use [toolset_access] (needs Toolset Access plugin installed and activated) shortcode.
For example:

[toolset_access role="customer" operator="allow"]
    display view for customer
[/toolset_access]
 
[toolset_access role="dealer" operator="allow"]
    display view for dealer
[/toolset_access]

- Please replace your role slug with role argument

Second option:
- You can use View's [wpv-current-user] shortcode to get current logged in user information:
More info:
https://toolset.com/documentation/views-shortcodes/#wpv-current-user

Now, if you want to get the current user role, you should use the following code:

[wpv-current-user info="role"]

As you want to display custom fields based on a specific role, you can use [wpv-confitional] shortcode.

For example - to check 'customer" role:

[wpv–conditional if="( '[wpv-current-user info='role']' eq 'customer' )"]
  
Display your custom fields for customer role
  
[/wpv–conditional]

More info:
https://toolset.com/documentation/views-shortcodes/#wpv-conditional
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/