Skip to content

Instantly share code, notes, and snippets.

@imanispatel
Last active August 24, 2020 10:42
Show Gist options
  • Save imanispatel/c884ac04500708d29bbe43297ffa9c28 to your computer and use it in GitHub Desktop.
Save imanispatel/c884ac04500708d29bbe43297ffa9c28 to your computer and use it in GitHub Desktop.
Change my and friends profile data example: change profile image
<?php
/**
* Update my profile data before get BUC chat
*
* @param array $profile Get my profile data.
* @return array
*/
function buc_update_my_profile_data( $profile ) {
// If set custom profile image.
$custom_image = 'http://demo.wpvenus.com/bp-better-user-chat/wp-content/uploads/2020/06/Venus.png'; // Custom image url.
$profile['avatar_url'] = $custom_image;
return $profile;
}
add_filter( 'buc_before_get_my_profile', 'buc_update_my_profile_data', 10, 1 );
/**
* Update friends profile data before get BUC chat
*
* @param array $profile Get friends profile data.
* @return array
*/
function buc_update_friend_profile_data( $profile ) {
// If set custom profile image.
$custom_image = 'http://demo.wpvenus.com/bp-better-user-chat/wp-content/uploads/2020/06/Venus.png'; // Custom image url.
$profile['avatar_url'] = $custom_image;
return $profile;
}
add_filter( 'buc_before_get_friends_profile', 'buc_update_friend_profile_data', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment