/** * Return the timestamp of the current notification. * * @since BuddyPress (1.9.0) * * @return string Timestamp of the current notification. */ function bp_get_the_notification_time_since() { // Get the notified date $date_notified = bp_get_the_notification_date_notified(); // Notified date has legitimate data if ('0000-00-00 00:00:00' !== $date_notified) { $retval = bp_core_time_since($date_notified); // Notified date is empty, so return a fun string } else { $retval = __('Date not found', 'buddypress'); } /** * Filters the time since value of the current notification. * * @since BuddyPress (1.9.0) * * @param string $retval Time since value for current notification. */ return apply_filters('bp_get_the_notification_time_since', $retval); }
/** * @group bp_get_blog_last_active */ public function test_bp_get_blog_last_active_active_format_false() { // Fake the global global $blogs_template; $time = date('Y-m-d h:i:s', time() - 24 * 60 * 60); $blogs_template = new stdClass(); $blogs_template->blog = new stdClass(); $blogs_template->blog->last_activity = $time; $this->assertEquals(bp_core_time_since($time), bp_get_blog_last_active(array('active_format' => false))); $blogs_template->blog = null; }
/** * Returns a Human-readable representation of when this Achievement was unlocked, i.e. "four days ago" * * @since 2.0 * @global DPA_Achievement_Template $achievements_template Achievements template tag object * @return string */ function dpa_get_achievement_unlocked_ago() { global $achievements_template; return apply_filters('dpa_get_achievement_unlocked_date', sprintf(__(' %s ago', 'dpa'), bp_core_time_since($achievements_template->achievement->achieved_at))); }
function bp_group_request_time_since_requested() { global $requests_template; echo apply_filters('bp_group_request_time_since_requested', sprintf(__('requested %s', 'buddypress'), bp_core_time_since(strtotime($requests_template->request->date_modified)))); }
/** * @since 1.0.0 */ function bp_group_request_time_since_requested() { global $requests_template; /** * Filters the formatted time since membership was requested. * * @since 1.0.0 * * @param string $value Formatted time since membership was requested. */ echo apply_filters('bp_group_request_time_since_requested', sprintf(__('requested %s', 'buddypress'), bp_core_time_since(strtotime($requests_template->request->date_modified)))); }
function build_html() { // Store everything in an output buffer ob_start(); ?> <div class="widget showcase-widget"> <header class="widget-header"> <h3 class="widget-title">Recent Discussion</h3> </header> <ul class="recent-discussion-list"> <?php // Iterate topics while (bp_activities()) { bp_the_activity(); // Get the activity user $user = new Apoc_User(bp_get_activity_user_id(), 'directory', 40); // Get the activity type $type = bp_get_activity_type(); // Format activity based on context switch ($type) { case 'bbp_topic_create': $topic_id = bp_get_activity_item_id(); $link = '<a href="' . bbp_get_topic_permalink($topic_id) . '" title="Read topic" target="_blank">' . bbp_get_topic_title($topic_id) . '</a>'; $verb = 'created topic'; break; case 'bbp_reply_create': $reply_id = bp_get_activity_secondary_item_id(); $link = '<a href="' . bbp_get_topic_last_reply_url($reply_id) . '" title="Read reply" target="_blank">' . bbp_get_topic_title($reply_id) . '</a>'; $verb = 'replied to'; break; case 'new_blog_comment': $comment_id = bp_get_activity_secondary_item_id(); $comment = get_comment($comment_id); $link = '<a href="' . get_comment_link($comment_id) . '" title="Read reply" target="_blank">' . get_the_title($comment->comment_post_ID) . '</a>'; $verb = 'commented on'; break; } // Get the activity time $time = bp_core_time_since(bp_get_activity_date_recorded()); // Output the HTML ?> <li class="recent-discussion double-border"> <?php echo $user->avatar; ?> <div class="recent-discussion-content"> <span class="recent-discussion-title"><?php echo $user->link . ' ' . $verb . ' ' . $link; ?> </span> <span class="recent-discussion-time"><?php echo $time; ?> </div> </li> <?php } ?> </ul> </div><?php // Get the contents of the buffer $html = ob_get_contents(); ob_end_clean(); // Return the html to the class return $html; }
/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_dtheme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if ($result) { ?> <div class="message-box new-message"> <div class="message-metadata"> <?php do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'logicalboneshug'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php do_action('bp_after_message_meta'); ?> </div> <?php do_action('bp_before_message_content'); ?> <div class="message-content"> <?php echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content'])); ?> </div> <?php do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'logicalboneshug') . '</p></div>'; } exit; }
function gtags_activity_for_item($args) { global $wpdb, $bp; ob_start(); $defaults = array('group_ids' => '', 'scope' => '', 'show' => 4, 'show_more' => 8, 'truncate' => 190); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if ($scope == 'my' && is_user_logged_in()) { $my_groups = BP_Groups_Member::get_group_ids($bp->loggedin_user->id); $group_ids = array_intersect($group_ids, $my_groups['groups']); $show_hidden = true; } if (empty($group_ids)) { echo '<div class="recent recent-none-found">' . __('Sorry no groups were found.', 'gtags') . '</div>'; return; } ?> <div class="recent"><?php // generate source group links foreach ($group_ids as $group_id) { $group = groups_get_group(array('group_id' => $group_id)); $avatar = bp_core_fetch_avatar('object=group&type=thumb&width=50&height=50&item_id=' . $group->id); $group_output .= $sep . '<a href="' . bp_get_group_permalink($group) . '" class="recent-group-avatar">' . $avatar . ' ' . $group->name . '</a>'; $sep = ', '; //compile group data to be used in loop below $the_groups[$group->id] = array('permalink' => bp_get_group_permalink($group), 'name' => bp_get_group_name($group), 'avatar' => $avatar); } ?> <div class="gtags-recent-groups"> <?php _e('Recent Activity From', 'gtags'); ?> <a href="#" class="gtags-more-groups"><?php _e('these groups +', 'gtags'); ?> </a> <div class="gtags-recent-groups-list"><?php echo $group_output; ?> </div> </div> <?php // fetch a whole bunch of activity so we can sort them by date below, otherwise they are sorted by group $filter = array('user_id' => false, 'object' => 'groups', 'action' => false, 'primary_id' => implode(',', (array) $group_ids)); $activity = bp_activity_get(array('max' => 1000, 'per_page' => 1000, 'filter' => $filter, 'show_hidden' => $show_hidden)); //$type_skip = apply_filters( 'gtags_type_skip', array( 'joined_group' ) ); // array of activity types to skip // generate a cleaned array of content foreach ($activity['activities'] as $item) { if (in_array($item->type, (array) $type_skip)) { continue; } $action = preg_replace('/:$/', '', $item->action); // remove trailing colon in activity $action = apply_filters('gtags_action', $action); $content = strip_tags(stripslashes($item->content)); if ($truncate && strlen($content) > $truncate) { $content = substr($content, 0, $truncate) . '... '; } if ($content) { $content .= ' <a href="' . $item->primary_link . '">view</a>'; } $activity_list[$item->date_recorded] = array('action' => $action, 'group_id' => $item->item_id, 'content' => $content, 'primary_link' => $item->primary_link, 'user_id' => $item->user_id); } if (empty($activity_list)) { echo __("Sorry, there was no activity found.", 'gtags'); echo "</div>"; //close the div return; } // sort them by date (regardless of group) ksort($activity_list); $activity_list = array_reverse($activity_list); // output pretty html for recent activity for groups foreach ((array) $activity_list as $date => $item) { $i++; $group_id = $item['group_id']; $action = $item['action']; // show only a certain amount, after that make a 'show more' link and show the rest in a hidden div if ($i == $show + 1 && $show_more) { ?> <a href="#" class="gtags-more-activity"><?php _e('show more +', 'gtags'); ?> </a> <div class="gtags-more-content"><?php $more_link = true; } if ($i > $show + $show_more + 1) { break; } // for repeating group content, remove group link and shrink group avatar if ($prev_group_id == $group_id) { $action = preg_replace('/ in the group(.*)$/i', '', $action); $dup_class = ' duplicate-group'; } else { $dup_class = ''; } $prev_group_id = $group_id; // group avatar echo '<a href="' . $the_groups[$group_id]['permalink'] . '" title="' . $the_groups[$group_id]['name'] . '" class="gtags-item-group-avatar' . $dup_class . '">' . $the_groups[$group_id]['avatar'] . '</a>'; // the actual content ?> <div class="gtags-item-recent group"> <div class="gtags-item-avatar"> <a href="<?php echo bp_core_get_user_domain($item['user_id']); ?> "> <?php echo bp_core_fetch_avatar('object=user&type=full&width=50&height=50&item_id=' . $item['user_id']); ?> </a> </div> <div class="gtags-item-action"> <?php echo $action; ?> <span class="gtags-time-ago"><?php echo bp_core_time_since($date); ?> <?php _e('ago', 'gtags'); ?> </span> </div> <div class="gtags-item-content"> <?php echo convert_smilies($item['content']); ?> </div> </div><?php } if ($more_link) { echo '<div class="gtags-recent-groups"> ' . __('Continue reading in:', 'gtags') . ' ' . $group_output . '</div>'; echo '</div>'; // close the more div } ?> </div><?php // end recent return ob_get_clean(); }
<h5 class="title"> <?php __('Friend resquest', 'dln-theme-hc'); ?> </h5> <ul class="dropdown-list user-list"> <?php if ($notifications['friends']['nof_arr']) { ?> <?php foreach ($notifications['friends']['nof_arr'] as $nof) { if ($nof) { $user = get_userdata($nof->item_id); $link = bp_core_get_user_domain($nof->item_id); $avatar = get_avatar($nof->item_id, '36', '', $user->display_name); $since_time = bp_core_time_since($nof->date_notified); ?> <li class="new"> <div class="thumb"> <a href="<?php echo $link; ?> "><?php echo $avatar; ?> </a> </div> <div class="desc"> <h5> <a href="<?php echo $link;
/** * History meta box for the Activity admin edit screen * * @param object $item Activity item * @since BuddyPress (1.6) * @todo Update activity meta to allow >1 record with the same key (iterate through $history). * @see http://buddypress.trac.wordpress.org/ticket/3907 */ function history_metabox($item) { $history = BP_Akismet::get_activity_history($item->id); if (empty($history)) { return; } echo '<div class="akismet-history"><div>'; printf(_x('<span>%1$s</span> — %2$s', 'x hours ago - akismet cleared this item', 'buddypress'), bp_core_time_since($history[2]), esc_html($history[1])); echo '</div></div>'; }
public function manage_users_custom_column($empty, $column_name, $user_id) { if ('timestamps' != $column_name) { return $empty; } global $gMemberNetwork; $html = ''; $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode']; $user = get_user_by('id', $user_id); $lastlogin = get_user_meta($user_id, $this->constants['meta_lastlogin'], TRUE); $register_ip = get_user_meta($user_id, $this->constants['meta_register_ip'], TRUE); $registered = strtotime(get_date_from_gmt($user->user_registered)); $lastlogged = $lastlogin ? strtotime(get_date_from_gmt($lastlogin)) : NULL; $html .= '<table></tbody>'; $html .= '<tr><td>' . __('Registered', GMEMBER_TEXTDOMAIN) . '</td><td><code title="' . $gMemberNetwork->getDate($registered, 'timeampm') . '">' . $gMemberNetwork->getDate($registered) . '</code></td></tr>'; $html .= '<tr><td>' . __('Last Login', GMEMBER_TEXTDOMAIN) . '</td><td>' . ($lastlogin ? '<code title="' . $gMemberNetwork->getDate($lastlogged, 'timeampm') . '">' . $gMemberNetwork->getDate($lastlogged) . '</code>' : '<code>' . __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>'; if (function_exists('bp_get_user_last_activity')) { if ($lastactivity = bp_get_user_last_activity($user_id)) { $lastactive = strtotime(get_date_from_gmt($lastactivity)); } $html .= '<tr><td>' . __('Last Activity', GMEMBER_TEXTDOMAIN) . '</td><td>' . ($lastactivity ? '<code title="' . bp_core_time_since($lastactivity) . '">' . $gMemberNetwork->getDate($lastactive) : '<code>' . __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>'; } $html .= '<tr><td>' . __('Register IP', GMEMBER_TEXTDOMAIN) . '</td><td><code>' . ($register_ip ? $gMemberNetwork->getIPLookup($register_ip) : __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>'; $html .= '</tbody></table>'; echo $html; }
function bp_get_the_thread_message_time_since() { global $thread_template; return apply_filters('bp_get_the_thread_message_time_since', sprintf(__('Sent %s', 'buddypress'), bp_core_time_since(strtotime($thread_template->message->date_sent)))); }
/** * Gets the date_recorded for the activity comment currently being displayed * * @since 1.5.0 * * @global object $activities_template {@link BP_Activity_Template} * @uses bp_core_time_since() * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook * * @return string|bool $date_recorded Time since the activity was recorded, of the form "%s ago". False on failure */ function bp_get_activity_comment_date_recorded() { global $activities_template; if (empty($activities_template->activity->current_comment->date_recorded)) { return false; } $date_recorded = bp_core_time_since($activities_template->activity->current_comment->date_recorded); return apply_filters('bp_activity_comment_date_recorded', $date_recorded); }
function dwqa_replace_activity_meta() { global $activities_template; $blog_url = bp_blogs_get_blogmeta($activity->item_id, 'url'); $blog_name = bp_blogs_get_blogmeta($activity->item_id, 'name'); if (empty($blog_url) || empty($blog_name)) { $blog_url = get_home_url($activity->item_id); $blog_name = get_blog_option($activity->item_id, 'blogname'); bp_blogs_update_blogmeta($activity->item_id, 'url', $blog_url); bp_blogs_update_blogmeta($activity->item_id, 'name', $blog_name); } $post_url = add_query_arg('p', $activities_template->activity->secondary_item_id, trailingslashit($blog_url)); $post_title = bp_activity_get_meta($activities_template->activity->id, 'post_title'); if (empty($post_title)) { $post = get_post($activities_template->activity->secondary_item_id); if (is_a($post, 'WP_Post')) { $post_title = $post->post_title; bp_activity_update_meta($activities_template->activity->id, 'post_title', $post_title); } } $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>'; $user_link = bp_core_get_userlink($activities_template->activity->user_id); if ($activities_template->activity->type == 'new_question') { $action = sprintf(__('%1$s asked a new question: %2$s', 'dwqa'), $user_link, $post_link); } elseif ($activities_template->activity->type == 'new_answer') { $action = sprintf(__('%1$s answered the question: %2$s', 'dwqa'), $user_link, $post_link); } elseif ($activities_template->activity->type == 'comment_question') { $action = sprintf(__('%1$s commented on the question: %2$s', 'dwqa'), $user_link, $post_link); } elseif ($activities_template->activity->type == 'comment_answer') { $action = sprintf(__('%1$s commented on the answer at: %2$s', 'dwqa'), $user_link, $post_link); } else { $action = $activities_template->activity->action; } // Strip any legacy time since placeholders from BP 1.0-1.1 $content = str_replace('<span class="time-since">%s</span>', '', $content); // Insert the time since. $time_since = apply_filters_ref_array('bp_activity_time_since', array('<span class="time-since">' . bp_core_time_since($activities_template->activity->date_recorded) . '</span>', &$activities_template->activity)); // Insert the permalink if (!bp_is_single_activity()) { $content = apply_filters_ref_array('bp_activity_permalink', array(sprintf('%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity), esc_attr__('View Discussion', 'buddypress'), $time_since), &$activities_template->activity)); } else { $content .= str_pad($time_since, strlen($time_since) + 2, ' ', STR_PAD_BOTH); } echo $action . ' ' . $content; // echo 'abc'; // echo $activities_template->activity->content; }
/** * Return the date of the Rendez Vous. * * @since Rendez Vous (1.0.0) */ function rendez_vous_get_last_modified() { $last_modified = bp_core_time_since(rendez_vous()->query_loop->rendez_vous->post_modified_gmt); return apply_filters('rendez_vous_get_last_modified', sprintf(__('Modified %s', 'rendez-vous'), $last_modified)); }
/** * Generate the 'Sent x hours ago' string for the current message. * * @since 1.1.0 * * @return string */ function bp_get_the_thread_message_time_since() { /** * Filters the 'Sent x hours ago' string for the current message. * * @since 1.1.0 * * @param string $value Default text of 'Sent x hours ago'. */ return apply_filters('bp_get_the_thread_message_time_since', sprintf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_get_the_thread_message_date_sent()))); }
/** * Format last activity string based on time since date given. * * @uses bp_core_time_since() This function will return an English * representation of the time elapsed. * * @param int|string $last_activity_date The date of last activity. * @param string $string A sprintf()-able statement of the form '% ago'. * @return string $last_active A string of the form '3 years ago'. */ function bp_core_get_last_activity($last_activity_date, $string) { if (empty($last_activity_date)) { $last_active = __('Not recently active', 'buddypress'); } else { $last_active = sprintf($string, bp_core_time_since($last_activity_date)); } return apply_filters('bp_core_get_last_activity', $last_active, $last_activity_date, $string); }
/** * Return a formatted string displaying when a profile was last updated. * * @since 1.0.0 * * @return bool|mixed|void */ function bp_get_profile_last_updated() { $last_updated = bp_get_user_meta(bp_displayed_user_id(), 'profile_last_updated', true); if (!empty($last_updated)) { /** * Filters the formatted string used to display when a profile was last updated. * * @since 1.0.0 * * @param string $value Formatted last updated indicator string. */ return apply_filters('bp_get_profile_last_updated', sprintf(__('Profile updated %s', 'buddypress'), bp_core_time_since(strtotime($last_updated)))); } return false; }
function bp_get_link_time_since_created($link = false) { global $links_template; if (!$link) { $link =& $links_template->link; } return apply_filters('bp_get_link_time_since_created', bp_core_time_since($link->date_created)); }
/** * Return a 'since' string describing when the current post in the loop was posted. * * @see bp_core_time_since() for a description of return value. * * @return string */ function bp_get_the_topic_post_time_since() { global $topic_template; /** * Filters the 'since' string describing when the current post in the loop was posted. * * @since BuddyPress (1.0.0) * * @param string $value The 'since' string. */ return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) ); }
/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => (int) $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if (!empty($result)) { // pretend we're in the message loop global $thread_template; bp_thread_has_messages(array('thread_id' => (int) $_REQUEST['thread_id'])); // set the current message to the 2nd last $thread_template->message = end($thread_template->thread->messages); $thread_template->message = prev($thread_template->thread->messages); // set current message to current key $thread_template->current_message = key($thread_template->thread->messages); // now manually iterate message like we're in the loop bp_thread_the_message(); // manually call oEmbed // this is needed because we're not at the beginning of the loop bp_messages_embed(); ?> <div class="message-box new-message <?php bp_the_thread_message_css_class(); ?> "> <div class="message-metadata"> <?php /** * Fires before the single message header is displayed. * * @since BuddyPress (1.1.0) */ do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php /** * Fires after the single message header is displayed. * * @since BuddyPress (1.1.0) */ do_action('bp_after_message_meta'); ?> </div> <?php /** * Fires before the message content for a private message. * * @since BuddyPress (1.1.0) */ do_action('bp_before_message_content'); ?> <div class="message-content"> <?php bp_the_thread_message_content(); ?> </div> <?php /** * Fires after the message content for a private message. * * @since BuddyPress (1.1.0) */ do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php // clean up the loop bp_thread_messages(); } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'buddypress') . '</p></div>'; } exit; }
function bp_get_profile_last_updated() { global $bp; $last_updated = bp_get_user_meta(bp_displayed_user_id(), 'profile_last_updated', true); if ($last_updated) { return apply_filters('bp_get_profile_last_updated', sprintf(__('Profile updated %s', 'buddypress'), bp_core_time_since(strtotime($last_updated)))); } return false; }
/** * Format last activity string based on time since date given. * * @uses bp_core_time_since() This function will return an English * representation of the time elapsed. * * @param int|string $last_activity_date The date of last activity. * @param string $string A sprintf()-able statement of the form 'active %s' * @return string $last_active A string of the form '3 years ago'. */ function bp_core_get_last_activity($last_activity_date = '', $string = '') { // Setup a default string if none was passed $string = empty($string) ? '%s' : $string; // Use the string if a last activity date was passed $last_active = empty($last_activity_date) ? __('Not recently active', 'buddypress') : sprintf($string, bp_core_time_since($last_activity_date)); // Filter and return return apply_filters('bp_core_get_last_activity', $last_active, $last_activity_date, $string); }
/** * Return the last active date of the current blog in the loop. * * @param array $args { * Array of optional arguments. * @type bool $active_format If true, formatted "Active 5 minutes ago". * If false, formatted "5 minutes ago". * Default: true. * } * @return string Last active date. */ function bp_get_blog_last_active($args = array()) { global $blogs_template; // Parse the activity format $r = bp_parse_args($args, array('active_format' => true)); // Backwards compatibility for anyone forcing a 'true' active_format if (true === $r['active_format']) { $r['active_format'] = __('active %s', 'buddypress'); } // Blog has been posted to at least once if (isset($blogs_template->blog->last_activity)) { // Backwards compatibility for pre 1.5 'ago' strings $last_activity = !empty($r['active_format']) ? bp_core_get_last_activity($blogs_template->blog->last_activity, $r['active_format']) : bp_core_time_since($blogs_template->blog->last_activity); // Blog has never been posted to } else { $last_activity = __('Never active', 'buddypress'); } /** * Filters the last active date of the current blog in the loop. * * @since * * @param string $last_activity Last active date. * @param array $r Array of parsed args used to determine formatting. */ return apply_filters('bp_blog_last_active', $last_activity, $r); }
<?php } ?> <?php do_action('bp_activity_entry_content'); ?> <?php if (is_user_logged_in()) { ?> <div class="activity-meta"> <?php echo bp_core_time_since(bp_get_activity_date_recorded()); ?> <!-- Delete --> <?php $owner = bp_get_activity_user_id() == $bp->loggedin_user->id; ?> <?php if (is_super_admin() || $bp->current_action != "just-me" && $bp->is_item_admin || $owner) { ?> · <a href="<?php echo wp_nonce_url($bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link');
*/ // Get the reply author object $author = new Apoc_User(bbp_get_reply_author_id(), 'reply'); ?> <li id="post-<?php bbp_reply_id(); ?> " class="reply"> <header class="reply-header"> <time class="reply-time" datetime="<?php echo get_the_time('Y-m-d\\TH:i'); ?> "><?php echo bp_core_time_since(strtotime(get_the_time('c')), current_time('timestamp')); ?> </time> <?php apoc_report_post_button('reply'); ?> <div class="reply-admin-links"> <?php apoc_reply_admin_links(bbp_get_reply_id()); ?> <a class="reply-permalink" href="<?php bbp_reply_url(); ?> ">#<?php echo bbp_get_reply_position();
/** * Return a 'since' string describing when the current post in the loop was posted. * * @see bp_core_time_since() for a description of return value. * * @return string */ function bp_get_the_topic_post_time_since() { global $topic_template; return apply_filters('bp_get_the_topic_post_time_since', bp_core_time_since(strtotime($topic_template->post->post_time))); }
/** * Send a private message reply to a thread via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_messages_send_reply() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => (int) $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if (!empty($result)) { // Get the zebra line classes correct on ajax requests global $thread_template; bp_thread_has_messages(array('thread_id' => (int) $_REQUEST['thread_id'])); if ($thread_template->message_count % 2 == 1) { $class = 'odd'; } else { $class = 'even alt'; } ?> <div class="message-box new-message <?php echo $class; ?> "> <div class="message-metadata"> <?php do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo bp_loggedin_user_domain(); ?> "><?php bp_loggedin_user_fullname(); ?> </a> <span class="activity"><?php printf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php do_action('bp_after_message_meta'); ?> </div> <?php do_action('bp_before_message_content'); ?> <div class="message-content"> <?php echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content'])); ?> </div> <?php do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'buddypress') . '</p></div>'; } exit; }
function bp_dtheme_ajax_messages_send_reply() { global $bp; check_ajax_referer('messages_send_message'); $result = messages_new_message(array('thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content'])); if ($result) { ?> <div class="message-box new-message"> <div class="message-metadata"> <?php do_action('bp_before_message_meta'); ?> <?php echo bp_loggedin_user_avatar('type=thumb&width=30&height=30'); ?> <strong><a href="<?php echo $bp->loggedin_user->domain; ?> "><?php echo $bp->loggedin_user->fullname; ?> </a> <span class="activity"><?php printf(__('Sent %s', 'buddypress'), bp_core_time_since(bp_core_current_time())); ?> </span></strong> <?php do_action('bp_after_message_meta'); ?> </div> <?php do_action('bp_before_message_content'); ?> <div class="message-content"> <?php echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content'])); ?> </div> <?php do_action('bp_after_message_content'); ?> <div class="clear"></div> </div> <?php } else { echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'buddypress') . '</p></div>'; } }
/** * Return the current member's last active time. * * @param array $args { * Array of optional arguments. * @type mixed $active_format If true, formatted "active 5 minutes * ago". If false, formatted "5 minutes ago". * If string, should be sprintf'able like * 'last seen %s ago'. * } * @return string */ function bp_get_member_last_active($args = array()) { global $members_template; // Parse the activity format. $r = bp_parse_args($args, array('active_format' => true)); // Backwards compatibility for anyone forcing a 'true' active_format. if (true === $r['active_format']) { $r['active_format'] = __('active %s', 'buddypress'); } // Member has logged in at least one time. if (isset($members_template->member->last_activity)) { // Backwards compatibility for pre 1.5 'ago' strings. $last_activity = !empty($r['active_format']) ? bp_core_get_last_activity($members_template->member->last_activity, $r['active_format']) : bp_core_time_since($members_template->member->last_activity); // Member has never logged in or been active. } else { $last_activity = __('Never active', 'buddypress'); } /** * Filters the current members last active time. * * @since 1.2.0 * * @param string $last_activity Formatted time since last activity. * @param array $r Array of parsed arguments for query. */ return apply_filters('bp_member_last_active', $last_activity, $r); }