I managed to show up the users Profile Images from the mainsite xxxxx.com/ in my bbpress forum xxxxx.com/forum/ with the following code:
<?php $user_info = get_user_by('id', $wp_query->query_vars['author']); echo get_avatar($user_info->ID, '150'); ?>
Question:
How can i get the Users Profile URL/LINK like xxxxxx.com/user/username with the same method?
Thank you so much!
get_edit_profile_url( int $user_id, string $scheme = 'admin' ): string. Retrieves the URL to the user's profile editor.
At the top right of the User Table is a search box to help find users. Enter a string in the box and click the “Search users” box. Any User that contains the search string in the Username, Name, E-mail, or Website fields will be displayed, by Role. You can then add, change, and delete those users.
All you have to do is add this code to your theme's single. php file. <? php global $current_user; get_currentuserinfo(); $user_id = $current_user->ID; // You can set $user_id to any users, but this gets the current users ID.
Profile Links are links to websites that appear on your WordPress.com profile. In the Profile Links section, click the + Add button to add a new site to your profile. You can remove any sites by clicking the X next to it: ↑ Table of Contents ↑
To get user's profile link like xxxxxx.com/author/username/ use the following function:
<?php get_author_posts_url( $author_id, $author_nicename ); ?>
Here is the documentation.
If you want to edit a user from admin side then you can use this:
function get_admin_edit_user_link( $user_id ){
if ( get_current_user_id() == $user_id )
$edit_link = get_edit_profile_url( $user_id );
else
$edit_link = add_query_arg( 'user_id', $user_id, self_admin_url( 'user-edit.php'));
return $edit_link;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With