本文整理汇总了PHP中bbp_get_reply_author_display_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply_author_display_name函数的具体用法?PHP bbp_get_reply_author_display_name怎么用?PHP bbp_get_reply_author_display_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_reply_author_display_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _quote
private function _quote() {
$id = bbp_get_reply_id();
$is_reply = true;
if ($id == 0) {
$is_reply = false;
$id = bbp_get_topic_id();
}
if (d4p_bbt_o('quote_method', 'tools') == 'html') {
$url = ''; $ath = '';
if ($is_reply) {
$url = bbp_get_reply_url($id);
$ath = bbp_get_reply_author_display_name($id);
} else {
$url = get_permalink($id);
$ath = bbp_get_topic_author_display_name($id);
}
return '<a href="#'.$id.'" bbp-url="'.$url.'" bbp-author="'.$ath.'" class="d4p-bbt-quote-link">'.__("Quote", "gd-bbpress-tools").'</a>';
} else {
return '<a href="#'.$id.'" class="d4p-bbt-quote-link">'.__("Quote", "gd-bbpress-tools").'</a>';
}
}
示例2: getPostData
public function getPostData()
{
$fooName = 'bbp_get_' . $this->postType . '_content';
$content = $fooName($this->postId);
$return = array('autor' => array('isCurrentUser' => $this->autorId == get_current_user_id(), 'url' => bp_core_get_user_domain($this->autorId), 'avatar' => bp_core_fetch_avatar(array('item_id' => $autorId, 'height' => $imgSize, 'width' => $imgSize)), 'name' => bbp_get_reply_author_display_name($this->postId)), 'type' => $this->postType, 'attachmentList' => $this->_getAttachmentList(), 'sContent' => bbp_get_reply_content($this->postId), 'id' => $this->postId, 'likes' => 0, 'sDate' => get_post_time('j F ', false, $this->postId, true) . __('at', 'qode') . get_post_time(' H:i', false, $this->postId, true), 'sContentShort' => mb_substr($content, 0, 500), 'sContent' => $content, 'like' => get_post_meta($this->postId, 'likes', true), 'isLiked' => get_post_meta($this->postId, 'like_' . $autorId, true));
return $return;
}
示例3: test_bbp_get_reply_author_display_name
/**
* @covers ::bbp_reply_author_display_name
* @covers ::bbp_get_reply_author_display_name
*/
public function test_bbp_get_reply_author_display_name()
{
$u = $this->factory->user->create(array('display_name' => 'Barry B. Benson'));
$t = $this->factory->topic->create();
$r = $this->factory->reply->create(array('post_parent' => $t, 'post_author' => $u, 'reply_meta' => array('topic_id' => $t)));
$reply = bbp_get_reply_author_display_name($r);
$this->assertSame('Barry B. Benson', $reply);
}
示例4: wp_slack_bbpress
/**
* Plugin Name: WP Slack bbPress
* Plugin URI: https://github.com/rolfkleef/wp-slack-bbpress
* Description: Send notifications to Slack channels for events in bbPress.
* Version: 0.5
* Author: Rolf Kleef
* Author URI: https://drostan.org
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-slack-bbpress
*/
function wp_slack_bbpress($events)
{
$events['wp_slack_bbp_new_topic'] = array('action' => 'bbp_new_topic', 'description' => __('When a new topic is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($topic_id, $forum_id, $anonymous_data, $topic_author) {
return array(array('fallback' => sprintf(__('<%1$s|New topic "%2$s"> in forum <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'pretext' => sprintf(__('New topic in forum <%1$s|%2$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'author_name' => bbp_get_topic_author_display_name($topic_id), 'author_link' => bbp_get_topic_author_link($topic_id), 'author_icon' => get_avatar_url($topic_author, array('size' => 16)), 'title' => sprintf('%1$s', bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_topic_permalink($topic_id), 'text' => html_entity_decode(bbp_get_topic_excerpt($topic_id, 150))));
});
$events['wp_slack_bbp_new_reply'] = array('action' => 'bbp_new_reply', 'description' => __('When a new reply is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, $bool, $reply_to) {
return array(array('fallback' => sprintf(__('<%1$s|New reply> in forum <%2$s|%3$s> on topic <%4$s|%5$s>', 'wp-slack-bbpress'), bbp_get_reply_url($reply_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'pretext' => sprintf(__('New reply in forum <%1$s|%2$s> on topic <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'author_name' => bbp_get_reply_author_display_name($reply_id), 'author_link' => bbp_get_reply_author_link($reply_id), 'author_icon' => get_avatar_url($reply_author, array('size' => 16)), 'title' => sprintf(__('New reply to "%1$s"', 'wp-slack-bbpress'), bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_reply_url($reply_id), 'text' => html_entity_decode(bbp_get_reply_excerpt($reply_id, 150))));
});
return $events;
}
示例5: reply_message
public static function reply_message($message, $reply_id, $topic_id, $user_id)
{
$reply_content = strip_tags(bbp_get_reply_content($reply_id));
$reply_url = bbp_get_reply_url($reply_id);
$reply_author = bbp_get_reply_author_display_name($reply_id);
$custom_message = get_option('_bbp_reply_notice_body');
$message = $custom_message ? $custom_message : $message;
$message = str_replace('{author}', $reply_author, $message);
$message = str_replace('{content}', $reply_content, $message);
$message = str_replace('{url}', $reply_url, $message);
return $message;
}
示例6: notify_on_reply
/**
* Send a notification to subscribers
*
* @wp-filter bbp_new_reply 1
*/
public function notify_on_reply($reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0)
{
if ($this->handler === null) {
return false;
}
global $wpdb;
if (!bbp_is_subscriptions_active()) {
return false;
}
$reply_id = bbp_get_reply_id($reply_id);
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
if (!bbp_is_reply_published($reply_id)) {
return false;
}
if (!bbp_is_topic_published($topic_id)) {
return false;
}
$user_ids = bbp_get_topic_subscribers($topic_id, true);
if (empty($user_ids)) {
return false;
}
// Poster name
$reply_author_name = apply_filters('bbsub_reply_author_name', bbp_get_reply_author_display_name($reply_id));
do_action('bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids);
// Don't send notifications to the person who made the post
$send_to_author = Falcon::get_option('bbsub_send_to_author', false);
if (!$send_to_author && !empty($reply_author)) {
$user_ids = array_filter($user_ids, function ($id) use($reply_author) {
return (int) $id !== (int) $reply_author;
});
}
// Get userdata for all users
$user_ids = array_map(function ($id) {
return get_userdata($id);
}, $user_ids);
// Sanitize the HTML into text
$content = apply_filters('bbsub_html_to_text', bbp_get_reply_content($reply_id));
// Build email
$text = "%1\$s\n\n";
$text .= "---\nReply to this email directly or view it online:\n%2\$s\n\n";
$text .= "You are receiving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.";
$text = sprintf($text, $content, bbp_get_reply_url($reply_id));
$text = apply_filters('bbsub_email_message', $text, $reply_id, $topic_id, $content);
$subject = apply_filters('bbsub_email_subject', 'Re: [' . get_option('blogname') . '] ' . bbp_get_topic_title($topic_id), $reply_id, $topic_id);
$options = array('id' => $topic_id, 'author' => $reply_author_name);
$this->handler->send_mail($user_ids, $subject, $text, $options);
do_action('bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids);
return true;
}
示例7: bbp_get_author_display_name
/**
* Return the author name of a topic or reply.
*
* Convenience function to ensure proper template functions are called
* and correct filters are executed. Used primarily to display topic
* and reply author information in the anonymous form template-part.
*
* @since 2.5.0 bbPress (r5119)
*
* @param int $post_id
*
* @uses bbp_is_topic_edit()
* @uses bbp_get_topic_author_display_name()
* @uses bbp_is_reply_edit()
* @uses bbp_get_reply_author_display_name()
* @uses bbp_current_anonymous_user_data()
*
* @return string The name of the author
*/
function bbp_get_author_display_name($post_id = 0)
{
// Define local variable(s)
$retval = '';
// Topic edit
if (bbp_is_topic_edit()) {
$retval = bbp_get_topic_author_display_name($post_id);
// Reply edit
} elseif (bbp_is_reply_edit()) {
$retval = bbp_get_reply_author_display_name($post_id);
// Not an edit, so rely on current user cookie data
} else {
$retval = bbp_current_anonymous_user_data('name');
}
return apply_filters('bbp_get_author_display_name', $retval, $post_id);
}
示例8: subscription_email
/**
* Sends the new reply notification email to moderators on private replies
*
* @since 1.2
*
* @param $message string The email message
* @param $reply_id int The ID of the reply
* @param $topic_id int The ID of the reply's topic
*
* @return void
*/
public function subscription_email($message, $reply_id, $topic_id)
{
if (!$this->is_private($reply_id)) {
return false;
// reply isn't private so do nothing
}
$topic_author = bbp_get_topic_author_id($topic_id);
$reply_author = bbp_get_reply_author_id($reply_id);
$reply_author_name = bbp_get_reply_author_display_name($reply_id);
// Strip tags from text and setup mail data
$topic_title = strip_tags(bbp_get_topic_title($topic_id));
$reply_content = strip_tags(bbp_get_reply_content($reply_id));
$reply_url = bbp_get_reply_url($reply_id);
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$do_not_reply = '<noreply@' . ltrim(get_home_url(), '^(http|https)://') . '>';
$subject = apply_filters('bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id);
// Array to hold BCC's
$headers = array();
// Setup the From header
$headers[] = 'From: ' . get_bloginfo('name') . ' ' . $do_not_reply;
// Get topic subscribers and bail if empty
$user_ids = bbp_get_topic_subscribers($topic_id, true);
if (empty($user_ids)) {
return false;
}
// Loop through users
foreach ((array) $user_ids as $user_id) {
// Don't send notifications to the person who made the post
if (!empty($reply_author) && (int) $user_id === (int) $reply_author) {
continue;
}
if (user_can($user_id, 'moderate') || (int) $topic_author === (int) $user_id) {
// Get email address of subscribed user
$headers[] = 'Bcc: ' . get_userdata($user_id)->user_email;
}
}
wp_mail($do_not_reply, $subject, $message, $headers);
}
示例9: AddBBPressForumThreadUserRating
public function AddBBPressForumThreadUserRating($author_link, $args)
{
RWLogger::LogEnterence('AddBBPressForumThreadUserRating');
$post_id = 0;
$defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80, 'sep' => ' ');
$r = wp_parse_args($args, $defaults);
extract($r);
$reply_id = bbp_get_reply_id($post_id);
RWLogger::Log('AddBBPressForumThreadUserRating', 'post_id = ' . $post_id);
RWLogger::Log('AddBBPressForumThreadUserRating', 'reply_id = ' . $reply_id);
if (bbp_is_reply_anonymous($reply_id)) {
return $author_link;
}
$options = array('show-info' => 'false');
// If accumulated user rating, then make sure it can not be directly rated.
if ($this->IsUserAccumulatedRating()) {
$options['read-only'] = 'true';
$options['show-report'] = 'false';
}
$author_id = bbp_get_reply_author_id($reply_id);
return $author_link . $this->EmbedRatingIfVisible($author_id, $author_id, bbp_get_reply_author_display_name($reply_id), bbp_get_reply_author_url($reply_id), 'user', false, false, false, $options);
}
示例10: bbp_reply_content
?>
<?php
bbp_reply_content();
?>
<?php
do_action('bbp_theme_after_reply_content');
?>
</div>
<div class="bbp-reply-footer">
<?php
do_action('bbp_theme_before_reply_admin_links');
?>
<?php
$reply_sep = ' - ';
$reply_data = 'data-id="#content-' . bbp_get_reply_id() . '" data-url="' . bbp_get_reply_url() . '" data-author="' . bbp_get_reply_author_display_name(bbp_get_reply_id()) . '"';
$reply_link = is_user_logged_in() ? $reply_sep . '<a class="js-reply" href="#new-post" ' . $reply_data . '>Цитата</a>' : '';
bbp_reply_admin_links(array('sep' => $reply_sep, 'after' => $reply_link . '</span>'));
?>
<?php
do_action('bbp_theme_after_reply_admin_links');
?>
</div>
</div><!-- .bbp-reply-content -->
</div><!-- .reply --><!-- #post-<?php
bbp_reply_id();
?>
-->
示例11: bbp_get_reply_author_link
/**
* Return the author link of the reply
*
* @since bbPress (r2717)
*
* @param mixed $args Optional. If an integer, it is used as reply id.
* @uses bbp_get_reply_id() To get the reply id
* @uses bbp_is_reply_anonymous() To check if the reply is by an
* anonymous user
* @uses bbp_get_reply_author() To get the reply author name
* @uses bbp_get_reply_author_url() To get the reply author url
* @uses bbp_get_reply_author_avatar() To get the reply author avatar
* @uses bbp_get_reply_author_display_name() To get the reply author display
* name
* @uses bbp_get_user_display_role() To get the reply author display role
* @uses bbp_get_reply_author_id() To get the reply author id
* @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
* author link and args
* @return string Author link of reply
*/
function bbp_get_reply_author_link($args = '')
{
$defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80, 'sep' => ' ', 'show_role' => false);
$r = bbp_parse_args($args, $defaults, 'get_reply_author_link');
extract($r);
// Used as reply_id
if (is_numeric($args)) {
$reply_id = bbp_get_reply_id($args);
} else {
$reply_id = bbp_get_reply_id($post_id);
}
if (!empty($reply_id)) {
if (empty($link_title)) {
$link_title = sprintf(!bbp_is_reply_anonymous($reply_id) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), bbp_get_reply_author_display_name($reply_id));
}
$link_title = !empty($link_title) ? ' title="' . $link_title . '"' : '';
$author_url = bbp_get_reply_author_url($reply_id);
$anonymous = bbp_is_reply_anonymous($reply_id);
// Get avatar
if ('avatar' == $type || 'both' == $type) {
$author_links['avatar'] = bbp_get_reply_author_avatar($reply_id, $size);
}
// Get display name
if ('name' == $type || 'both' == $type) {
$author_links['name'] = bbp_get_reply_author_display_name($reply_id);
}
// Add links if not anonymous
if (empty($anonymous) && bbp_user_has_profile(bbp_get_reply_author_id($reply_id))) {
foreach ($author_links as $link => $link_text) {
$link_class = ' class="bbp-author-' . $link . '"';
$author_link[] = sprintf('<a href="%1$s"%2$s%3$s>%4$s</a>', $author_url, $link_title, $link_class, $link_text);
}
if (true === $show_role) {
$author_link[] = bbp_get_reply_author_role(array('reply_id' => $reply_id));
}
$author_link = join($sep, $author_link);
// No links if anonymous
} else {
$author_link = join($sep, $author_links);
}
// No replies so link is empty
} else {
$author_link = '';
}
return apply_filters('bbp_get_reply_author_link', $author_link, $args);
}
示例12: AddBBPressForumThreadUserRating
public function AddBBPressForumThreadUserRating($author_link)
{
global $post;
$reply_id = bbp_get_reply_id($post->ID);
if (bbp_is_reply_anonymous($reply_id)) {
return $author_link;
}
$options = array('show-info' => 'false');
// If accumulated user rating, then make sure it can not be directly rated.
if ($this->IsUserAccumulatedRating()) {
$options['read-only'] = 'true';
$options['show-report'] = 'false';
}
$author_id = bbp_get_reply_author_id($reply_id);
return $author_link . $this->EmbedRatingIfVisible($author_id, $author_id, bbp_get_reply_author_display_name($reply_id), bbp_get_reply_author_url($reply_id), 'user', false, false, false, $options);
}
示例13: notify_reply
/**
* Notify admins on new reply on the forum
*
* A modified/inspired version of bbp_notify_topic_subscribers()
* @param type $reply_id
* @param type $topic_id
* @param type $forum_id
* @param type $anonymous_data
* @param type $reply_author
* @param type $unknown_boolean
* @param type $reply_to
* @return boolean
*/
public function notify_reply($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, $unknown_boolean, $reply_to)
{
$reply_id = bbp_get_reply_id($reply_id);
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
// Poster name
$reply_author_name = bbp_get_reply_author_display_name($reply_id);
remove_all_filters('bbp_get_reply_content');
remove_all_filters('bbp_get_topic_title');
// Strip tags from text and setup mail data
$topic_title = strip_tags(bbp_get_topic_title($topic_id));
$reply_content = strip_tags(bbp_get_reply_content($reply_id));
$reply_url = bbp_get_reply_url($reply_id);
$message = sprintf(__('%1$s wrote:
%2$s
Post Link: %3$s
-----------
You are receiving this email because you askd for it.
Login and visit the settings to disable these emails.', 'bbp-notify-admin'), $reply_author_name, $reply_content, $reply_url);
$message = apply_filters('bbp_notify_admin_reply_mail_message', $message, $reply_id, $topic_id);
if (empty($message)) {
return;
}
$subject = apply_filters('bbp_notify_admin_reply_mail_title', $this->get_subject(__('New Reply: ', 'bbp-notify-admin') . $topic_title), $reply_id, $topic_id);
if (empty($subject)) {
return;
}
$headers = $this->get_headers();
//get all admin users
$users = $this->get_users_to_notify('reply');
$users = apply_filters('bbp_notify_admin_reply_notifiable_users', $users);
if (empty($users)) {
return false;
}
//get all users emails
$emails = $this->get_emails($users, 'reply');
if (empty($emails)) {
return false;
//no one to send to
}
$to_email = array_shift($emails);
// Loop through users
foreach ($emails as $email) {
//add all other users as bcc(only applies in case we have more than 1 admin )
$headers[] = 'Bcc:' . $email;
}
$this->notify(array('subject' => $subject, 'message' => $message, 'to' => $to_email, 'headers' => $headers));
}
示例14: load_more_topics
//.........这里部分代码省略.........
</a>
<?php
}
$replies = array_reverse($replies);
//array_shift ( $replies );
foreach ($replies as $reply) {
?>
<div class="single_topic_reply <?php
$postUser = new WP_User($reply->post_author);
echo $postUser->has_cap('bbp_keymaster') || $postUser->has_cap('bbp_moderator') ? "isAdmin" : "";
?>
"
data-id="<?php
echo $reply->ID;
?>
">
<div class="photo">
<a
href="<?php
echo bp_core_get_user_domain($reply->post_author);
?>
"><?php
echo bp_core_fetch_avatar(array('item_id' => $reply->post_author, 'height' => 32, 'width' => 32));
?>
</a>
</div>
<div class="content_wrapper">
<div class="reply_content">
<a class="author-link"
href="<?php
echo bp_core_get_user_domain($reply->post_author);
?>
"><?php
echo bbp_get_reply_author_display_name($reply->ID);
?>
</a>
<?php
if ($postUser->has_cap('bbp_keymaster')) {
echo "<small>(Администратор форума)</small>";
} elseif ($postUser->has_cap('bbp_moderator')) {
echo "<small>(Преподаватель)</small>";
}
?>
<?php
echo bbp_get_reply_content($reply->ID);
?>
</div>
<div style="display: none" class="reply_content_edit">
<textarea class="reply_content_edit_textarea"><?php
echo get_post_field('post_content', $reply->ID);
?>
</textarea>
<div class="edit_actions">
<a class="cancel" href="#">Отменить</a>
</div>
</div>
<div class="date">
<?php
echo get_post_time('j F ', false, $reply->ID, true) . __('at', 'qode') . get_post_time(' H:i', false, $reply->ID, true);
?>
</span><?php
$like = get_post_meta($reply->ID, 'like_' . get_current_user_id(), true);
?>
</div>
示例15: bp_core_get_user_domain
href="<?php
echo bp_core_get_user_domain($reply->post_author);
?>
"><?php
echo bp_core_fetch_avatar(array('item_id' => $reply->post_author, 'height' => 32, 'width' => 32));
?>
</a>
</div>
<div class="content_wrapper">
<div class="reply_content"><a
class="author-link"
href="<?php
echo bp_core_get_user_domain($reply->post_author);
?>
"><?php
echo bbp_get_reply_author_display_name($reply->ID);
?>
</a>
<?php
if ($postUser->has_cap('bbp_keymaster')) {
echo "<small>(Администратор форума)</small>";
} elseif ($postUser->has_cap('bbp_moderator')) {
echo "<small>(Преподаватель)</small>";
}
?>
<?php
echo bbp_get_reply_content($reply->ID);
?>
</div>
<div class="single_reply_attaches">
<?php