当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_is_anonymous函数代码示例

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


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

示例1: wp_sh_bbpress_filters

function wp_sh_bbpress_filters()
{
    global $wp_sh_setting_opt;
    // Load bbPress Highlight Button
    if ($wp_sh_setting_opt['bbpress_hl_bt_enable'] == 1) {
        include_once 'bbpress-highlight-button.php';
    }
    // Apply substitute filters when saved
    if (!current_user_can('unfiltered_html') && !bbp_is_anonymous() || $wp_sh_setting_opt['bbpress_hl_bt_guest'] == 1 && bbp_is_anonymous()) {
        remove_filter('bbp_new_topic_pre_content', 'wp_filter_kses');
        add_filter('bbp_new_topic_pre_content', 'wp_sh_wp_filter_kses');
        remove_filter('bbp_new_reply_pre_content', 'wp_filter_kses');
        add_filter('bbp_new_reply_pre_content', 'wp_sh_wp_filter_kses');
        remove_filter('bbp_edit_topic_pre_content', 'wp_filter_kses');
        add_filter('bbp_edit_topic_pre_content', 'wp_sh_wp_filter_kses');
        remove_filter('bbp_edit_reply_pre_content', 'wp_filter_kses');
        add_filter('bbp_edit_reply_pre_content', 'wp_sh_wp_filter_kses');
    }
    if (!($wp_sh_setting_opt['bbpress_hl_bt_guest'] == 0 && bbp_is_anonymous())) {
        // Escape to HTML entities when saved
        add_filter('bbp_new_topic_pre_content', 'wp_sh_escape_code', 1);
        add_filter('bbp_new_reply_pre_content', 'wp_sh_escape_code', 1);
        add_filter('bbp_edit_topic_pre_content', 'wp_sh_escape_code', 1);
        add_filter('bbp_edit_reply_pre_content', 'wp_sh_escape_code', 1);
        // Replaced marker with escaped <pre> when saved
        add_filter('bbp_new_topic_pre_content', 'wp_sh_replace_marker', 2);
        add_filter('bbp_new_reply_pre_content', 'wp_sh_replace_marker', 2);
        add_filter('bbp_edit_topic_pre_content', 'wp_sh_replace_marker', 2);
        add_filter('bbp_edit_reply_pre_content', 'wp_sh_replace_marker', 2);
    }
    // Apply substitute make_clickable filters
    if (has_filter('bbp_get_topic_content', 'make_clickable')) {
        remove_filter('bbp_get_topic_content', 'make_clickable', 9);
        add_filter('bbp_get_topic_content', 'wp_sh_make_clickable', 9);
    }
    if (has_filter('bbp_get_reply_content', 'make_clickable')) {
        remove_filter('bbp_get_reply_content', 'make_clickable', 9);
        add_filter('bbp_get_reply_content', 'wp_sh_make_clickable', 9);
    }
    // Escape to HTML entities when shown
    add_filter('bbp_get_topic_content', 'wp_sh_escape_code', 1);
    add_filter('bbp_get_reply_content', 'wp_sh_escape_code', 1);
    // Add extra "[]" into shortcode when shown
    add_filter('bbp_get_topic_content', 'wp_sh_add_extra_bracket', -1);
    add_filter('bbp_get_reply_content', 'wp_sh_add_extra_bracket', -1);
}
开发者ID:Paulf-999,项目名称:HollyFry.com,代码行数:46,代码来源:bbpress-highlight.php

示例2: disabled

