Forum Replies Created
-
// the problem with your code:
$bp->bp_like->slug = ‘bp_like’;
——————————————————
function bp_like_setup_globals() {
global $bp, $current_blog;
$bp->bp_like=new stdClass();
$bp->bp_like->id = ‘bp-like’;
$bp->bp_like->slug = ‘bp_like’;
$bp->bp_like->notification_callback = ‘bp_like_format_notifications’;
$bp->active_components[$bp->bp_like->slug] = $bp->bp_like->id;
do_action( ‘bp_like_setup_globals’ );
}
add_action( ‘bp_setup_globals’, ‘bp_like_setup_globals’ );function bp_like_format_notifications( $action, $item_id, $secondary_item_id, $total_items,$format=’string’) {
global $bp;
$glue=”;
$user_names=array();
$activity = new BP_Activity_Activity( $activity_id );
$link=ac_notifier_activity_get_permalink2( $activity_id );//si c’est le posteur d’origine, dites que vous êtes, d’autre dire de% s après
if($activity->user_id==$bp->loggedin_user->id){
$text=__(“your”);
$also=””;
}
else{
$text=sprintf(__(“%s’s”), bp_core_get_user_displayname ($activity->user_id));//quelqu’un
$also=” also”;
}
$ac_action=’new_bp_like_’.$item_id;if($action==$ac_action){
//if ( (int)$total_items > 1 ) {
// $users=ac_notifier_find_involved_persons($activity_id);
$total_user= $count=count($users);//montrent de nombreux utilisateurs uniques ont commenté
if($count>2){
$users=array_slice($users, $count-2);//simplement indiquer le nom de deux affiches, le repos doit être aussi et ‘n’ autre a également commenté
$count=$count-2;
$glue=”, “;
}
else if($total_user==2)
$glue=” xxxxxxxxx “;//si il ya 2 utilisateurs uniques, disons x et y commentéforeach((array)$users as $user_id)
$user_names[]=bp_core_get_user_displayname ($user_id);if(!empty($user_names))
$commenting_users=join ($glue, $user_names);if($total_user>2)
$text=$commenting_users.” xxxxxxxxxxxxxxxx “.$count.” xxxxxxxxx”.$also.” xxxxxxxxxxxxxxxx on “.$text. ” post”;//peut-on changer la poste à quelque chose de significatif en fonction de l’élément d’activité?
else
$text=$commenting_users.$also .” xxxxxxxxxxxx on “.$text. ” post”;if($format==’string’)
return apply_filters( ‘bp_activity_multiple_new_likes_notification’, ‘‘ . $text . ‘‘);
else{
return array(‘link’=>$link,
‘text’=>$text);
}
return false;
}}