Forum Replies Created
-
Thanks Henry, from the code you gave me, i was able to put this one together to display a link to a page of the authors posts with this line of code and it works perfect.
<a href="<?php echo esc_url( get_author_posts_url( bp_displayed_user_id() ) ); ?>" rel="author">Read all posts by <?php echo bp_displayed_user_fullname(); ?></a>
Thanks for the response, I really just need it to detect the author of the profile the link is going to be on since the site will have many authors. Iv tried a few different ways of getting the authors ID out of the loop but nothing Iv tried has worked besides the code i showed in the original post.
Iv used this which works in the Author Bio on each post.
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author"> <?php printf( __( 'View all posts by %s <span class="meta-nav"></span>', TEMPLATE_DOMAIN ), get_the_author() ); ?></a>
@henrywright-1 You were able to give me some help before on something similar, Would you be able to help me with the issue in this post?
Thank you very much for your help.. that worked perfect.
I have already tried that. Its turns into a link, but that does not make it go to the authors profile page.
Im not trying to make it go to a specific profile. When it is clicked i need it to go to profile belonging to the the persons avatar.
I tried to use your code and while just using
define(“BP_DEFAULT_COMPONENT”,”profile”);
using
if ( bp_loggedin_user_id() == bp_displayed_user_id() ) { define(“BP_DEFAULT_COMPONENT”,”profile”); }
returns an error
Fatal error: Call to undefined function bp_loggedin_user_id()Could you help me with this?
Thanks
I think i spoke to soon about that working. In the front end the link looks good, but i had my own twitter account in place and so it looked like Twitter:(with my twitter name) when i would click that and thought it worked because i was already signed in.
Once i place a new twitter name in the profile, the front end looks right, “Twitter: chevrolet” just pulled one out of a hat, or any other twitter account, it goes right to my own profile or to twitter home page if not signed in.
So messing about i cam up with this ugly but working solution based on what was posted here.
it now bring the name in from the xprofile field into the url. Before it was grabbing a field from the wordpress profile.<?php if ( $string = xprofile_get_field_data( 'Twitter', get_the_author_meta('ID') ) ) { ?> <a href="https://twitter.com/<?php if ($string =xprofile_get_field_data( 'Twitter', get_the_author_meta('ID') ) ) { echo $string;} ?>" target="_blank">Twitter: <?php echo $string; ?></a> <?php } ?>
Much thanks to you @bphelp. That bit of code worked like clockwork. Yeah, i see the issue with having the wrong name in the field, but i will have instruction to double check and hopefully the authors will take note.
Thanks for your reply @bphelp I tried both codes and the second works to a point at where i need to be.
The thing im trying to do is call the xprofile field which would be where the author would place their twitter, google+ or facebook id and show it as a link.
The second code you gave me give the result Twitter:(and the user name i placed in the xprofile field) and as you would know takes me to twitter but not to the profile.
Is there a way that you know that would replace “username” with that actual username?
much thanks.
I really appreciate your help. Thats the first bit of code that has worked to display the xprofile fields and iv tried allot.
Im not sure if you could help me with this one aspect. I would like to also call something like google+, twitter or facebook links that I created in the xprofile fields.
I can call those fields with the code posted here, but im wondering if @henrywright-1 or anybody stopping by this post could help with the code needed to make the called data as a link with alt text so it looks like Twitter, Google +, Facebook.
Thanks for any help or pointers
Thanks.. the second code you gave me works perfect.
Is the information for the bio going to come from one of my extended profiles i made when I replaced the field name in your code or is the info coming from the default wordpress bio section?
Thanks. I tried to put that code multiple places in my themes single.php and even the default buddypress theme trying all my field names with no results.