Changing avatar images and profile links
-
Wordpress: 4.3.1
BP: 2.4.0Hi, I have a slightly unusual setup that I’m trying to get working.
I run a site for kids and as such I have created profile images that they can choose from which are stored as user-meta in wp. I also have my own user profiles basaed on the wp author.php located at /profiles/(nickname). I want to integrate buddypress in to my site as it uses Learndash and this integrates with bp to give an activity feed to the LMS.
So the two things I would like to achieve are to change the user profile links on bp features such as the activity feed and online members widget etc from the buddypress profiles to links to my profiles at /profiles/. Secondly I need to change the avatar images that come up in activity feed and member widges from the buddypress ones to my custom meta.
I’ve been working away on this all day and can’t quite get it. I’ve placed teh following code in my bp-custom.php and had some success but it is not yet working. If someone could take a look and help me out or point me in the right direction i’d really appreciate it!
Here is the first code to try and get the profile links to redirect:
function _bp_core_get_user_domain($domain) { $url = get_home_url(); $user_id = bp_get_member_user_id(); $link = bp_core_get_username( $user_id ); $domain = '' . $url . '/profiles/' . $link . ''; return $domain; } add_filter('bp_core_get_user_domain', '_bp_core_get_user_domain', 10, 4);
And here is the second to try and change the profile pics:
function my_default_avatar_url() { $url = get_site_url(); $user_id = bp_get_member_user_id(); $profile_image = get_the_author_meta( my_avatar, $user_id ); if (empty($profile_image)) { $profile_image = '' . $url . '/wp-content/uploads/avatars/avatar.png'; } $image = '<img src="' . $profile_image . '" width="50px" height="50px" />'; return $image; } add_filter( 'bp_core_default_avatar_user', 'my_default_avatar_url' ); add_filter( 'bp_core_fetch_avatar', 'my_default_avatar_url');
Thanks!
- The topic ‘Changing avatar images and profile links’ is closed to new replies.