/** * Add post date, author post count and author ip to the author element. */ public function add_author_post_date_count_ip() { ?> <div class="bbp-reply-post-date"><?php bbp_reply_post_date(bbp_get_reply_id()); ?> </div> <div class="bbps-post-count"><?php printf(__('Post count: %s', 'Avada'), bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) + bbp_get_user_topic_count_raw(bbp_get_reply_author_id())); ?> </div> <?php if (bbp_is_user_keymaster()) { ?> <?php do_action('bbp_theme_before_topic_author_admin_details'); ?> <div class="bbp-reply-ip fusion-reply-id"><?php bbp_author_ip(bbp_get_topic_id()); ?> </div> <?php do_action('bbp_theme_after_topic_author_admin_details'); ?> <?php } }
<span class="mom-main-color"> <?php if (class_exists('userpro_api')) { /* Integrating UserPro */ global $userpro; $link = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", $userpro->permalink(bbp_get_reply_author_id()), bbp_get_reply_author_link(array('sep' => '', 'size' => 0))); echo $link . userpro_show_badges(bbp_get_reply_author_id()); } else { bbp_reply_author_link(array('sep' => '', 'show_role' => false, 'type' => 'name')); } ?> </span> <?php _e('on:', 'framework'); ?> <?php bbp_reply_post_date(); ?> <a href="<?php bbp_reply_url(); ?> " class="bbp-reply-permalink alignright">#<?php bbp_reply_id(); ?> </a> </div> <?php do_action('bbp_theme_before_reply_content'); ?> <?php bbp_reply_content();
/** * @covers ::bbp_reply_post_date * @covers ::bbp_get_reply_post_date */ public function test_bbp_get_reply_post_date() { $f = $this->factory->forum->create(); $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f))); $now = time(); $post_date = date('Y-m-d H:i:s', $now - 60 * 66); $r = $this->factory->reply->create(array('post_parent' => $t, 'post_date' => $post_date, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t))); // Configue our written date time, August 4, 2012 at 2:37 pm. $gmt = false; $date = get_post_time(get_option('date_format'), $gmt, $r, true); $time = get_post_time(get_option('time_format'), $gmt, $r, true); $result = sprintf('%1$s at %2$s', $date, $time); // Output, string, August 4, 2012 at 2:37 pm. $this->expectOutputString($result); bbp_reply_post_date($r); // String, August 4, 2012 at 2:37 pm. $datetime = bbp_get_topic_post_date($r, false, false); $this->assertSame($result, $datetime); // Humanized string, 4 days, 4 hours ago. $datetime = bbp_get_topic_post_date($r, true, false); $this->assertSame('1 hour, 6 minutes ago', $datetime); // Humanized string using GMT formatted date, 4 days, 4 hours ago. $datetime = bbp_get_topic_post_date($r, true, true); $this->assertSame('1 hour, 6 minutes ago', $datetime); }