Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Last active November 8, 2019 09:25
Show Gist options
  • Save raftaar1191/9fb95722f50e14cb67274166ad8393b3 to your computer and use it in GitHub Desktop.
Save raftaar1191/9fb95722f50e14cb67274166ad8393b3 to your computer and use it in GitHub Desktop.
Change his/her text in other language in BuddyBoss platform activity when someone update his/her activity
/**
* This will translate the string
*/
function child_theme_slug_setup() {
load_child_theme_textdomain( 'buddyboss-theme-child', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
/**
* Change his.her text in other language
*
* @param $action
* @param $activity
*
* @return string
*/
function bp_xprofile_format_activity_action_updated_profile_callback( $action, $activity ) {
$profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . bp_get_profile_slug() );
$text = bp_get_user_gender_pronoun_type( $activity->user_id );
if ( 'his' == $text ) {
$text = __( 'his', 'buddyboss-theme-child' );
} elseif ( 'her' == $text ) {
$text = __( 'her', 'buddyboss-theme-child' );
}
$action = sprintf( __( '%1$s updated %2$s profile', 'buddyboss' ), '<a href="' . $profile_link . '">' . bp_core_get_user_displayname( $activity->user_id ) . '</a>', $text );
return $action;
}
add_filter( 'bp_xprofile_format_activity_action_updated_profile', 'bp_xprofile_format_activity_action_updated_profile_callback', 20, 2 );
@raftaar1191
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment