/** * Add secondary avatar image to this activity stream's record, if supported. * * @param string $action The text of this activity * @param BP_Activity_Activity $activity Activity object * @package BuddyPress Theme * @return string * @since 1.2.6 */ function bp_dtheme_activity_secondary_avatars($action, $activity) { switch ($activity->component) { case 'groups': case 'friends': // Only insert avatar if one exists if ($secondary_avatar = bp_get_activity_secondary_avatar()) { $reverse_content = strrev($action); $position = strpos($reverse_content, 'a<'); $action = substr_replace($action, $secondary_avatar, -$position - 2, 0); } break; } return $action; }
/** * Hooks into the 'bp_get_activity_action_pre_meta' action to add secondary activity avatar support * * @since 1.2 */ function bp_tpack_activity_secondary_avatars($action, $activity) { // sanity check - some older versions of BP do not utilize secondary activity avatars if (function_exists('bp_get_activity_secondary_avatar')) { switch ($activity->component) { case 'groups': case 'friends': // Only insert avatar if one exists if ($secondary_avatar = bp_get_activity_secondary_avatar()) { $reverse_content = strrev($action); $position = strpos($reverse_content, 'a<'); $action = substr_replace($action, $secondary_avatar, -$position - 2, 0); } break; } } return $action; }
/** * Output the avatar of the object that action was performed on * * @since 1.2.0 * * @param array $args optional * * @uses bp_get_activity_secondary_avatar() */ function bp_activity_secondary_avatar($args = '') { echo bp_get_activity_secondary_avatar($args); }