Based on the user role of the username that is at the end of the url for a given view. So I want the user role of the account with username lakeview when someone goes to hidden link
It is pulling that username using that filter I sent screenshot of.
And this would display publicly. This doesn't apply to being logged in.
No, I am explaining to you what I want in plain English terms instead of code terms. Ignore that that sentence was in a code block.
Basically every admin will create a unique username in wordpress. Then their specific page is rendered using the author filter and looks like something like "yoursite.com/?church=lakeview" where lakeview is the username of that account. So right now all the posts written by lakeview account show up on this page.
So what I need now is the conditional statement that would see the username in the url and figure out what user role it is assigned to. If it is an 'editor' for instance, it woulds say "this page is an editor page".
This condition would run NOT logged into the site, and the public should see it.
This is actually quite simple then simple to achieve then. You will need to write some custom code to get the role of the user that the view loop will display.
Add this custom shortcode to your Toolset custom code option in Toolset-> Settings -> Custom Code.
Please ensure that it is enabled.
Then you are going to write the name of the shortcode i.e 'wp_get_user_role' in the view 3rd party shortcode argument in Toolset -> Settings -> Frontend Content.
Finally the usage would be.
[wpv-conditional if="( '[wp_get_user_role id=' [wpv-user field='ID']']' eq 'subscriber' )"] This is a subscriber [/wpv-conditional]
Thanks for all this! I see the message when logged in but not logged out, which is the main purpose. That's what I am stuck on. Let me know what needs to be done.
When I am at, for example, hidden link and logged in, it shows me the text "This is a subscriber". When I am logged out, on same page, it shows nothing.
Yes the view is showing the 1st post to the public.
I don't know if this helps but for displaying usermeta for someones account through those author urls, I use something like this:
[wpv-conditional if="( '[types usermeta='rss-feed' user_name='[wpv-search-term param=church]' output='raw'][/types]' ne '' )"]
This is our rss feed
[/wpv-conditional]
This does work. Essentially it shows whatever this user entered in their 'rss-feed' usermeta field, and it shows it whether logged in or not. ANd it's always attached to the username at the end of the url, like hidden link
But I don't know how to make it work for something like issue I have now with matching user roles.