I've created 2 new custom roles with Access "For Review" and "Lead Role", and I have a legacy view where I display a table of user details for these 2 roles.
I'm using this shortcode to get the user role :
[get_user_role user_id='[wpv-user field="ID"]']
I've successfully created one table that can display the user details for both these roles, but I'd like to display 2 separate tables, one that has the details of users with role For Review and one with the role Lead Role. I've tried various conditionals like these but none work:
Hello. Thank you for contacting the Toolset support.
As you are using the custom shortcode, you will have to register the custom shortcode at:
=> Toolset => Settings => Front-end Content => Third-party shortcode arguments section
There, simply add your shortcode name to the Third-party shortcode arguments section. You can register the shortcode name get_user_role
Alternatively, you can also use the [toolset_access] shortcode. For example:
[toolset_access role="for_review" operator="allow"]
// add whatever you want to display for "for_review" role
[/toolset_access]
[toolset_access role="for_review" operator="deny"]
// add whatever you want to display for "for_review" role when there is no rights
[/toolset_access]
can you please share problem URL and tell me where exactly you wnat to display what and send me admin access details and let me review what's going wrong with your setup.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
So that code allows me to use role as an attribute in the view shortcode? Just curious though why the conditionals won't work within the View? In case I need to show/hide details in one table based on their role is this not possible?
So that code allows me to use role as an attribute in the view shortcode?
==>
Yes.
Just curious though why the conditionals won't work within the View? In case I need to show/hide details in one table based on their role is this not possible?
===>
That is not the right approach, either you use the solution I shared, if you do not want to use that then you can create two views, with one view you should set to use th role "for_review" and setup the view's loop editor and create another view for the role "lead_role" and setup its view's loop editor.
I prefer the solution you shared, just curious why views has conditional options like this but they don't work:
[wpv-conditional if="( '[get_user_role]' eq 'for_review' )"]
Well - the conditional you are talking about will apply per post and you want to categoriese bulk posts belongs to role1 and role2. In your case "for_review" and "lead_role".