Tell us what you are trying to do?
I would like the current logged in user to have a link to VIEW their profile from the account page.
Successfully, I created the EDIT Profile page and link but having a lot of trouble to insert the VIEW link.
Their Profile View page is actually the WP Author Archive.
My code looks like this:
<p>hidden link ">EDIT PROFILE <br /> (GOOD)
VIEW PROFILE <br /> (WRONG)
[wpv-logout-link class="fa fa-unlock-alt"] Log Out[/wpv-logout-link]</p> (GOOD)
Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-author
Is there a similar example that we can see?
Just like facebook users can edit and view their profiles.
What is the link to your site?
hidden link
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
As I understand - you want to display author archive page when user click on "VIEW PROFILE"?
Do you have your author archive link with you?
Thank you for your reply Minesh.
Yes, you understand correct but the link would change based on the Current Logged in User.
Here's an example of one url:
hidden link
So –
If User A is logged in an clicks on "View Profile"
This would be the URL:
hidden link
If User B is logged in an clicks on "View Profile"
This would be the URL:
hidden link
If User C is logged in an clicks on "View Profile"
This would be the URL:
hidden link
etc, etc...
Makes sense right?
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Well - what if you try to use following code:
<a href="[wpv-post-author format="url"]">VIEW PROFILE</a>
Thank you so much for proving the code Minesh.
It wouldn't work though because it links to the Profile of the Author of that page, which is the admin.
This bellow:
<a href="[wpv-post-author format="url"]">VIEW PROFILE</a>
Keeps on linking to the same URL:
hidden link
(which is wrong)
What I need it to do is link to Current Logged in user's Profile (WP Author Archive)
Just like I explain below –
If User A is logged in, and clicks on "VIEW PROFILE"
The URL link would be:
hidden link ;
If User B is logged in, and clicks on "VIEW PROFILE"
The URL link would be:
hidden link ;
If User C is logged in, and clicks on "VIEW PROFILE"
The URL link would be:
hidden link ;
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Ok - I got it.
What if you try to use following code:
- Add following code to your current theme's functions.php file.
function func_get_author_url( $atts ) {
global $current_user;
get_currentuserinfo();
$author_url = get_author_posts_url( $current_user->ID);
return $author_url;
}
add_shortcode( 'get_author_url', 'func_get_author_url' );
Try to use the shortcode like this:
<a href="[get_author_url]">VIEW PROFILE</a>
Thank you very much Minesh.
The code you provided really worked!
I had assumed this function was already a part of the ToolSet.
(Maybe that would be a good feature for the future.
Editing and Viewing Profiles with ToolSet.)
Thanks again!