Skip Navigation

[Resolved] "Author Page" depending on the role of the user

This support ticket is created 7 years, 5 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.

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
- 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 21 replies, has 2 voices.

Last updated by Bochnacki 7 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#540147

"However, the shortcode to insert the appropriate view does not work.
Interestingly, the Firefox page with the user view is empty, while Chrome is old, so "customer" and "dealer" have a view for "dealer"."
It's bad.

Indifferent whether I am logged in or not, whether I am logged (If I'm logged in) in as "administrator", "dealer" or "custor" - the "customer" profile page should ALWAYS display the "customer" view, and the "dealer" profile page should AWAYS display the "dealer" view. Of course I'm talking about the front-end.
Now there is nothing shown (Firefox), or the view for "dealer" (Chrome), whether it is a "customer" or "dealer" page.
hidden link - "customer" page
hidden link - "dealer" page

#540155

Minesh
Supporter

Languages: English (English )

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

I've added following code to your functions.php file to get the user-type based on author_id.

function func_get_user_type( $atts ){
	if(isset($_GET['author_id'])){
		$author_id = $_GET['author_id'];
		$x = get_user_meta($author_id,'wpcf-user-type',true);
		return $x;
	}
	
}
add_shortcode('get_user_type', 'func_get_user_type' );

Now, I've changed the conditional shortcode as given under:

[wpv-conditional if="( '[get_user_type]' eq '1' )"]
[wpv-view name="profil-customer"]
[/wpv-conditional]
[wpv-conditional if="( '[get_user_type]' eq '2' )"]
[wpv-view name="profil-dealera"]
[/wpv-conditional]

Also - I've registered the shortcode [get_user_type] at:
=> Toolsset => Settings => Frontend content => Third-party shortcode arguments

Now - when you try to load the both profile - it works fine:
=> hidden link
=> hidden link

#540167

You are great! Thanks alot! 🙂

"Now - Could you please share problem URL where above conditional shortcode not working."
As for the address - I would like in the address bar instead of "? Author_id = 123" was the nickname of the user whose profile is shown on the page.
So instead of:
hidden link
should:
hidden link

#540172

Or even better:
hidden link
But I do not know if this is possible ...

#540173

Minesh
Supporter

Languages: English (English )

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

As I fixed almost all the issues for you and your original issue is resolved.

May I kindly ask you to open a new ticket for your each new question. This will help other users searching on the forum.

Thank you for understanding and have a great day ahead.

#540191

Minesh
Supporter

Languages: English (English )

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

Also - I'm closing the day here. Please kindly open a new ticket so you will get help with your issue.

#540208

Yes, of course.
I even wondered how you wrote: "Now - Could you please share problem URL where above conditional shortcode not working."
I thought that I wanted this topic in this thread to solve.
I will create a new topic.

Thanks again for help.