本文整理汇总了PHP中bbp_get_reply_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply_id函数的具体用法?PHP bbp_get_reply_id怎么用?PHP bbp_get_reply_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_reply_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kleo_bbp_add_role_class
function kleo_bbp_add_role_class($author_role, $r)
{
$reply_id = bbp_get_reply_id($r['reply_id']);
$role = strtolower(esc_attr(bbp_get_user_display_role(bbp_get_reply_author_id($reply_id))));
$author_role = str_replace('class="', 'class="role-' . $role . ' ', $author_role);
return $author_role;
}
示例2: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = !empty($instance['title']) ? $instance['title'] : __('Recent Topics');
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$number = !empty($instance['number']) ? absint($instance['number']) : 5;
$orderby = !empty($instance['number']) ? strip_tags($instance['order_by']) : 'newness';
if ($orderby == 'newness') {
$cb_meta_key = $cb_order_by = NULL;
} elseif ($orderby == 'popular') {
$cb_meta_key = '_bbp_reply_count';
$cb_order_by = 'meta_value';
} elseif ($orderby == 'freshness') {
$cb_meta_key = '_bbp_last_active_time';
$cb_order_by = 'meta_value';
}
if (!$number) {
$number = 5;
}
$cb_qry = new WP_Query(array('post_type' => bbp_get_topic_post_type(), 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()), 'order' => 'DESC', 'posts_per_page' => $number, 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'meta_key' => $cb_meta_key, 'orderby' => $cb_order_by));
echo $before_widget;
echo $before_title . $title . $after_title;
?>
<ul class="cb-bbp-recent-topics">
<?php
while ($cb_qry->have_posts()) {
$cb_qry->the_post();
?>
<li>
<?php
$cb_reply_id = bbp_get_reply_id($cb_qry->post->ID);
$cb_reply_url = '<a class="bbp-reply-topic-title" href="' . esc_url(bbp_get_reply_url($cb_reply_id)) . '" title="' . esc_attr(bbp_get_reply_excerpt($cb_reply_id, 50)) . '">' . bbp_get_reply_topic_title($cb_reply_id) . '</a>';
$cb_number_replies = bbp_get_topic_reply_count($cb_reply_id);
$cb_author_avatar = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'avatar', 'size' => 60));
$cb_author_name = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'name'));
echo $cb_author_avatar . '<div class="cb-bbp-meta">' . $cb_reply_url . '<div class="cb-bbp-byline">' . __('Started by', 'cubell') . ' ' . $cb_author_name . ' <i class="icon-long-arrow-right"></i> ' . $cb_number_replies . ' replies</div></div>';
?>
</li>
<?php
}
?>
</ul>
<?php
echo $after_widget;
// Reset the $post global
wp_reset_postdata();
}
示例3: 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;
}
示例4: d4p_is_bbpress
/**
* Check if the current page is forum, topic or other bbPress page.
*
* @return bool true if the current page is the forum related
*/
function d4p_is_bbpress()
{
$is = false;
if (function_exists("bbp_get_forum_id")) {
$is = bbp_get_forum_id() > 0 || bbp_get_reply_id() > 0 || bbp_get_topic_id() > 0;
if (!$is) {
global $template;
$templates = array("single-reply-edit.php", "single-topic-edit.php");
$file = pathinfo($template, PATHINFO_BASENAME);
$is = in_array($file, $templates);
}
}
return apply_filters('d4p_is_bbpress', $is);
}
示例5: getReplyList
public function getReplyList($topicId = -1)
{
$topicId = $topicId == -1 ? $_POST['param']['topicId'] : $topicId;
$loadFrom = empty($_POST['param']['from']) ? 0 : $_POST['param']['from'];
$loadTo = empty($_POST['param']['to']) ? 0 : $_POST['param']['to'];
$return = array();
$param = array('post_parent' => $topicId, 'post_type' => 'reply');
if (!bbp_has_replies($param)) {
$this->_die();
}
while (bbp_replies()) {
bbp_the_reply();
$reply = new ForumBbpAjaxIntegratorPost(bbp_get_reply_id(), 'reply');
$return[] = $reply->getPostData();
}
return $return;
}
示例6: append_message_trigger
function append_message_trigger($author_link, $r)
{
//we need to make sure it is a reply
if (!bbp_get_reply_id()) {
return $author_link;
}
wp_enqueue_script('popoverasync', ig_uploader()->plugin_url . 'assets/popover/popoverasync.js', array('jquery', 'ig-bootstrap', 'jquery-frame-transport'));
wp_enqueue_style('igu-uploader', ig_uploader()->plugin_url . 'assets/style.css');
$new_links = explode($r['sep'], $author_link);
$author_id = bbp_get_reply_author_id(bbp_get_reply_id($r['post_id']));
$message_link = do_shortcode("[pm_user user_id={$author_id} class='btn btn-xs btn-primary']");
$message_link = sprintf('<div style="%s">%s</div>', 'margin-top:5px', $message_link);
array_splice($new_links, 1, 0, array($message_link));
$new_links = implode($r['sep'], $new_links);
//$logger = new IG_Logger('file', 'message_bbpress.txt');
//$logger->log(var_export($new_links, true), IG_Logger::ERROR_LEVEL_DEBUG);
return $new_links;
}
示例7: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments');
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$number = !empty($instance['number']) ? absint($instance['number']) : 5;
if (!$number) {
$number = 5;
}
$cb_qry = new WP_Query(array('post_type' => bbp_get_reply_post_type(), 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()), 'posts_per_page' => $number, 'ignore_sticky_posts' => true, 'no_found_rows' => true));
echo $before_widget;
echo $before_title . $title . $after_title;
?>
<ul class="cb-bbp-recent-replies">
<?php
while ($cb_qry->have_posts()) {
$cb_qry->the_post();
?>
<li>
<?php
$cb_reply_id = bbp_get_reply_id($cb_qry->post->ID);
$cb_reply_url = '<a class="bbp-reply-topic-title" href="' . esc_url(bbp_get_reply_url($cb_reply_id)) . '" title="' . esc_attr(bbp_get_reply_excerpt($cb_reply_id, 50)) . '">' . bbp_get_reply_topic_title($cb_reply_id) . '</a>';
$cb_author_avatar = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'avatar', 'size' => 60));
$cb_author_name = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'name'));
echo $cb_author_avatar . '<div class="cb-bbp-meta">' . $cb_author_name . ' <i class="icon-long-arrow-right"></i> ' . $cb_reply_url . '<div class="cb-bbp-recent-replies-time">' . bbp_get_time_since(get_the_time('U')) . '</div></div>';
?>
</li>
<?php
}
?>
</ul>
<?php
echo $after_widget;
// Reset the $post global
wp_reset_postdata();
}
示例8: bbp_tab_index
<?php
if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_reply_forum_id(bbp_get_reply_id()), 'post__not_in' => array(bbp_get_reply_topic_id(bbp_get_reply_id()))))) {
?>
<div>
<input name="bbp_reply_move_option" id="bbp_reply_move_option_existing" type="radio" value="existing" tabindex="<?php
bbp_tab_index();
?>
" />
<label for="bbp_reply_move_option_existing"><?php
_e('Use an existing topic in this forum:', 'firmasite');
?>
</label>
<?php
bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_reply_forum_id(bbp_get_reply_id()), 'selected' => -1, 'exclude' => bbp_get_reply_topic_id(bbp_get_reply_id()), 'select_id' => 'bbp_destination_topic', 'none_found' => __('No other topics found!', 'firmasite')));
?>
</div>
<?php
}
?>
</fieldset>
<div class="bbp-template-notice error alert alert-warning">
<p><?php
_e('<strong>WARNING:</strong> This process cannot be undone.', 'firmasite');
?>
</p>
示例9: reply_update
/**
* Update the activity stream entry when a reply status changes
*
* @param int $post_id
* @param obj $post
* @uses get_post_type()
* @uses bbp_get_reply_post_type()
* @uses bbp_get_reply_id()
* @uses bbp_is_reply_anonymous()
* @uses bbp_get_public_status_id()
* @uses bbp_get_closed_status_id()
* @uses bbp_get_reply_topic_id()
* @uses bbp_get_reply_forum_id()
* @uses bbp_get_reply_author_id()
* @return Bail early if not a reply, or reply is by anonymous user
*/
public function reply_update($reply_id, $post)
{
// Bail early if not a reply
if (get_post_type($post) != bbp_get_reply_post_type()) {
return;
}
$reply_id = bbp_get_reply_id($reply_id);
// Bail early if reply is by anonymous user
if (bbp_is_reply_anonymous($reply_id)) {
return;
}
$anonymous_data = array();
// Action based on new status
if ($post->post_status == bbp_get_public_status_id()) {
// Validate reply data
$topic_id = bbp_get_reply_topic_id($reply_id);
$forum_id = bbp_get_reply_forum_id($reply_id);
$reply_author_id = bbp_get_reply_author_id($reply_id);
$this->reply_create($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author_id);
} else {
$this->reply_delete($reply_id);
}
}
示例10: get_the_time
<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();
?>
</a>
</div>
</header>
<section class="reply-body">
<div class="reply-author">
<?php
echo $author->block;
示例11: add_author_post_date_count_ip
/**
* 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
}
}
示例12: bbp_reply_form_fields
/**
* Output the required hidden fields when creating/editing a reply
*
* @since bbPress (r2753)
*
* @uses bbp_is_reply_edit() To check if it's the reply edit page
* @uses wp_nonce_field() To generate hidden nonce fields
* @uses bbp_reply_id() To output the reply id
* @uses bbp_topic_id() To output the topic id
* @uses bbp_forum_id() To output the forum id
*/
function bbp_reply_form_fields()
{
if (bbp_is_reply_edit()) {
?>
<input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php
printf(__('Reply To: %s', 'bbpress'), bbp_get_topic_title());
?>
" maxlength="<?php
bbp_get_title_max_length();
?>
" />
<input type="hidden" name="bbp_reply_id" id="bbp_reply_id" value="<?php
bbp_reply_id();
?>
" />
<input type="hidden" name="action" id="bbp_post_action" value="bbp-edit-reply" />
<?php
if (current_user_can('unfiltered_html')) {
wp_nonce_field('bbp-unfiltered-html-reply_' . bbp_get_reply_id(), '_bbp_unfiltered_html_reply', false);
}
?>
<?php
wp_nonce_field('bbp-edit-reply_' . bbp_get_reply_id());
} else {
?>
<input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php
printf(__('Reply To: %s', 'bbpress'), bbp_get_topic_title());
?>
" maxlength="<?php
bbp_get_title_max_length();
?>
" />
<input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="<?php
bbp_topic_id();
?>
" />
<input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply" />
<?php
if (current_user_can('unfiltered_html')) {
wp_nonce_field('bbp-unfiltered-html-reply_' . bbp_get_topic_id(), '_bbp_unfiltered_html_reply', false);
}
?>
<?php
wp_nonce_field('bbp-new-reply');
// Show redirect field if not viewing a specific topic
if (bbp_is_query_name('bbp_single_topic')) {
bbp_redirect_to_field(get_permalink());
}
}
}
示例13: bbp_get_form_reply_to
/**
* Return the value of reply to field
*
* @since bbPress (r4944)
*
* @uses bbp_get_reply_id() To validate the reply to
* @uses apply_filters() Calls 'bbp_get_form_reply_to' with the reply to
* @return string Value of reply to field
*/
function bbp_get_form_reply_to()
{
// Set initial value
$reply_to = 0;
// Get $_REQUEST data
if (isset($_REQUEST['bbp_reply_to'])) {
$reply_to = (int) $_REQUEST['bbp_reply_to'];
}
// If empty, get from meta
if (empty($reply_to)) {
$reply_to = bbp_get_reply_to();
}
// Validate
$reply_to = bbp_get_reply_id($reply_to);
return (int) apply_filters('bbp_get_form_reply_to', $reply_to);
}
示例14: apoc_report_post_button
/**
* Generate post report buttons
* @version 2.0
*/
function apoc_report_post_button($type)
{
// Only let members report stuff
if (!is_user_logged_in()) {
return false;
}
// Get the data by context
switch ($type) {
// Forum reply
case 'reply':
$post_id = bbp_get_reply_id();
$reported_user = bbp_get_reply_author();
$post_number = bbp_get_reply_position();
break;
// Article comment
// Article comment
case 'comment':
global $comment, $comment_count;
$post_id = $comment->comment_ID;
$reported_user = $comment->comment_author;
$post_number = $comment_count['count'];
break;
// Private message
// Private message
case 'message':
global $thread_template;
$post_id = $thread_template->message->thread_id;
$reported_user = $thread_template->message->sender_id;
$post_number = $thread_template->current_message + 1;
break;
}
// Echo the button
$button = '<a class="report-post" title="Report This Post" data-id="' . $post_id . '" data-number="' . $post_number . '" data-user="' . $reported_user . '" data-type="' . $type . '"><i class="fa fa-warning"></i></a>';
echo $button;
}
示例15: bbp_get_reply_position_raw
/**
* Get the position of a reply by querying the DB directly for the replies
* of a given topic.
*
* @since bbPress (r3933)
*
* @param int $reply_id
* @param int $topic_id
*/
function bbp_get_reply_position_raw($reply_id = 0, $topic_id = 0)
{
// Get required data
$reply_id = bbp_get_reply_id($reply_id);
$topic_id = !empty($topic_id) ? bbp_get_topic_id($topic_id) : bbp_get_reply_topic_id($reply_id);
$reply_position = 0;
// If reply is actually the first post in a topic, return 0
if ($reply_id !== $topic_id) {
// Make sure the topic has replies before running another query
$reply_count = bbp_get_topic_reply_count($topic_id, false);
if (!empty($reply_count)) {
// Get reply id's
$topic_replies = bbp_get_all_child_ids($topic_id, bbp_get_reply_post_type());
if (!empty($topic_replies)) {
// Reverse replies array and search for current reply position
$topic_replies = array_reverse($topic_replies);
$reply_position = array_search((string) $reply_id, $topic_replies);
// Bump the position to compensate for the lead topic post
$reply_position++;
}
}
}
return (int) $reply_position;
}