" size="40" name="bbp_topic_tags" id="bbp_topic_tags" <?php 
        disabled(bbp_is_topic_spam());
        ?>
 />
						</p>

						<?php 
        do_action('bbp_theme_after_reply_form_tags');
        ?>

					<?php 
    }
    ?>

					<?php 
    if (bbp_is_subscriptions_active() && !bbp_is_anonymous() && (!bbp_is_reply_edit() || bbp_is_reply_edit() && !bbp_is_reply_anonymous())) {
        ?>

						<?php 
        do_action('bbp_theme_before_reply_form_subscription');
        ?>

						<p>

							<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php 
        bbp_form_topic_subscribed();
        ?>
 tabindex="<?php 
        bbp_tab_index();
        ?>
" />
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:31,代码来源:form-reply.php

示例3: bbp_form_topic_status_dropdown

							<?php 
        bbp_form_topic_status_dropdown();
        ?>

						</p>

						<?php 
        do_action('bbp_theme_after_topic_form_status');
        ?>

					<?php 
    }
    ?>

					<?php 
    if (bbp_is_subscriptions_active() && !bbp_is_anonymous() && (!bbp_is_topic_edit() || bbp_is_topic_edit() && !bbp_is_topic_anonymous())) {
        ?>

						<?php 
        do_action('bbp_theme_before_topic_form_subscriptions');
        ?>

						<p>
							<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php 
        bbp_form_topic_subscribed();
        ?>
 tabindex="<?php 
        bbp_tab_index();
        ?>
" />
开发者ID:severnrescue,项目名称:web,代码行数:30,代码来源:form-topic.php

示例4: bbp_new_topic_handler

/**
 * Handles the front end topic submission
 *
 * @param string $action The requested action to compare this function to
 * @uses bbp_add_error() To add an error message
 * @uses bbp_verify_nonce_request() To verify the nonce and check the referer
 * @uses bbp_is_anonymous() To check if an anonymous post is being made
 * @uses current_user_can() To check if the current user can publish topic
 * @uses bbp_get_current_user_id() To get the current user id
 * @uses bbp_filter_anonymous_post_data() To filter anonymous data
 * @uses bbp_set_current_anonymous_user_data() To set the anonymous user cookies
 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
 * @uses esc_attr() For sanitization
 * @uses bbp_is_forum_category() To check if the forum is a category
 * @uses bbp_is_forum_closed() To check if the forum is closed
 * @uses bbp_is_forum_private() To check if the forum is private
 * @uses bbp_check_for_flood() To check for flooding
 * @uses bbp_check_for_duplicate() To check for duplicates
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses remove_filter() To remove kses filters if needed
 * @uses apply_filters() Calls 'bbp_new_topic_pre_title' with the content
 * @uses apply_filters() Calls 'bbp_new_topic_pre_content' with the content
 * @uses bbPress::errors::get_error_codes() To get the {@link WP_Error} errors
 * @uses wp_insert_post() To insert the topic
 * @uses do_action() Calls 'bbp_new_topic' with the topic id, forum id,
 *                    anonymous data and reply author
 * @uses bbp_stick_topic() To stick or super stick the topic
 * @uses bbp_unstick_topic() To unstick the topic
 * @uses bbp_get_topic_permalink() To get the topic permalink
 * @uses wp_safe_redirect() To redirect to the topic link
 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error
 *                                              messages
 */
function bbp_new_topic_handler($action = '')
{
    // Bail if action is not bbp-new-topic
    if ('bbp-new-topic' !== $action) {
        return;
    }
    // Nonce check
    if (!bbp_verify_nonce_request('bbp-new-topic')) {
        bbp_add_error('bbp_new_topic_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
        return;
    }
    // Define local variable(s)
    $view_all = false;
    $forum_id = $topic_author = $anonymous_data = 0;
    $topic_title = $topic_content = '';
    $terms = array(bbp_get_topic_tag_tax_id() => array());
    /** Topic Author **********************************************************/
    // User is anonymous
    if (bbp_is_anonymous()) {
        // Filter anonymous data
        $anonymous_data = bbp_filter_anonymous_post_data();
        // Anonymous data checks out, so set cookies, etc...
        if (!empty($anonymous_data) && is_array($anonymous_data)) {
            bbp_set_current_anonymous_user_data($anonymous_data);
        }
        // User is logged in
    } else {
        // User cannot create topics
        if (!current_user_can('publish_topics')) {
            bbp_add_error('bbp_topic_permissions', __('<strong>ERROR</strong>: You do not have permission to create new topics.', 'bbpress'));
            return;
        }
        // Topic author is current user
        $topic_author = bbp_get_current_user_id();
    }
    // Remove kses filters from title and content for capable users and if the nonce is verified
    if (current_user_can('unfiltered_html') && !empty($_POST['_bbp_unfiltered_html_topic']) && wp_create_nonce('bbp-unfiltered-html-topic_new') === $_POST['_bbp_unfiltered_html_topic']) {
        remove_filter('bbp_new_topic_pre_title', 'wp_filter_kses');
        remove_filter('bbp_new_topic_pre_content', 'bbp_encode_bad', 10);
        remove_filter('bbp_new_topic_pre_content', 'bbp_filter_kses', 30);
    }
    /** Topic Title ***********************************************************/
    if (!empty($_POST['bbp_topic_title'])) {
        $topic_title = esc_attr(strip_tags($_POST['bbp_topic_title']));
    }
    // Filter and sanitize
    $topic_title = apply_filters('bbp_new_topic_pre_title', $topic_title);
    // No topic title
    if (empty($topic_title)) {
        bbp_add_error('bbp_topic_title', __('<strong>ERROR</strong>: Your topic needs a title.', 'bbpress'));
    }
    /** Topic Content *********************************************************/
    if (!empty($_POST['bbp_topic_content'])) {
        $topic_content = $_POST['bbp_topic_content'];
    }
    // Filter and sanitize
    $topic_content = apply_filters('bbp_new_topic_pre_content', $topic_content);
    // No topic content
    if (empty($topic_content)) {
        bbp_add_error('bbp_topic_content', __('<strong>ERROR</strong>: Your topic cannot be empty.', 'bbpress'));
    }
    /** Topic Forum ***********************************************************/
    // Error check the POST'ed topic id
    if (isset($_POST['bbp_forum_id'])) {
        // Empty Forum id was passed
        if (empty($_POST['bbp_forum_id'])) {
            bbp_add_error('bbp_topic_forum_id', __('<strong>ERROR</strong>: Forum ID is missing.', 'bbpress'));
//.........这里部分代码省略.........
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php

示例5: bbp_new_reply_handler

/**
 * Handles the front end reply submission
 *
 * @since bbPress (r2574)
 *
 * @param string $action The requested action to compare this function to
 * @uses bbp_add_error() To add an error message
 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
 * @uses bbp_is_anonymous() To check if an anonymous post is being made
 * @uses current_user_can() To check if the current user can publish replies
 * @uses bbp_get_current_user_id() To get the current user id
 * @uses bbp_filter_anonymous_post_data() To filter anonymous data
 * @uses bbp_set_current_anonymous_user_data() To set the anonymous user
 *                                                cookies
 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
 * @uses remove_filter() To remove kses filters if needed
 * @uses esc_attr() For sanitization
 * @uses bbp_check_for_flood() To check for flooding
 * @uses bbp_check_for_duplicate() To check for duplicates
 * @uses apply_filters() Calls 'bbp_new_reply_pre_title' with the title
 * @uses apply_filters() Calls 'bbp_new_reply_pre_content' with the content
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses wp_set_post_terms() To set the topic tags
 * @uses wp_insert_post() To insert the reply
 * @uses do_action() Calls 'bbp_new_reply' with the reply id, topic id, forum
 *                    id, anonymous data, reply author, edit (false), and
 *                    the reply to id
 * @uses bbp_get_reply_url() To get the paginated url to the reply
 * @uses wp_safe_redirect() To redirect to the reply url
 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
 *                                              message
 */
function bbp_new_reply_handler($action = '')
{
    // Bail if action is not bbp-new-reply
    if ('bbp-new-reply' !== $action) {
        return;
    }
    // Nonce check
    if (!bbp_verify_nonce_request('bbp-new-reply')) {
        bbp_add_error('bbp_new_reply_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
        return;
    }
    // Define local variable(s)
    $topic_id = $forum_id = $reply_author = $anonymous_data = $reply_to = 0;
    $reply_title = $reply_content = $terms = '';
    /** Reply Author **********************************************************/
    // User is anonymous
    if (bbp_is_anonymous()) {
        // Filter anonymous data
        $anonymous_data = bbp_filter_anonymous_post_data();
        // Anonymous data checks out, so set cookies, etc...
        if (!empty($anonymous_data) && is_array($anonymous_data)) {
            bbp_set_current_anonymous_user_data($anonymous_data);
        }
        // User is logged in
    } else {
        // User cannot create replies
        if (!current_user_can('publish_replies')) {
            bbp_add_error('bbp_reply_permissions', __('<strong>ERROR</strong>: You do not have permission to reply.', 'bbpress'));
        }
        // Reply author is current user
        $reply_author = bbp_get_current_user_id();
    }
    /** Topic ID **************************************************************/
    // Topic id was not passed
    if (empty($_POST['bbp_topic_id'])) {
        bbp_add_error('bbp_reply_topic_id', __('<strong>ERROR</strong>: Topic ID is missing.', 'bbpress'));
        // Topic id is not a number
    } elseif (!is_numeric($_POST['bbp_topic_id'])) {
        bbp_add_error('bbp_reply_topic_id', __('<strong>ERROR</strong>: Topic ID must be a number.', 'bbpress'));
        // Topic id might be valid
    } else {
        // Get the topic id
        $posted_topic_id = intval($_POST['bbp_topic_id']);
        // Topic id is a negative number
        if (0 > $posted_topic_id) {
            bbp_add_error('bbp_reply_topic_id', __('<strong>ERROR</strong>: Topic ID cannot be a negative number.', 'bbpress'));
            // Topic does not exist
        } elseif (!bbp_get_topic($posted_topic_id)) {
            bbp_add_error('bbp_reply_topic_id', __('<strong>ERROR</strong>: Topic does not exist.', 'bbpress'));
            // Use the POST'ed topic id
        } else {
            $topic_id = $posted_topic_id;
        }
    }
    /** Forum ID **************************************************************/
    // Try to use the forum id of the topic
    if (!isset($_POST['bbp_forum_id']) && !empty($topic_id)) {
        $forum_id = bbp_get_topic_forum_id($topic_id);
        // Error check the POST'ed forum id
    } elseif (isset($_POST['bbp_forum_id'])) {
        // Empty Forum id was passed
        if (empty($_POST['bbp_forum_id'])) {
            bbp_add_error('bbp_reply_forum_id', __('<strong>ERROR</strong>: Forum ID is missing.', 'bbpress'));
            // Forum id is not a number
        } elseif (!is_numeric($_POST['bbp_forum_id'])) {
            bbp_add_error('bbp_reply_forum_id', __('<strong>ERROR</strong>: Forum ID must be a number.', 'bbpress'));
            // Forum id might be valid
        } else {
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:functions.php

示例6: wp_sh_allow_tags_in_bbpress

 function wp_sh_allow_tags_in_bbpress()
 {
     global $wp_sh_setting_opt;
     if ($wp_sh_setting_opt['bbpress_hl_bt_guest'] == 1 && bbp_is_anonymous() || !bbp_is_anonymous()) {
         $bbp_root = get_option('_bbp_root_slug');
         if (get_option('_bbp_include_root') == true) {
             $bbp_forum = "/" . get_option('_bbp_root_slug') . "/" . get_option('_bbp_forum_slug') . "/";
             $bbp_topic = "/" . get_option('_bbp_root_slug') . "/" . get_option('_bbp_topic_slug') . "/";
             $bbp_reply = "/" . get_option('_bbp_root_slug') . "/" . get_option('_bbp_reply_slug') . "/";
         } else {
             $bbp_forum = "/" . get_option('_bbp_forum_slug') . "/";
             $bbp_topic = "/" . get_option('_bbp_topic_slug') . "/";
             $bbp_reply = "/" . get_option('_bbp_reply_slug') . "/";
         }
         if (strpos($_SERVER['REQUEST_URI'], '?post_type=forum') || strpos($_SERVER['REQUEST_URI'], '?forum=') || strpos($_SERVER['REQUEST_URI'], '?topic=') || strpos($_SERVER['REQUEST_URI'], '?reply=') || strpos($_SERVER['REQUEST_URI'], $bbp_root) || strpos($_SERVER['REQUEST_URI'], $bbp_forum) || strpos($_SERVER['REQUEST_URI'], $bbp_topic) || strpos($_SERVER['REQUEST_URI'], $bbp_reply)) {
             add_filter('bbp_get_allowed_tags', 'wp_sh_allow_tags_and_attribs');
             bbp_get_allowed_tags();
             if (!current_user_can('unfiltered_html')) {
                 wp_sh_allow_posttags_and_attribs();
             }
         }
     }
 }
开发者ID:Paulf-999,项目名称:HollyFry.com,代码行数:23,代码来源:wp-syntaxhighlighter.php

示例7: bbp_current_user_can_access_anonymous_user_form

/**
 * Performs a series of checks to ensure the current user should see the
 * anonymous user form fields.
 *
 * @since 2.5.0 bbPress (r5119)
 *
 * @uses bbp_is_anonymous()
 * @uses bbp_is_topic_edit()
 * @uses bbp_is_topic_anonymous()
 * @uses bbp_is_reply_edit()
 * @uses bbp_is_reply_anonymous()
 *
 * @return bool
 */
function bbp_current_user_can_access_anonymous_user_form()
{
    // Users need to earn access
    $retval = false;
    // User is not logged in, and anonymous posting is allowed
    if (bbp_is_anonymous()) {
        $retval = true;
        // User is editing a topic, and topic is authored by anonymous user
    } elseif (bbp_is_topic_edit() && bbp_is_topic_anonymous()) {
        $retval = true;
        // User is editing a reply, and reply is authored by anonymous user
    } elseif (bbp_is_reply_edit() && bbp_is_reply_anonymous()) {
        $retval = true;
    }
    // Allow access to be filtered
    return (bool) apply_filters('bbp_current_user_can_access_anonymous_user_form', (bool) $retval);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:31,代码来源:template.php

示例8:

<?php

/**
 * Anonymous User
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<?php 
if (bbp_is_anonymous() || bbp_is_topic_edit() && bbp_is_topic_anonymous() || bbp_is_reply_edit() && bbp_is_reply_anonymous()) {
    ?>

	<?php 
    do_action('bbp_theme_before_anonymous_form');
    ?>

	<fieldset class="bbp-form">
		<legend><?php 
    bbp_is_topic_edit() || bbp_is_reply_edit() ? _e('Author Information', 'bbpress') : _e('Your information:', 'bbpress');
    ?>
</legend>

		<?php 
    do_action('bbp_theme_anonymous_form_extras_top');
    ?>

		<p>
			<label for="bbp_anonymous_author"><?php 
    _e('Name (required):', 'bbpress');
开发者ID:kanawanzx,项目名称:support_forum,代码行数:31,代码来源:form-anonymous.php

示例9: add_action

<?php

/*
BBpress Highlight Button
by Redcocker
Last modified: 2011/12/14
License: GPL v2
http://www.near-mint.com/blog/
*/
// Load style sheet
if ($wp_sh_setting_opt['bbpress_hl_stylesheet_enable'] == "1" && !($wp_sh_setting_opt['bbpress_hl_bt_guest'] == 0 && bbp_is_anonymous())) {
    add_action('bbp_head', 'bbpress_hl_load_style');
}
// Load script
if (!($wp_sh_setting_opt['bbpress_hl_bt_guest'] == 0 && bbp_is_anonymous())) {
    add_action('bbp_enqueue_scripts', 'bbpress_hl_load_jscript');
    // Add description and buttons to inset <pre> tag
    add_action('bbp_theme_before_topic_form_content', 'bbpress_hl_add_buttons');
    add_action('bbp_theme_before_reply_form_content', 'bbpress_hl_add_buttons');
}
function bbpress_hl_load_style()
{
    if (bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
        $wp_sh_bbpress_hl_stylesheet = wp_sh_valid_css(stripslashes(get_option('wp_sh_bbpress_hl_stylesheet')));
        if ($wp_sh_bbpress_hl_stylesheet == "invalid") {
            $wp_sh_bbpress_hl_stylesheet = "";
        }
        echo "\n<!-- bbpress Highlight Button CSS Begin -->\n";
        echo "<style type='text/css'>\n" . $wp_sh_bbpress_hl_stylesheet . "\n</style>\n";
        echo "<!-- bbpress Highlight Button CSS End -->\n";
    }
开发者ID:Paulf-999,项目名称:HollyFry.com,代码行数:31,代码来源:bbpress-highlight-button.php

示例10: bbp_new_reply_handler

/**
 * Handles the front end reply submission
 *
 * @since bbPress (r2574)
 *
 * @uses bbp_add_error() To add an error message
 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
 * @uses bbp_is_anonymous() To check if an anonymous post is being made
 * @uses current_user_can() To check if the current user can publish replies
 * @uses bbp_get_current_user_id() To get the current user id
 * @uses bbp_filter_anonymous_post_data() To filter anonymous data
 * @uses bbp_set_current_anonymous_user_data() To set the anonymous user
 *                                                cookies
 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
 * @uses remove_filter() To remove 'wp_filter_kses' filters if needed
 * @uses esc_attr() For sanitization
 * @uses bbp_check_for_flood() To check for flooding
 * @uses bbp_check_for_duplicate() To check for duplicates
 * @uses apply_filters() Calls 'bbp_new_reply_pre_title' with the title
 * @uses apply_filters() Calls 'bbp_new_reply_pre_content' with the content
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses wp_set_post_terms() To set the topic tags
 * @uses wp_insert_post() To insert the reply
 * @uses do_action() Calls 'bbp_new_reply' with the reply id, topic id, forum
 *                    id, anonymous data and reply author
 * @uses bbp_get_reply_url() To get the paginated url to the reply
 * @uses wp_safe_redirect() To redirect to the reply url
 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
 *                                              message
 */
function bbp_new_reply_handler()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if action is not bbp-new-reply
    if (empty($_POST['action']) || 'bbp-new-reply' !== $_POST['action']) {
        return;
    }
    // Nonce check
    if (!bbp_verify_nonce_request('bbp-new-reply')) {
        bbp_add_error('bbp_rew_reply_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
        return;
    }
    // Define local variable(s)
    $topic_id = $forum_id = $reply_author = $anonymous_data = 0;
    $reply_title = $reply_content = $terms = '';
    /** Reply Author **********************************************************/
    // User is anonymous
    if (bbp_is_anonymous()) {
        // Filter anonymous data
        $anonymous_data = bbp_filter_anonymous_post_data();
        // Anonymous data checks out, so set cookies, etc...
        if (!empty($anonymous_data) && is_array($anonymous_data)) {
            bbp_set_current_anonymous_user_data($anonymous_data);
        }
        // User is logged in
    } else {
        // User cannot create replies
        if (!current_user_can('publish_replies')) {
            bbp_add_error('bbp_reply_permissions', __('<strong>ERROR</strong>: You do not have permission to reply.', 'bbpress'));
        }
        // Reply author is current user
        $reply_author = bbp_get_current_user_id();
    }
    /** Topic ID **************************************************************/
    // Handle Topic ID to append reply to
    if (isset($_POST['bbp_topic_id'])) {
        $topic_id = (int) $_POST['bbp_topic_id'];
    } else {
        bbp_add_error('bbp_reply_topic_id', __('<strong>ERROR</strong>: Topic ID is missing.', 'bbpress'));
    }
    /** Forum ID **************************************************************/
    // Handle Forum ID to adjust counts of
    if (isset($_POST['bbp_forum_id'])) {
        $forum_id = (int) $_POST['bbp_forum_id'];
    } elseif (!empty($topic_id)) {
        $forum_id = bbp_get_topic_forum_id($topic_id);
    } else {
        bbp_add_error('bbp_reply_forum_id', __('<strong>ERROR</strong>: Forum ID is missing.', 'bbpress'));
    }
    /** Unfiltered HTML *******************************************************/
    // Remove wp_filter_kses filters from title and content for capable users and if the nonce is verified
    if (current_user_can('unfiltered_html') && !empty($_POST['_bbp_unfiltered_html_reply']) && wp_create_nonce('bbp-unfiltered-html-reply_' . $topic_id) == $_POST['_bbp_unfiltered_html_reply']) {
        remove_filter('bbp_new_reply_pre_title', 'wp_filter_kses');
        remove_filter('bbp_new_reply_pre_content', 'wp_filter_kses');
    }
    /** Reply Title ***********************************************************/
    if (!empty($_POST['bbp_reply_title'])) {
        $reply_title = esc_attr(strip_tags($_POST['bbp_reply_title']));
    }
    // Filter and sanitize
    $reply_title = apply_filters('bbp_new_reply_pre_title', $reply_title);
    // No reply title
    if (empty($reply_title)) {
        bbp_add_error('bbp_reply_title', __('<strong>ERROR</strong>: Your reply needs a title.', 'bbpress'));
    }
    /** Reply Content *********************************************************/
    if (!empty($_POST['bbp_reply_content'])) {
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:bbp-reply-functions.php


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