Last active
November 8, 2019 09:25
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference Link: https://localise.biz/wordpress/plugin/beginners