/** * Template tag version of dpa_get_achievement_picture() * * @uses dpa_get_achievement_picture() * @param string $size Optional; set to "thumb" to fetch thumbnail-sized picture, and "activitystream" for a thumbnail-sized picture with width/height style tags. * @since 2.0 */ function dpa_achievement_picture($size = 'thumb') { echo dpa_get_achievement_picture($size); }
/** * Adds entries to the activity stream. * Has to be called from within the Achievement template loop. * * @global object $bp BuddyPress global settings * @param int $user_id * @param string $content The main text of the activity stream item; see dpa_format_activity() * @param int $item_id Achievement ID * @param string $component_action Optional; activity stream action name * @see dpa_format_activity * @since 2.0 */ function dpa_record_activity($user_id, $content, $item_id, $component_action = 'new_achievement') { global $bp; if (!bp_is_active('activity')) { return false; } $permalink = dpa_get_achievement_slug_permalink(); switch ($component_action) { default: case 'new_achievement': $entry = array('action' => sprintf(__('%1$s unlocked %2$s', 'dpa'), bp_core_get_userlink($user_id), '<a href="' . $permalink . '">' . dpa_get_achievement_picture('activitystream') . '</a><a href="' . $permalink . '">' . dpa_get_achievement_name() . '</a>'), 'component' => $bp->achievements->id, 'type' => $component_action, 'primary_link' => bp_core_get_user_domain($user_id), 'user_id' => $user_id, 'item_id' => $item_id); break; case 'achievement_created': $entry = array('action' => sprintf(__('%1$s created the Achievement %2$s', 'dpa'), bp_core_get_userlink($user_id), '<a href="' . $permalink . '">' . dpa_get_achievement_name() . '</a>'), 'component' => $bp->achievements->id, 'type' => $component_action, 'primary_link' => bp_core_get_user_domain($user_id), 'user_id' => $user_id, 'item_id' => $item_id); break; } return bp_activity_add(apply_filters('dpa_record_activity', $entry, $user_id, $content, $item_id, $component_action)); }