本文整理汇总了PHP中bbp_is_topic_closed函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_topic_closed函数的具体用法?PHP bbp_is_topic_closed怎么用?PHP bbp_is_topic_closed使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_topic_closed函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_add_robots
function maybe_add_robots()
{
global $post;
if (is_singular() && bbp_is_topic($post->ID) && bbp_is_topic_closed($post->ID) && time() - get_post_time('U', true, $post) > YEAR_IN_SECONDS) {
echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
}
}
示例2: bbp_reply_form_fields
<?php
bbp_reply_form_fields();
?>
</fieldset>
<?php
do_action('bbp_theme_after_reply_form');
?>
</form>
</div>
<?php
} elseif (bbp_is_topic_closed()) {
?>
<div id="no-reply-<?php
bbp_topic_id();
?>
" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php
printf(esc_html__('The topic ‘%s’ is closed to new replies.', 'monsoon'), bbp_get_topic_title());
?>
</p>
</div>
</div>
<?php
示例3: bbp_is_topic_open
/**
* Is the topic open to new replies?
*
* @since 2.0.0 bbPress (r2727)
*
* @uses bbp_get_topic_status()
*
* @param int $topic_id Optional. Topic id
* @uses bbp_is_topic_closed() To check if the topic is closed
* @return bool True if open, false if closed.
*/
function bbp_is_topic_open($topic_id = 0)
{
return !bbp_is_topic_closed($topic_id);
}
示例4: bbp_new_reply_handler
//.........这里部分代码省略.........
// Filter and sanitize
$reply_content = apply_filters('bbp_new_reply_pre_content', $reply_content);
// No reply content
if (empty($reply_content)) {
bbp_add_error('bbp_reply_content', __('<strong>ERROR</strong>: Your reply cannot be empty.', 'bbpress'));
}
/** Reply Flooding ********************************************************/
if (!bbp_check_for_flood($anonymous_data, $reply_author)) {
bbp_add_error('bbp_reply_flood', __('<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress'));
}
/** Reply Duplicate *******************************************************/
if (!bbp_check_for_duplicate(array('post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data))) {
bbp_add_error('bbp_reply_duplicate', __('<strong>ERROR</strong>: Duplicate reply detected; it looks as though you’ve already said that!', 'bbpress'));
}
/** Reply Blacklist *******************************************************/
if (!bbp_check_for_blacklist($anonymous_data, $reply_author, $reply_title, $reply_content)) {
bbp_add_error('bbp_reply_blacklist', __('<strong>ERROR</strong>: Your reply cannot be created at this time.', 'bbpress'));
}
/** Reply Status **********************************************************/
// Maybe put into moderation
if (!bbp_check_for_moderation($anonymous_data, $reply_author, $reply_title, $reply_content)) {
$reply_status = bbp_get_pending_status_id();
// Default
} else {
$reply_status = bbp_get_public_status_id();
}
/** Reply To **************************************************************/
// Handle Reply To of the reply; $_REQUEST for non-JS submissions
if (isset($_REQUEST['bbp_reply_to'])) {
$reply_to = bbp_validate_reply_to($_REQUEST['bbp_reply_to']);
}
/** Topic Closed **********************************************************/
// If topic is closed, moderators can still reply
if (bbp_is_topic_closed($topic_id) && !current_user_can('moderate')) {
bbp_add_error('bbp_reply_topic_closed', __('<strong>ERROR</strong>: Topic is closed.', 'bbpress'));
}
/** Topic Tags ************************************************************/
// Either replace terms
if (bbp_allow_topic_tags() && current_user_can('assign_topic_tags') && !empty($_POST['bbp_topic_tags'])) {
$terms = esc_attr(strip_tags($_POST['bbp_topic_tags']));
// ...or remove them.
} elseif (isset($_POST['bbp_topic_tags'])) {
$terms = '';
// Existing terms
} else {
$terms = bbp_get_topic_tag_names($topic_id);
}
/** Additional Actions (Before Save) **************************************/
do_action('bbp_new_reply_pre_extras', $topic_id, $forum_id);
// Bail if errors
if (bbp_has_errors()) {
return;
}
/** No Errors *************************************************************/
// Add the content of the form to $reply_data as an array
// Just in time manipulation of reply data before being created
$reply_data = apply_filters('bbp_new_reply_pre_insert', array('post_author' => $reply_author, 'post_title' => $reply_title, 'post_content' => $reply_content, 'post_status' => $reply_status, 'post_parent' => $topic_id, 'post_type' => bbp_get_reply_post_type(), 'comment_status' => 'closed', 'menu_order' => bbp_get_topic_reply_count($topic_id, false) + 1));
// Insert reply
$reply_id = wp_insert_post($reply_data);
/** No Errors *************************************************************/
// Check for missing reply_id or error
if (!empty($reply_id) && !is_wp_error($reply_id)) {
/** Topic Tags ********************************************************/
// Just in time manipulation of reply terms before being edited
$terms = apply_filters('bbp_new_reply_pre_set_terms', $terms, $topic_id, $reply_id);
// Insert terms
示例5: bbp_user_can_comment
function bbp_user_can_comment()
{
return bbpresskr()->forum_option('use_comments') && bbp_current_user_can_access_create_reply_form() && !bbp_is_topic_closed() && !bbp_is_forum_closed();
}
示例6: aq_display_topic_status
/**
* Display Topic Status
* -------------------------------------------------------------------------------------------*/
function aq_display_topic_status($topic_id = 0)
{
$topic_id = $topic_id ? $topic_id : bbp_get_topic_id();
$statuses = array(1, 2, 3);
$status_id = get_post_meta($topic_id, '_bbps_topic_status', true);
echo '<div class="aq-topic-status">';
if (bbp_is_topic_sticky()) {
echo '<span class="sticky">Sticky</span>';
} elseif (in_array($status_id, $statuses)) {
if ($status_id == 1) {
echo '<span class="not-resolved">Not Resolved</span>';
}
if ($status_id == 2) {
echo '<span class="resolved">Resolved</span>';
}
if ($status_id == 3) {
echo '<span class="in-progress">In Progress</span>';
}
} elseif (bbp_is_topic_closed()) {
echo '<span class="sticky">Sticky</span>';
} else {
echo '<span class="in-progress">In Progress</span>';
}
echo '</div>';
}
示例7: do_action
</div>
<?php do_action( 'bbp_theme_after_reply_form_submit_wrapper' ); ?>
</div>
<?php bbp_reply_form_fields(); ?>
</fieldset>
<?php do_action( 'bbp_theme_after_reply_form' ); ?>
</form>
</div>
<?php elseif ( bbp_is_topic_closed() ) : ?>
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php printf( __( 'The topic ‘%s’ is closed to new replies.', 'bbpress' ), bbp_get_topic_title() ); ?></p>
</div>
</div>
<?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php printf( __( 'The forum ‘%s’ is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></p>
</div>
</div>
示例8: bbp_increase_forum_topic_count
/**
* Increase the total topic count of a forum by one.
*
* @since 2.6.0 bbPress (r6036)
*
* @param int $forum_id The forum id.
*
* @uses bbp_is_topic() To get the topic id
* @uses bbp_get_topic_forum_id() To get the topics forum id
* @uses bbp_is_topic_published() To get the topics published status
* @uses bbp_is_topic_closed() To get the topics closed status
* @uses bbp_increase_forum_topic_count_hidden() To increase the forums hidden
* topic count by 1
* @uses bbp_bump_forum_topic_count() To bump the forum topic count
*
* @return void
*/
function bbp_increase_forum_topic_count($forum_id = 0)
{
// Bail early if no id is passed.
if (empty($forum_id)) {
return;
}
// If it's a topic, get the forum id.
if (bbp_is_topic($forum_id)) {
$topic_id = $forum_id;
$forum_id = bbp_get_topic_forum_id($topic_id);
// If this is a new, unpublished, topic, increase hidden count and bail.
if ('bbp_new_topic' === current_filter() && (!bbp_is_topic_published($topic_id) && !bbp_is_topic_closed($topic_id))) {
bbp_increase_forum_topic_count_hidden($forum_id);
return;
}
}
bbp_bump_forum_topic_count($forum_id);
}