• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bbp_get_reply函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bbp_get_reply函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply函数的具体用法?PHP bbp_get_reply怎么用?PHP bbp_get_reply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bbp_get_reply函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: test_bbp_insert_reply

 /**
  * @group canonical
  * @covers ::bbp_insert_reply
  */
 public function test_bbp_insert_reply()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create(array('post_title' => 'Reply To: Topic 1', 'post_content' => 'Content of reply to Topic 1', 'post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     // Get the reply.
     $reply = bbp_get_reply($r);
     remove_all_filters('bbp_get_reply_content');
     // Reply post.
     $this->assertSame('Reply To: Topic 1', bbp_get_reply_title($r));
     $this->assertSame('Content of reply to Topic 1', bbp_get_reply_content($r));
     $this->assertSame('publish', bbp_get_reply_status($r));
     $this->assertSame($t, wp_get_post_parent_id($r));
     $this->assertEquals('http://' . WP_TESTS_DOMAIN . '/?reply=' . $reply->post_name, $reply->guid);
     // Reply meta.
     $this->assertSame($f, bbp_get_reply_forum_id($r));
     $this->assertSame($t, bbp_get_reply_topic_id($r));
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:22,代码来源:reply.php


示例2: toggle_reply_notice

        /**
         * Toggle reply notices
         *
         * Display the success/error notices from
         * {@link BBP_Admin::toggle_reply()}
         *
         * @since 2.0.0 bbPress (r2740)
         *
         * @uses bbp_get_reply() To get the reply
         * @uses bbp_get_reply_title() To get the reply title of the reply
         * @uses esc_html() To sanitize the reply title
         * @uses apply_filters() Calls 'bbp_toggle_reply_notice_admin' with
         *                        message, reply id, notice and is it a failure
         */
        public function toggle_reply_notice()
        {
            if ($this->bail()) {
                return;
            }
            // Only proceed if GET is a reply toggle action
            if (bbp_is_get_request() && !empty($_GET['bbp_reply_toggle_notice']) && in_array($_GET['bbp_reply_toggle_notice'], array('spammed', 'unspammed', 'approved', 'unapproved')) && !empty($_GET['reply_id'])) {
                $notice = $_GET['bbp_reply_toggle_notice'];
                // Which notice?
                $reply_id = (int) $_GET['reply_id'];
                // What's the reply id?
                $is_failure = !empty($_GET['failed']) ? true : false;
                // Was that a failure?
                // Empty? No reply?
                if (empty($notice) || empty($reply_id)) {
                    return;
                }
                // Get reply and bail if empty
                $reply = bbp_get_reply($reply_id);
                if (empty($reply)) {
                    return;
                }
                $reply_title = bbp_get_reply_title($reply->ID);
                switch ($notice) {
                    case 'spammed':
                        $message = $is_failure === true ? sprintf(__('There was a problem marking the reply "%1$s" as spam.', 'bbpress'), $reply_title) : sprintf(__('Reply "%1$s" successfully marked as spam.', 'bbpress'), $reply_title);
                        break;
                    case 'unspammed':
                        $message = $is_failure === true ? sprintf(__('There was a problem unmarking the reply "%1$s" as spam.', 'bbpress'), $reply_title) : sprintf(__('Reply "%1$s" successfully unmarked as spam.', 'bbpress'), $reply_title);
                        break;
                    case 'approved':
                        $message = $is_failure === true ? sprintf(__('There was a problem approving the reply "%1$s".', 'bbpress'), $reply_title) : sprintf(__('Reply "%1$s" successfully approved.', 'bbpress'), $reply_title);
                        break;
                    case 'unapproved':
                        $message = $is_failure === true ? sprintf(__('There was a problem unapproving the reply "%1$s".', 'bbpress'), $reply_title) : sprintf(__('Reply "%1$s" successfully unapproved.', 'bbpress'), $reply_title);
                        break;
                }
                // Do additional reply toggle notice filters (admin side)
                $message = apply_filters('bbp_toggle_reply_notice_admin', $message, $reply->ID, $notice, $is_failure);
                ?>

			<div id="message" class="<?php 
                echo $is_failure === true ? 'error' : 'updated';
                ?>
 fade">
				<p style="line-height: 150%"><?php 
                echo esc_html($message);
                ?>
</p>
			</div>

			<?php 
            }
        }
开发者ID:joeyblake,项目名称:bbpress,代码行数:68,代码来源:replies.php


示例3: bbp_split_topic_handler

/**
 * Split topic handler
 *
 * Handles the front end split topic submission
 *
 * @since bbPress (r2756)
 *
 * @param string $action The requested action to compare this function to
 * @uses bbp_add_error() To add an error message
 * @uses bbp_get_reply() To get the reply
 * @uses bbp_get_topic() To get the topics
 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
 * @uses current_user_can() To check if the current user can edit the topics
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
 * @uses do_action() Calls 'bbp_pre_split_topic' with the from reply id, source
 *                    and destination topic ids
 * @uses bbp_get_topic_subscribers() To get the source topic subscribers
 * @uses bbp_add_user_subscription() To add the user subscription
 * @uses bbp_get_topic_favoriters() To get the source topic favoriters
 * @uses bbp_add_user_favorite() To add the user favorite
 * @uses wp_get_post_terms() To get the source topic tags
 * @uses wp_set_post_terms() To set the topic tags
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses wpdb::prepare() To prepare our sql query
 * @uses wpdb::get_results() To execute the sql query and get results
 * @uses wp_update_post() To update the replies
 * @uses bbp_update_reply_topic_id() To update the reply topic id
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses bbp_update_reply_forum_id() To update the reply forum id
 * @uses do_action() Calls 'bbp_split_topic_reply' with the reply id and
 *                    destination topic id
 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id
 * @uses bbp_update_topic_last_active_time() To update the topic last active meta
 * @uses do_action() Calls 'bbp_post_split_topic' with the destination and
 *                    source topic ids and source topic's forum id
 * @uses bbp_get_topic_permalink() To get the topic permalink
 * @uses wp_safe_redirect() To redirect to the topic link
 */
function bbp_split_topic_handler($action = '')
{
    // Bail if action is not 'bbp-split-topic'
    if ('bbp-split-topic' !== $action) {
        return;
    }
    global $wpdb;
    // Prevent debug notices
    $from_reply_id = $destination_topic_id = 0;
    $destination_topic_title = '';
    $destination_topic = $from_reply = $source_topic = '';
    $split_option = false;
    /** Split Reply ***********************************************************/
    if (empty($_POST['bbp_reply_id'])) {
        bbp_add_error('bbp_split_topic_reply_id', __('<strong>ERROR</strong>: Reply ID to split the topic from not found!', 'bbpress'));
    } else {
        $from_reply_id = (int) $_POST['bbp_reply_id'];
    }
    $from_reply = bbp_get_reply($from_reply_id);
    // Reply exists
    if (empty($from_reply)) {
        bbp_add_error('bbp_split_topic_r_not_found', __('<strong>ERROR</strong>: The reply you want to split from was not found.', 'bbpress'));
    }
    /** Topic to Split ********************************************************/
    // Get the topic being split
    $source_topic = bbp_get_topic($from_reply->post_parent);
    // No topic
    if (empty($source_topic)) {
        bbp_add_error('bbp_split_topic_source_not_found', __('<strong>ERROR</strong>: The topic you want to split was not found.', 'bbpress'));
    }
    // Nonce check failed
    if (!bbp_verify_nonce_request('bbp-split-topic_' . $source_topic->ID)) {
        bbp_add_error('bbp_split_topic_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
        return;
    }
    // Use cannot edit topic
    if (!current_user_can('edit_topic', $source_topic->ID)) {
        bbp_add_error('bbp_split_topic_source_permission', __('<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress'));
    }
    // How to Split
    if (!empty($_POST['bbp_topic_split_option'])) {
        $split_option = (string) trim($_POST['bbp_topic_split_option']);
    }
    // Invalid split option
    if (empty($split_option) || !in_array($split_option, array('existing', 'reply'))) {
        bbp_add_error('bbp_split_topic_option', __('<strong>ERROR</strong>: You need to choose a valid split option.', 'bbpress'));
        // Valid Split Option
    } else {
        // What kind of split
        switch ($split_option) {
            // Into an existing topic
            case 'existing':
                // Get destination topic id
                if (empty($_POST['bbp_destination_topic'])) {
                    bbp_add_error('bbp_split_topic_destination_id', __('<strong>ERROR</strong>: Destination topic ID not found!', 'bbpress'));
                } else {
                    $destination_topic_id = (int) $_POST['bbp_destination_topic'];
                }
                // Get the destination topic
                $destination_topic = bbp_get_topic($destination_topic_id);
                // No destination topic
//.........这里部分代码省略.........
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php


示例4: bbp_get_reply_spam_link

/**
 * Return the spam link of the reply
 *
 * @since bbPress (r2740)
 *
 * @param mixed $args This function supports these arguments:
 *  - id: Reply id
 *  - link_before: HTML before the link
 *  - link_after: HTML after the link
 *  - spam_text: Spam text
 *  - unspam_text: Unspam text
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses current_user_can() To check if the current user can edit the
 *                           reply
 * @uses bbp_is_reply_spam() To check if the reply is marked as spam
 * @uses add_query_arg() To add custom args to the url
 * @uses wp_nonce_url() To nonce the url
 * @uses esc_url() To escape the url
 * @uses bbp_get_reply_edit_url() To get the reply edit url
 * @uses apply_filters() Calls 'bbp_get_reply_spam_link' with the reply
 *                        spam link and args
 * @return string Reply spam link
 */
function bbp_get_reply_spam_link($args = '')
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('id' => 0, 'link_before' => '', 'link_after' => '', 'spam_text' => esc_html__('Spam', 'bbpress'), 'unspam_text' => esc_html__('Unspam', 'bbpress')), 'get_reply_spam_link');
    $reply = bbp_get_reply(bbp_get_reply_id((int) $r['id']));
    if (empty($reply) || !current_user_can('moderate', $reply->ID)) {
        return;
    }
    $display = bbp_is_reply_spam($reply->ID) ? $r['unspam_text'] : $r['spam_text'];
    $uri = add_query_arg(array('action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID));
    $uri = wp_nonce_url($uri, 'spam-reply_' . $reply->ID);
    $retval = $r['link_before'] . '<a href="' . esc_url($uri) . '" class="bbp-reply-spam-link">' . $display . '</a>' . $r['link_after'];
    return apply_filters('bbp_get_reply_spam_link', $retval, $r);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:38,代码来源:template.php


示例5: bbp_unspam_reply

/**
 * Unspams a reply
 *
 * @since bbPress (r2740)
 *
 * @param int $reply_id Reply id
 * @uses bbp_get_reply() To get the reply
 * @uses do_action() Calls 'bbp_unspam_reply' with the reply ID
 * @uses get_post_meta() To get the previous status meta
 * @uses delete_post_meta() To delete the previous status meta
 * @uses wp_update_post() To insert the updated post
 * @uses do_action() Calls 'bbp_unspammed_reply' with the reply ID
 * @return mixed False or {@link WP_Error} on failure, reply id on success
 */
function bbp_unspam_reply($reply_id = 0)
{
    // Get reply
    $reply = bbp_get_reply($reply_id);
    if (empty($reply)) {
        return $reply;
    }
    // Bail if already not spam
    if (bbp_get_spam_status_id() !== $reply->post_status) {
        return false;
    }
    // Execute pre unspam code
    do_action('bbp_unspam_reply', $reply_id);
    // Get pre spam status
    $reply->post_status = get_post_meta($reply_id, '_bbp_spam_meta_status', true);
    // If no previous status, default to publish
    if (empty($reply->post_status)) {
        $reply->post_status = bbp_get_public_status_id();
    }
    // Delete pre spam meta
    delete_post_meta($reply_id, '_bbp_spam_meta_status');
    // No revisions
    remove_action('pre_post_update', 'wp_save_post_revision');
    // Update the reply
    $reply_id = wp_update_post($reply);
    // Execute post unspam code
    do_action('bbp_unspammed_reply', $reply_id);
    // Return reply_id
    return $reply_id;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:44,代码来源:functions.php


示例6: bbp_get_reply_approve_link

/**
 * Return the approve link of the reply
 *
 * @since 2.6.0 bbPress (r5507)
 *
 * @param array $args This function supports these args:
 *  - id: Optional. Reply id
 *  - link_before: Before the link
 *  - link_after: After the link
 *  - sep: Separator between links
 *  - approve_text: Approve text
 *  - unapprove_text: Unapprove text
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses current_user_can() To check if the current user can approve the reply
 * @uses bbp_is_reply_pending() To check if the reply is pending
 * @uses add_query_arg() To add custom args to the url
 * @uses wp_nonce_url() To nonce the url
 * @uses esc_url() To escape the url
 * @uses apply_filters() Calls 'bbp_get_reply_approve_link' with the link
 *                        and args
 * @return string Reply approve link
 */
function bbp_get_reply_approve_link($args = array())
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('id' => 0, 'link_before' => '', 'link_after' => '', 'sep' => ' | ', 'approve_text' => _x('Approve', 'Pending Status', 'bbpress'), 'unapprove_text' => _x('Unapprove', 'Pending Status', 'bbpress')), 'get_reply_approve_link');
    $reply = bbp_get_reply($r['id']);
    if (empty($reply) || !current_user_can('moderate', $reply->ID)) {
        return;
    }
    $display = bbp_is_reply_pending($reply->ID) ? $r['approve_text'] : $r['unapprove_text'];
    $uri = add_query_arg(array('action' => 'bbp_toggle_reply_approve', 'reply_id' => $reply->ID));
    $uri = wp_nonce_url($uri, 'approve-reply_' . $reply->ID);
    $retval = $r['link_before'] . '<a href="' . esc_url($uri) . '" class="bbp-reply-approve-link">' . $display . '</a>' . $r['link_after'];
    return apply_filters('bbp_get_reply_approve_link', $retval, $r, $args);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:37,代码来源:template.php


示例7: widget


//.........这里部分代码省略.........
                                                    // Activity marked as hidden in site.
                                                    continue;
                                                }
                                            }
                                        }
                                        $title = trim(strip_tags($activity->content));
                                        $permalink = bp_activity_get_permalink($id);
                                    } else {
                                        if ('users' === $type) {
                                            $id = RatingWidgetPlugin::Urid2UserId($urid);
                                            if ($bpInstalled) {
                                                $title = trim(strip_tags(bp_core_get_user_displayname($id)));
                                                $permalink = bp_core_get_user_domain($id);
                                            } else {
                                                if ($bbInstalled) {
                                                    $title = trim(strip_tags(bbp_get_user_display_name($id)));
                                                    $permalink = bbp_get_user_profile_url($id);
                                                } else {
                                                    continue;
                                                }
                                            }
                                        } else {
                                            if ('forum_posts' === $type || 'forum_replies' === $type) {
                                                $id = RatingWidgetPlugin::Urid2ForumPostId($urid);
                                                if (function_exists('bp_forums_get_post')) {
                                                    $forum_post = @bp_forums_get_post($id);
                                                    if (!is_object($forum_post)) {
                                                        continue;
                                                    }
                                                    $title = trim(strip_tags($forum_post->post_text));
                                                    $page = bb_get_page_number($forum_post->post_position);
                                                    $permalink = get_topic_link($id, $page) . "#post-{$id}";
                                                } else {
                                                    if (function_exists('bbp_get_reply_id')) {
                                                        $forum_item = bbp_get_topic();
                                                        if (is_object($forum_item)) {
                                                            $is_topic = true;
                                                        } else {
                                                            $is_topic = false;
                                                            $forum_item = bbp_get_reply($id);
                                                            if (!is_object($forum_item)) {
                                                                if (RWLogger::IsOn()) {
                                                                    RWLogger::Log('BBP_FORUM_ITEM_NOT_EXIST', $id);
                                                                }
                                                                // Invalid id (no topic nor reply).
                                                                continue;
                                                            }
                                                            if (RWLogger::IsOn()) {
                                                                RWLogger::Log('BBP_IS_TOPIC_REPLY', $is_topic ? 'FALSE' : 'TRUE');
                                                            }
                                                        }
                                                        // Visible statueses: Public or Closed.
                                                        $visible_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
                                                        if (!in_array($forum_item->post_status, $visible_statuses)) {
                                                            if (RWLogger::IsOn()) {
                                                                RWLogger::Log('BBP_FORUM_ITEM_HIDDEN', $forum_item->post_status);
                                                            }
                                                            // Item is not public nor closed.
                                                            continue;
                                                        }
                                                        $is_reply = !$is_topic;
                                                        if ($is_reply) {
                                                            // Get parent topic.
                                                            $forum_topic = bbp_get_topic($forum_post->post_parent);
                                                            if (!in_array($forum_topic->post_status, $visible_statuses)) {
                                                                if (RWLogger::IsOn()) {
开发者ID:AlexOreshkevich,项目名称:velomode.by,代码行数:67,代码来源:rw-top-rated-widget.php


示例8: toggle_reply_notice_admin

    /**
     * Prints an admin notice when a reply has been (un)reported
     *
     * @since 1.0.0
     *
     * @return null
     */
    public function toggle_reply_notice_admin()
    {
        // Bail if we're not editing replies
        if (bbp_get_reply_post_type() != get_current_screen()->post_type) {
            return;
        }
        // Only proceed if GET is a reply toggle action
        if (bbp_is_get_request() && !empty($_GET['bbp_reply_toggle_notice']) && in_array($_GET['bbp_reply_toggle_notice'], array('unreported')) && !empty($_GET['reply_id'])) {
            $notice = $_GET['bbp_reply_toggle_notice'];
            // Which notice?
            $reply_id = (int) $_GET['reply_id'];
            // What's the reply id?
            $is_failure = !empty($_GET['failed']) ? true : false;
            // Was that a failure?
            // Bails if no reply_id or notice
            if (empty($notice) || empty($reply_id)) {
                return;
            }
            // Bail if reply is missing
            $reply = bbp_get_reply($reply_id);
            if (empty($reply)) {
                return;
            }
            $reply_title = bbp_get_reply_title($reply->ID);
            switch ($notice) {
                case 'unreported':
                    $message = $is_failure === true ? sprintf(__('There was a problem unreporting the reply "%1$s".', 'bbpress-report-content'), $reply_title) : sprintf(__('Reply "%1$s" successfully unreported.', 'bbpress-report-content'), $reply_title);
                    break;
            }
            ?>

			<div id="message" class="<?php 
            echo $is_failure === true ? 'error' : 'updated';
            ?>
 fade">
				<p style="line-height: 150%"><?php 
            echo esc_html($message);
            ?>
</p>
			</div>

			<?php 
        }
    }
开发者ID:richrd,项目名称:bbpress-report-content,代码行数:51,代码来源:class-bbpress-report-content.php


示例9: is_private

 /**
  * Determines if a reply is marked as private
  *
  * @since 1.0
  *
  * @param $reply_id int The ID of the reply
  *
  * @return bool
  */
 public function is_private($reply_id = 0)
 {
     $retval = false;
     // Checking a specific reply id
     if (!empty($reply_id)) {
         $reply = bbp_get_reply($reply_id);
         $reply_id = !empty($reply) ? $reply->ID : 0;
         // Using the global reply id
     } elseif (bbp_get_reply_id()) {
         $reply_id = bbp_get_reply_id();
         // Use the current post id
     } elseif (!bbp_get_reply_id()) {
         $reply_id = get_the_ID();
     }
     if (!empty($reply_id)) {
         $retval = get_post_meta($reply_id, '_bbp_reply_is_private', true);
     }
     return (bool) apply_filters('bbp_reply_is_private', (bool) $retval, $reply_id);
 }
开发者ID:KingYes,项目名称:bbPress-Private-replies,代码行数:28,代码来源:bbp-private-replies.php


示例10: AddBBPressTopLeftOrRightRating

 /**
  * Add bbPress top left & right ratings.
  * Invoked on bbp_theme_before_reply_admin_links.
  */
 public function AddBBPressTopLeftOrRightRating()
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence('AddBBPressTopLeftOrRightRating', $params);
     }
     $forum_item = bbp_get_reply(bbp_get_reply_id());
     $is_reply = is_object($forum_item);
     if (!$is_reply) {
         $forum_item = bbp_get_topic(bbp_get_topic_id());
     }
     $class = $is_reply ? 'forum-reply' : 'forum-post';
     if (RWLogger::IsOn()) {
         RWLogger::Log('AddBBPressTopLeftOrRightRating', $class . ': ' . var_export($forum_item, true));
     }
     $ratingHtml = $this->EmbedRatingIfVisibleByPost($forum_item, $class, false, 'f' . $this->forum_post_align->hor, 'display: inline; margin-' . ('left' === $this->forum_post_align->hor ? 'right' : 'left') . ': 10px;');
     echo $ratingHtml;
 }
开发者ID:robertoAg,项目名称:wordpress_humor,代码行数:22,代码来源:rating-widget.php


示例11: bbp_toggle_reply_handler

/**
 * Handles the front end spamming/unspamming and trashing/untrashing/deleting of
 * replies
 *
 * @since bbPress (r2740)
 *
 * @uses bbp_get_reply() To get the reply
 * @uses current_user_can() To check if the user is capable of editing or
 *                           deleting the reply
 * @uses check_ajax_referer() To verify the nonce and check the referer
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses bbp_is_reply_spam() To check if the reply is marked as spam
 * @uses bbp_spam_reply() To make the reply as spam
 * @uses bbp_unspam_reply() To unmark the reply as spam
 * @uses wp_trash_post() To trash the reply
 * @uses wp_untrash_post() To untrash the reply
 * @uses wp_delete_post() To delete the reply
 * @uses do_action() Calls 'bbp_toggle_reply_handler' with success, post data
 *                    and action
 * @uses bbp_get_reply_url() To get the reply url
 * @uses add_query_arg() To add custom args to the reply url
 * @uses wp_safe_redirect() To redirect to the reply
 * @uses bbPress::errors:add() To log the error messages
 */
function bbp_toggle_reply_handler()
{
    // Bail if not a GET action
    if ('GET' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if required GET actions aren't passed
    if (empty($_GET['reply_id']) || empty($_GET['action'])) {
        return;
    }
    // Setup possible get actions
    $possible_actions = array('bbp_toggle_reply_spam', 'bbp_toggle_reply_trash');
    // Bail if actions aren't meant for this function
    if (!in_array($_GET['action'], $possible_actions)) {
        return;
    }
    $failure = '';
    // Empty failure string
    $view_all = false;
    // Assume not viewing all
    $action = $_GET['action'];
    // What action is taking place?
    $reply_id = (int) $_GET['reply_id'];
    // What's the reply id?
    $success = false;
    // Flag
    $post_data = array('ID' => $reply_id);
    // Prelim array
    // Make sure reply exists
    $reply = bbp_get_reply($reply_id);
    if (empty($reply)) {
        return;
    }
    // What is the user doing here?
    if (!current_user_can('edit_reply', $reply->ID) || 'bbp_toggle_reply_trash' == $action && !current_user_can('delete_reply', $reply->ID)) {
        bbp_add_error('bbp_toggle_reply_permission', __('<strong>ERROR:</strong> You do not have the permission to do that!', 'bbpress'));
        return;
    }
    // What action are we trying to perform?
    switch ($action) {
        // Toggle spam
        case 'bbp_toggle_reply_spam':
            check_ajax_referer('spam-reply_' . $reply_id);
            $is_spam = bbp_is_reply_spam($reply_id);
            $success = $is_spam ? bbp_unspam_reply($reply_id) : bbp_spam_reply($reply_id);
            $failure = $is_spam ? __('<strong>ERROR</strong>: There was a problem unmarking the reply as spam!', 'bbpress') : __('<strong>ERROR</strong>: There was a problem marking the reply as spam!', 'bbpress');
            $view_all = !$is_spam;
            break;
            // Toggle trash
        // Toggle trash
        case 'bbp_toggle_reply_trash':
            $sub_action = in_array($_GET['sub_action'], array('trash', 'untrash', 'delete')) ? $_GET['sub_action'] : false;
            if (empty($sub_action)) {
                break;
            }
            switch ($sub_action) {
                case 'trash':
                    check_ajax_referer('trash-' . bbp_get_reply_post_type() . '_' . $reply_id);
                    $view_all = true;
                    $success = wp_trash_post($reply_id);
                    $failure = __('<strong>ERROR</strong>: There was a problem trashing the reply!', 'bbpress');
                    break;
                case 'untrash':
                    check_ajax_referer('untrash-' . bbp_get_reply_post_type() . '_' . $reply_id);
                    $success = wp_untrash_post($reply_id);
                    $failure = __('<strong>ERROR</strong>: There was a problem untrashing the reply!', 'bbpress');
                    break;
                case 'delete':
                    check_ajax_referer('delete-' . bbp_get_reply_post_type() . '_' . $reply_id);
                    $success = wp_delete_post($reply_id);
                    $failure = __('<strong>ERROR</strong>: There was a problem deleting the reply!', 'bbpress');
                    break;
            }
            break;
    }
    // Do additional reply toggle actions
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:functions.php


示例12: bbp_get_reply_spam_link

/**
 * Return the spam link of the reply
 *
 * @since bbPress (r2740)
 *
 * @param mixed $args This function supports these arguments:
 *  - id: Reply id
 *  - link_before: HTML before the link
 *  - link_after: HTML after the link
 *  - spam_text: Spam text
 *  - unspam_text: Unspam text
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses current_user_can() To check if the current user can edit the
 *                           reply
 * @uses bbp_is_reply_spam() To check if the reply is marked as spam
 * @uses add_query_arg() To add custom args to the url
 * @uses wp_nonce_url() To nonce the url
 * @uses esc_url() To escape the url
 * @uses bbp_get_reply_edit_url() To get the reply edit url
 * @uses apply_filters() Calls 'bbp_get_reply_spam_link' with the reply
 *                        spam link and args
 * @return string Reply spam link
 */
function bbp_get_reply_spam_link($args = '')
{
    $defaults = array('id' => 0, 'link_before' => '', 'link_after' => '', 'spam_text' => __('Spam', 'bbpress'), 'unspam_text' => __('Unspam', 'bbpress'));
    $r = bbp_parse_args($args, $defaults, 'get_reply_spam_link');
    extract($r);
    $reply = bbp_get_reply(bbp_get_reply_id((int) $id));
    if (empty($reply) || !current_user_can('moderate', $reply->ID)) {
        return;
    }
    $display = bbp_is_reply_spam($reply->ID) ? $unspam_text : $spam_text;
    $uri = add_query_arg(array('action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID));
    $uri = esc_url(wp_nonce_url($uri, 'spam-reply_' . $reply->ID));
    $retval = $link_before . '<a href="' . $uri . '">' . $display . '</a>' . $link_after;
    return apply_filters('bbp_get_reply_spam_link', $retval, $args);
}
开发者ID:hscale,项目名称:webento,代码行数:39,代码来源:template-tags.php


示例13: bbp_unapprove_reply

/**
 * Unapproves a reply
 *
 * @since 2.6.0 bbPress (r5506)
 *
 * @param int $reply_id Reply id
 * @uses bbp_get_reply() To get the reply
 * @uses bbp_get_pending_status_id() To get the pending status id
 * @uses do_action() Calls 'bbp_unapprove_reply' with the reply id
 * @uses remove_action() To remove the auto save post revision action
 * @uses wp_update_post() To update the reply with the new status
 * @uses do_action() Calls 'bbp_unapproved_reply' with the reply id
 * @return mixed False or {@link WP_Error} on failure, reply id on success
 */
function bbp_unapprove_reply($reply_id = 0)
{
    // Get reply
    $reply = bbp_get_reply($reply_id);
    if (empty($reply)) {
        return $reply;
    }
    // Bail if already pending
    if (bbp_get_pending_status_id() === $reply->post_status) {
        return false;
    }
    // Execute pre open code
    do_action('bbp_unapprove_reply', $reply_id);
    // Set pending status
    $reply->post_status = bbp_get_pending_status_id();
    // No revisions
    remove_action('pre_post_update', 'wp_save_post_revision');
    // Update reply
    $reply_id = wp_update_post($reply);
    // Execute post open code
    do_action('bbp_unapproved_reply', $reply_id);
    // Return reply_id
    return $reply_id;
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:38,代码来源:functions.php


示例14: likebtn_bbp_reply

function likebtn_bbp_reply($wrap = true, $position = LIKEBTN_POSITION_BOTH, $alignment = '', $content = '')
{
    // Reply to topic
    $entity = bbp_get_reply(bbp_get_reply_id());
    // Topic
    if (!is_object($entity)) {
        $entity = bbp_get_topic(bbp_get_topic_id());
    }
    if (!$entity) {
        return false;
    }
    return _likebtn_get_content_universal(LIKEBTN_ENTITY_BBP_POST, $entity->ID, $content, $wrap, $position, $alignment);
}
开发者ID:Omuze,项目名称:barakat,代码行数:13,代码来源:likebtn_like_button.php


示例15: get_object_by_id

 public function get_object_by_id($reply_id)
 {
     return bbp_get_reply($reply_id);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:4,代码来源:factory.php


示例16: likebtn_bbp_reply

function likebtn_bbp_reply($wrap = true, $position = LIKEBTN_POSITION_BOTH, $alignment = '', $content = '')
{
    // Reply to topic
    $entity = bbp_get_reply(bbp_get_reply_id());
    // Topic
    if (!is_object($entity)) {
        $entity = bbp_get_topic(bbp_get_topic_id());
    }
    if (!$entity) {
        return false;
    }
    // Allow in selected forums
    if (!empty($entity->post_parent)) {
        $allow_forums = get_option('likebtn_allow_forums_' . LIKEBTN_ENTITY_BBP_POST);
        if (!is_array($allow_forums)) {
            $allow_forums = array();
        }
        if ($allow_forums && !in_array($entity->post_parent, $allow_forums)) {
            return false;
        }
    }
    return _likebtn_get_content_universal(LIKEBTN_ENTITY_BBP_POST, $entity->ID, $content, $wrap, $position, $alignment);
}
开发者ID:pslorus,项目名称:WebsiteTinTuc,代码行数:23,代码来源:likebtn_like_button.php



注:本文中的bbp_get_reply函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bbp_get_reply_author_display_name函数代码示例发布时间:2022-05-24
下一篇:
PHP bbp_get_public_status_id函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap