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

PHP bbp_is_topic函数代码示例

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

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



在下文中一共展示了bbp_is_topic函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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";
     }
 }
开发者ID:jmdodd,项目名称:old-robots,代码行数:7,代码来源:old-robots.php


示例2: pmpro_bbp_is_forum

 function pmpro_bbp_is_forum($forum_id = NULL)
 {
     global $post;
     if (bbp_is_forum($post->ID)) {
         if (!empty($forum_id) && $post->ID == $forum_id) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } elseif (bbp_is_topic($post->ID)) {
         if (!empty($forum_id) && $post->post_parent == $forum_id) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } elseif (bbp_is_reply($post->ID)) {
         if (!empty($forum_id) && in_array($forum_id, $post->ancestors)) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:functions.php


示例3: bbp_get_author_link

/**
 * Return the author link of the post
 *
 * @since 2.0.0 bbPress (r2875)
 *
 * @param array $args Optional. If an integer, it is used as reply id.
 * @uses bbp_is_topic() To check if it's a topic page
 * @uses bbp_get_topic_author_link() To get the topic author link
 * @uses bbp_is_reply() To check if it's a reply page
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses get_post_field() To get the post author
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses get_the_author_meta() To get the author name
 * @uses bbp_get_user_profile_url() To get the author profile url
 * @uses get_avatar() To get the author avatar
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_author_link($args = array())
{
    $post_id = is_numeric($args) ? (int) $args : 0;
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => $post_id, 'link_title' => '', 'type' => 'both', 'size' => 80), 'get_author_link');
    // Confirmed topic
    if (bbp_is_topic($r['post_id'])) {
        return bbp_get_topic_author_link($r);
        // Confirmed reply
    } elseif (bbp_is_reply($r['post_id'])) {
        return bbp_get_reply_author_link($r);
    }
    // Get the post author and proceed
    $user_id = get_post_field('post_author', $r['post_id']);
    // Neither a reply nor a topic, so could be a revision
    if (!empty($r['post_id'])) {
        // Generate title with the display name of the author
        if (empty($r['link_title'])) {
            $r['link_title'] = sprintf(!bbp_is_reply_anonymous($r['post_id']) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), get_the_author_meta('display_name', $user_id));
        }
        // Assemble some link bits
        $link_title = !empty($r['link_title']) ? ' title="' . esc_attr($r['link_title']) . '"' : '';
        $anonymous = bbp_is_reply_anonymous($r['post_id']);
        // Declare empty array
        $author_links = array();
        // Get avatar
        if ('avatar' === $r['type'] || 'both' === $r['type']) {
            $author_links[] = get_avatar($user_id, $r['size']);
        }
        // Get display name
        if ('name' === $r['type'] || 'both' === $r['type']) {
            $author_links[] = esc_html(get_the_author_meta('display_name', $user_id));
        }
        // Add links if not anonymous
        if (empty($anonymous) && bbp_user_has_profile($user_id)) {
            $author_url = bbp_get_user_profile_url($user_id);
            foreach ($author_links as $link_text) {
                $author_link[] = sprintf('<a href="%1$s"%2$s>%3$s</a>', esc_url($author_url), $link_title, $link_text);
            }
            $author_link = implode('&nbsp;', $author_link);
            // No links if anonymous
        } else {
            $author_link = implode('&nbsp;', $author_links);
        }
        // No post so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_author_link', $author_link, $r);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:70,代码来源:template.php


示例4: output_reply_notice

 /**
  * Ouput a notice on the front end when a reply has been reported
  *
  * @return null
  */
 public function output_reply_notice()
 {
     global $post;
     $reply_id = get_the_ID();
     // If post is a topic, return. (handled with 'output_topic_notice')
     if (bbp_is_topic($reply_id)) {
         return;
     }
     if (!$this->is_reply_reported($reply_id)) {
         return;
     }
     echo '<div class="error bbp-rc-reply-is-reported">';
     echo '<p>';
     echo apply_filters('bbp_rc_reply_notice', __('<em>This reply has been reported for inappropriate content.</em>', 'bbpress-report-content'));
     echo '</p>';
     echo '</div>';
 }
开发者ID:richrd,项目名称:bbpress-report-content,代码行数:22,代码来源:class-bbpress-report-content.php


示例5: get_post_ID

 /**
  * Get the Post ID
  * Added support for sale of bbPress items.
  * @since 1.3.3.2
  * @version 1.0
  */
 public function get_post_ID()
 {
     $post_id = $bbp_topic_id = $bbp_reply_id = 0;
     if (function_exists('bbpress')) {
         global $wp_query;
         $bbp = bbpress();
         // Currently inside a topic loop
         if (!empty($bbp->topic_query->in_the_loop) && isset($bbp->topic_query->post->ID)) {
             $bbp_topic_id = $bbp->topic_query->post->ID;
         } elseif (!empty($bbp->search_query->in_the_loop) && isset($bbp->search_query->post->ID) && bbp_is_topic($bbp->search_query->post->ID)) {
             $bbp_topic_id = $bbp->search_query->post->ID;
         } elseif ((bbp_is_single_topic() || bbp_is_topic_edit()) && !empty($bbp->current_topic_id)) {
             $bbp_topic_id = $bbp->current_topic_id;
         } elseif ((bbp_is_single_topic() || bbp_is_topic_edit()) && isset($wp_query->post->ID)) {
             $bbp_topic_id = $wp_query->post->ID;
         }
         // So far, no topic found, check if we are in a reply
         if ($bbp_topic_id == 0) {
             // Currently inside a replies loop
             if (!empty($bbp->reply_query->in_the_loop) && isset($bbp->reply_query->post->ID)) {
                 $bbp_reply_id = $bbp->reply_query->post->ID;
             } elseif (!empty($bbp->search_query->in_the_loop) && isset($bbp->search_query->post->ID) && bbp_is_reply($bbp->search_query->post->ID)) {
                 $bbp_reply_id = $bbp->search_query->post->ID;
             } elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && !empty($bbp->current_reply_id)) {
                 $bbp_reply_id = $bbp->current_reply_id;
             } elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && isset($wp_query->post->ID)) {
                 $bbp_reply_id = $wp_query->post->ID;
             }
             if ($bbp_reply_id != 0) {
                 $post_id = $bbp_reply_id;
             }
         } else {
             $post_id = $bbp_topic_id;
         }
     }
     if ($post_id == 0 && isset($GLOBALS['post'])) {
         $post_id = $GLOBALS['post']->ID;
     }
     return apply_filters('mycred_sell_this_get_post_ID', $post_id, $this);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:46,代码来源:myCRED-addon-sell-content.php


示例6: bbp_untrashed_topic

/**
 * Called after untrashing a topic
 *
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_topic() To check if the passed id is a topic
 * @uses do_action() Calls 'bbp_untrashed_topic' with the topic id
 */
function bbp_untrashed_topic($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    if (empty($topic_id) || !bbp_is_topic($topic_id)) {
        return false;
    }
    do_action('bbp_untrashed_topic', $topic_id);
}
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:15,代码来源:functions.php


示例7: bbp_get_reply_admin_links

/**
 * Return admin links for reply
 *
 * @since bbPress (r2667)
 *
 * @param array $args This function supports these arguments:
 *  - id: Optional. Reply id
 *  - before: HTML before the links. Defaults to
 *             '<span class="bbp-admin-links">'
 *  - after: HTML after the links. Defaults to '</span>'
 *  - sep: Separator. Defaults to ' | '
 *  - links: Array of the links to display. By default, edit, trash,
 *            spam, reply move, and topic split links are displayed
 * @uses bbp_is_topic() To check if it's the topic page
 * @uses bbp_is_reply() To check if it's the reply page
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_edit_link() To get the reply edit link
 * @uses bbp_get_reply_trash_link() To get the reply trash link
 * @uses bbp_get_reply_spam_link() To get the reply spam link
 * @uses bbp_get_reply_move_link() To get the reply move link
 * @uses bbp_get_topic_split_link() To get the topic split link
 * @uses current_user_can() To check if the current user can edit or
 *                           delete the reply
 * @uses apply_filters() Calls 'bbp_get_reply_admin_links' with the
 *                        reply admin links and args
 * @return string Reply admin links
 */
function bbp_get_reply_admin_links($args = array())
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('id' => 0, 'before' => '<span class="bbp-admin-links">', 'after' => '</span>', 'sep' => ' | ', 'links' => array()), 'get_reply_admin_links');
    $r['id'] = bbp_get_reply_id((int) $r['id']);
    // If post is a topic, return the topic admin links instead
    if (bbp_is_topic($r['id'])) {
        return bbp_get_topic_admin_links($args);
    }
    // If post is not a reply, return
    if (!bbp_is_reply($r['id'])) {
        return;
    }
    // If topic is trashed, do not show admin links
    if (bbp_is_topic_trash(bbp_get_reply_topic_id($r['id']))) {
        return;
    }
    // If no links were passed, default to the standard
    if (empty($r['links'])) {
        $r['links'] = apply_filters('bbp_reply_admin_links', array('edit' => bbp_get_reply_edit_link($r), 'move' => bbp_get_reply_move_link($r), 'split' => bbp_get_topic_split_link($r), 'trash' => bbp_get_reply_trash_link($r), 'spam' => bbp_get_reply_spam_link($r), 'reply' => bbp_get_reply_to_link($r)), $r['id']);
    }
    // See if links need to be unset
    $reply_status = bbp_get_reply_status($r['id']);
    if (in_array($reply_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()))) {
        // Spam link shouldn't be visible on trashed topics
        if (bbp_get_trash_status_id() === $reply_status) {
            unset($r['links']['spam']);
            // Trash link shouldn't be visible on spam topics
        } elseif (bbp_get_spam_status_id() === $reply_status) {
            unset($r['links']['trash']);
        }
    }
    // Process the admin links
    $links = implode($r['sep'], array_filter($r['links']));
    $retval = $r['before'] . $links . $r['after'];
    return apply_filters('bbp_get_reply_admin_links', $retval, $r, $args);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:64,代码来源:template.php


示例8: bbp_update_reply_walker

/**
 * Walk up the ancestor tree from the current reply, and update all the counts
 *
 * @since bbPress (r2884)
 *
 * @param int $reply_id Optional. Reply id
 * @param string $last_active_time Optional. Last active time
 * @param int $forum_id Optional. Forum id
 * @param int $topic_id Optional. Topic id
 * @param bool $refresh If set to true, unsets all the previous parameters.
 *                       Defaults to true
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_topic_id() To get the reply topic id
 * @uses bbp_get_reply_forum_id() To get the reply forum id
 * @uses get_post_ancestors() To get the ancestors of the reply
 * @uses bbp_is_reply() To check if the ancestor is a reply
 * @uses bbp_is_topic() To check if the ancestor is a topic
 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id
 * @uses bbp_update_topic_last_active_id() To update the topic last active id
 * @uses bbp_get_topic_last_active_id() To get the topic last active id
 * @uses get_post_field() To get the post date of the last active id
 * @uses bbp_update_topic_last_active_time() To update the last active topic meta
 * @uses bbp_update_topic_voice_count() To update the topic voice count
 * @uses bbp_update_topic_reply_count() To update the topic reply count
 * @uses bbp_update_topic_reply_count_hidden() To update the topic hidden reply
 *                                              count
 * @uses bbp_is_forum() To check if the ancestor is a forum
 * @uses bbp_update_forum_last_topic_id() To update the last topic id forum meta
 * @uses bbp_update_forum_last_reply_id() To update the last reply id forum meta
 * @uses bbp_update_forum_last_active_id() To update the forum last active id
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_update_forum_last_active_time() To update the forum last active time
 * @uses bbp_update_forum_reply_count() To update the forum reply count
 */
function bbp_update_reply_walker($reply_id, $last_active_time = '', $forum_id = 0, $topic_id = 0, $refresh = true)
{
    // Verify the reply ID
    $reply_id = bbp_get_reply_id($reply_id);
    // Reply was passed
    if (!empty($reply_id)) {
        // Get the topic ID if none was passed
        if (empty($topic_id)) {
            $topic_id = bbp_get_reply_topic_id($reply_id);
        }
        // Get the forum ID if none was passed
        if (empty($forum_id)) {
            $forum_id = bbp_get_reply_forum_id($reply_id);
        }
    }
    // Set the active_id based on topic_id/reply_id
    $active_id = empty($reply_id) ? $topic_id : $reply_id;
    // Setup ancestors array to walk up
    $ancestors = array_values(array_unique(array_merge(array($topic_id, $forum_id), (array) get_post_ancestors($topic_id))));
    // If we want a full refresh, unset any of the possibly passed variables
    if (true === $refresh) {
        $forum_id = $topic_id = $reply_id = $active_id = $last_active_time = 0;
    }
    // Walk up ancestors
    if (!empty($ancestors)) {
        foreach ($ancestors as $ancestor) {
            // Reply meta relating to most recent reply
            if (bbp_is_reply($ancestor)) {
                // @todo - hierarchical replies
                // Topic meta relating to most recent reply
            } elseif (bbp_is_topic($ancestor)) {
                // Last reply and active ID's
                bbp_update_topic_last_reply_id($ancestor, $reply_id);
                bbp_update_topic_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $topic_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $topic_last_active_time = get_post_field('post_date', bbp_get_topic_last_active_id($ancestor));
                }
                // Only update if reply is published
                if (bbp_is_reply_published($reply_id)) {
                    bbp_update_topic_last_active_time($ancestor, $topic_last_active_time);
                }
                // Counts
                bbp_update_topic_voice_count($ancestor);
                bbp_update_topic_reply_count($ancestor);
                bbp_update_topic_reply_count_hidden($ancestor);
                // Forum meta relating to most recent topic
            } elseif (bbp_is_forum($ancestor)) {
                // Last topic and reply ID's
                bbp_update_forum_last_topic_id($ancestor, $topic_id);
                bbp_update_forum_last_reply_id($ancestor, $reply_id);
                // Last Active
                bbp_update_forum_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $forum_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $forum_last_active_time = get_post_field('post_date', bbp_get_forum_last_active_id($ancestor));
                }
                // Only update if reply is published
                if (bbp_is_reply_published($reply_id)) {
                    bbp_update_forum_last_active_time($ancestor, $forum_last_active_time);
                }
                // Counts
                bbp_update_forum_reply_count($ancestor);
            }
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:functions.php


示例9: bbp_update_forum_topic_count_hidden

/**
 * Adjust the total hidden topic count of a forum (hidden includes trashed,
 * spammed and pending topics)
 *
 * @since 2.0.0 bbPress (r2888)
 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects
 *
 * @param int $forum_id Optional. Topic id to update.
 * @param int $topic_count Optional. Set the topic count manually.
 * @uses bbp_is_topic() To check if the supplied id is a topic
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_trash_status_id() To get the trash status id
 * @uses bbp_get_spam_status_id() To get the spam status id
 * @uses bbp_get_pending_status_id() To get the pending status id
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses update_post_meta() To update the forum hidden topic count meta
 * @uses apply_filters() Calls 'bbp_update_forum_topic_count_hidden' with the
 *                        hidden topic count and forum id
 * @return int Topic hidden topic count
 */
function bbp_update_forum_topic_count_hidden($forum_id = 0, $topic_count = 0)
{
    // If topic_id was passed as $forum_id, then get its forum
    if (bbp_is_topic($forum_id)) {
        $topic_id = bbp_get_topic_id($forum_id);
        $forum_id = bbp_get_topic_forum_id($topic_id);
        // $forum_id is not a topic_id, so validate and proceed
    } else {
        $forum_id = bbp_get_forum_id($forum_id);
    }
    // Can't update what isn't there
    if (!empty($forum_id)) {
        // Get topics of forum
        if (empty($topic_count)) {
            $query = new WP_Query(array('fields' => 'ids', 'post_parent' => $forum_id, 'post_status' => array(bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id()), 'post_type' => bbp_get_topic_post_type(), 'posts_per_page' => -1, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'ignore_sticky_posts' => true));
            $topic_count = $query->post_count;
            unset($query);
        }
        $topic_count = (int) $topic_count;
        // Update the count
        update_post_meta($forum_id, '_bbp_topic_count_hidden', $topic_count);
    }
    return (int) apply_filters('bbp_update_forum_topic_count_hidden', $topic_count, $forum_id);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:46,代码来源:functions.php


示例10: bbp_get_reply_admin_links

/**
 * Return admin links for reply
 *
 * @since bbPress (r2667)
 *
 * @param mixed $args This function supports these arguments:
 *  - id: Optional. Reply id
 *  - before: HTML before the links. Defaults to
 *             '<span class="bbp-admin-links">'
 *  - after: HTML after the links. Defaults to '</span>'
 *  - sep: Separator. Defaults to ' | '
 *  - links: Array of the links to display. By default, edit, trash,
 *            spam and topic split links are displayed
 * @uses bbp_is_topic() To check if it's the topic page
 * @uses bbp_is_reply() To check if it's the reply page
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_edit_link() To get the reply edit link
 * @uses bbp_get_reply_trash_link() To get the reply trash link
 * @uses bbp_get_reply_spam_link() To get the reply spam link
 * @uses bbp_get_topic_split_link() To get the topic split link
 * @uses current_user_can() To check if the current user can edit or
 *                           delete the reply
 * @uses apply_filters() Calls 'bbp_get_reply_admin_links' with the
 *                        reply admin links and args
 * @return string Reply admin links
 */
function bbp_get_reply_admin_links($args = '')
{
    $defaults = array('id' => 0, 'before' => '<span class="bbp-admin-links">', 'after' => '</span>', 'sep' => ' | ', 'links' => array());
    $r = bbp_parse_args($args, $defaults, 'get_reply_admin_links');
    $r['id'] = bbp_get_reply_id((int) $r['id']);
    // If post is a topic, return the topic admin links instead
    if (bbp_is_topic($r['id'])) {
        return bbp_get_topic_admin_links($args);
    }
    // If post is not a reply, return
    if (!bbp_is_reply($r['id'])) {
        return;
    }
    // Make sure user can edit this reply
    if (!current_user_can('edit_reply', $r['id'])) {
        return;
    }
    // If topic is trashed, do not show admin links
    if (bbp_is_topic_trash(bbp_get_reply_topic_id($r['id']))) {
        return;
    }
    // If no links were passed, default to the standard
    if (empty($r['links'])) {
        $r['links'] = array('edit' => bbp_get_reply_edit_link($r), 'split' => bbp_get_topic_split_link($r), 'trash' => bbp_get_reply_trash_link($r), 'spam' => bbp_get_reply_spam_link($r));
    }
    // Check caps for trashing the topic
    if (!current_user_can('delete_reply', $r['id']) && !empty($r['links']['trash'])) {
        unset($r['links']['trash']);
    }
    // See if links need to be unset
    $reply_status = bbp_get_reply_status($r['id']);
    if (in_array($reply_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()))) {
        // Spam link shouldn't be visible on trashed topics
        if ($reply_status == bbp_get_trash_status_id()) {
            unset($r['links']['spam']);
            // Trash link shouldn't be visible on spam topics
        } elseif (isset($r['links']['trash']) && bbp_get_spam_status_id() == $reply_status) {
            unset($r['links']['trash']);
        }
    }
    // Process the admin links
    $links = implode($r['sep'], array_filter($r['links']));
    $retval = $r['before'] . $links . $r['after'];
    return apply_filters('bbp_get_reply_admin_links', $retval, $args);
}
开发者ID:hscale,项目名称:webento,代码行数:71,代码来源:template-tags.php


示例11: user_has_cap

 public static function user_has_cap($allcaps, $caps, $args, $user)
 {
     if (!in_array('upload_files', $caps)) {
         return $allcaps;
     }
     $can = isset($allcaps['upload_files']) ? $allcaps['upload_files'] : false;
     // async-upload.php, admin-ajax.php 를 통해서 업로드할 때 권한 체크가 어려움
     $ajax_attachment_actions = apply_filters('bbpkr_ajax_attachment_actions', array('upload-attachment', 'query-attachments'));
     if ((isset($_REQUEST['post_id']) || !empty(self::$forum_id)) && empty($allcaps['upload_files']) && (defined('DOING_AJAX') && true === DOING_AJAX) && (isset($_REQUEST['action']) && in_array($_REQUEST['action'], $ajax_attachment_actions))) {
         if (isset($_REQUEST['post_id'])) {
             $the_id = (int) $_REQUEST['post_id'];
             if (bbp_is_forum($the_id)) {
                 self::$forum_id = $the_id;
             } elseif (bbp_is_topic($the_id)) {
                 self::$forum_id = (int) bbp_get_topic_forum_id($the_id);
             } elseif (bbp_is_reply($the_id)) {
                 self::$forum_id = (int) bbp_get_reply_forum_id($the_id);
             }
         }
         if (!self::$forum_id) {
             return $allcaps;
         }
         $forum_id = self::$forum_id;
         // unset post_id to avoid edit_post check( DO NOT UNSET $_POST['post_id'] )
         $_REQUEST['post_id'] = null;
         $allcaps['upload_files'] = self::can_upload($can, $forum_id);
         return $allcaps;
     }
     $allcaps['upload_files'] = self::can_upload($can);
     return $allcaps;
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:31,代码来源:attachments.php


示例12: bbp_update_reply_walker

/**
 * Walk up the ancestor tree from the current reply, and update all the counts
 *
 * @since 2.0.0 bbPress (r2884)
 *
 * @param int $reply_id Optional. Reply id
 * @param string $last_active_time Optional. Last active time
 * @param int $forum_id Optional. Forum id
 * @param int $topic_id Optional. Topic id
 * @param bool $refresh If set to true, unsets all the previous parameters.
 *                       Defaults to true
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_topic_id() To get the reply topic id
 * @uses bbp_get_reply_forum_id() To get the reply forum id
 * @uses get_post_ancestors() To get the ancestors of the reply
 * @uses bbp_is_reply() To check if the ancestor is a reply
 * @uses bbp_is_topic() To check if the ancestor is a topic
 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id
 * @uses bbp_update_topic_last_active_id() To update the topic last active id
 * @uses bbp_get_topic_last_active_id() To get the topic last active id
 * @uses get_post_field() To get the post date of the last active id
 * @uses bbp_update_topic_last_active_time() To update the last active topic meta
 * @uses bbp_update_topic_voice_count() To update the topic voice count
 * @uses bbp_update_topic_reply_count() To update the topic reply count
 * @uses bbp_update_topic_reply_count_hidden() To update the topic hidden reply
 *                                              count
 * @uses bbp_is_forum() To check if the ancestor is a forum
 * @uses bbp_update_forum_last_topic_id() To update the last topic id forum meta
 * @uses bbp_update_forum_last_reply_id() To update the last reply id forum meta
 * @uses bbp_update_forum_last_active_id() To update the forum last active id
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_update_forum_last_active_time() To update the forum last active time
 * @uses bbp_update_forum_reply_count() To update the forum reply count
 */
function bbp_update_reply_walker($reply_id, $last_active_time = '', $forum_id = 0, $topic_id = 0, $refresh = true)
{
    // Verify the reply ID
    $reply_id = bbp_get_reply_id($reply_id);
    // Reply was passed
    if (!empty($reply_id)) {
        // Get the topic ID if none was passed
        if (empty($topic_id)) {
            $topic_id = bbp_get_reply_topic_id($reply_id);
            // Make every effort to get topic id
            // https://bbpress.trac.wordpress.org/ticket/2529
            if (empty($topic_id) && current_filter() === 'bbp_deleted_reply') {
                $topic_id = get_post_field('post_parent', $reply_id);
            }
        }
        // Get the forum ID if none was passed
        if (empty($forum_id)) {
            $forum_id = bbp_get_reply_forum_id($reply_id);
        }
    }
    // Set the active_id based on topic_id/reply_id
    $active_id = empty($reply_id) ? $topic_id : $reply_id;
    // Setup ancestors array to walk up
    $ancestors = array_values(array_unique(array_merge(array($topic_id, $forum_id), (array) get_post_ancestors($topic_id))));
    // If we want a full refresh, unset any of the possibly passed variables
    if (true === $refresh) {
        $forum_id = $topic_id = $reply_id = $active_id = $last_active_time = 0;
    }
    // Walk up ancestors
    if (!empty($ancestors)) {
        foreach ($ancestors as $ancestor) {
            // Reply meta relating to most recent reply
            if (bbp_is_reply($ancestor)) {
                // @todo - hierarchical replies
                // Topic meta relating to most recent reply
            } elseif (bbp_is_topic($ancestor)) {
                // Last reply and active ID's
                bbp_update_topic_last_reply_id($ancestor, $reply_id);
                bbp_update_topic_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $topic_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $topic_last_active_time = get_post_field('post_date', bbp_get_topic_last_active_id($ancestor));
                }
                // Update the topic last active time regardless of reply status.
                // See https://bbpress.trac.wordpress.org/ticket/2838
                bbp_update_topic_last_active_time($ancestor, $topic_last_active_time);
                // Counts
                bbp_update_topic_voice_count($ancestor);
                // Only update reply count if we're deleting a reply, or in the dashboard.
                if (in_array(current_filter(), array('bbp_deleted_reply', 'save_post'), true)) {
                    bbp_update_topic_reply_count($ancestor);
                    bbp_update_topic_reply_count_hidden($ancestor);
                }
                // Forum meta relating to most recent topic
            } elseif (bbp_is_forum($ancestor)) {
                // Last topic and reply ID's
                bbp_update_forum_last_topic_id($ancestor, $topic_id);
                bbp_update_forum_last_reply_id($ancestor, $reply_id);
                // Last Active
                bbp_update_forum_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $forum_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $forum_last_active_time = get_post_field('post_date', bbp_get_forum_last_active_id($ancestor));
                }
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:101,代码来源:functions.php


示例13: bbp_reply_id

<?php

/**
 * Replies Loop - Single Reply
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<section id="post-<?php 
bbp_reply_id();
?>
" class="bbp-reply">
	<?php 
if (!bbp_is_topic(bbp_get_reply_id())) {
    ?>
		<header class="bbp-reply-header">
			<div>
				<hgroup class="bbp-reply-meta">
					<ul>
						<li class="bbp-reply-author">
							<?php 
    do_action('bbp_theme_before_reply_author_details');
    ?>
							<?php 
    bbp_reply_author_link(array('size' => 16, 'show_role' => true));
    ?>
							<?php 
    do_action('bbp_theme_after_reply_author_details');
    ?>
开发者ID:Tiger66639,项目名称:electrify,代码行数:31,代码来源:loop-single-reply.php


示例14: pg_get_author_link

function pg_get_author_link()
{
    $user_id2 = wp_get_current_user()->ID;
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => $post_id, 'link_title' => '', 'type' => 'both', 'size' => 14), 'pg_get_author_link');
    //confirmed topic
    if (bbp_is_topic($post_id)) {
        $topic = bbp_get_topic_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $topic);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_topic_author_link($r);
        // Confirmed reply
    } elseif (bbp_is_reply($post_id)) {
        $reply = bbp_get_reply_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $reply);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_reply_author_link($r);
    }
    // Neither a reply nor a topic, so could be a revision
    //if it isn't a topic or reply, not sure so better to just not display the author in this case
    //could be revised to look up the post_parent of this post and then churn that round the code above if required return ;
    return;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:29,代码来源:functions.php


示例15: bp_forums_root_slug

/<?php 
        echo bp_forums_root_slug();
        ?>
/" title="<?php 
        _e('Forums', 'framemarket');
        ?>
"><?php 
        _e('Forums', 'framemarket');
        ?>
</a>
										</li>
									<?php 
    } elseif (function_exists('bbpress')) {
        ?>
										<li<?php 
        if (bbp_is_forum($post->ID) || bbp_is_topic($post->ID)) {
            ?>
 class="selected"<?php 
        }
        ?>
>
											<a href="<?php 
        bbp_forums_url();
        ?>
"><?php 
        _e('Forums', 'framemarket');
        ?>
</a>
										</li>
									<?php 
    }
开发者ID:JeffreyBue,项目名称:jb,代码行数:31,代码来源:header.php


示例16: apoc_reply_admin_links

/**
 * Output custom bbPress admin links
 * @version 2.0
 */
function apoc_reply_admin_links($reply_id)
{
    // Make sure it's a logged-in user
    if (!is_user_logged_in()) {
        return false;
    }
    // Get post id and setup desired links
    $links = array();
    // Add common quote and reply links except on forum profiles
    if (!bp_is_forums_component()) {
        $links['quote'] = apoc_quote_button('reply', $reply_id);
        $links['reply'] = '<a class="scroll-respond button button-dark" href="#new-post" title="Quick Reply"><i class="fa fa-reply"></i>Reply</a>';
    }
    // Topic admin links
    if (bbp_is_topic($reply_id)) {
        $links['edit'] = bbp_get_topic_edit_link(array('id' => $reply_id, 'edit_text' => '<i class="fa fa-pencil"></i>Edit'));
        $links['close'] = bbp_get_topic_close_link(array('id' => $reply_id, 'close_text' => '<i class="fa fa-lock"></i>Close', 'open_text' => '<i class="fa fa-unlock"></i>Open'));
        $links['stick'] = bbp_get_topic_stick_link(array('id' => $reply_id, 'stick_text' => '<i class="fa fa-thumb-tack"></i>Stick', 'unstick_text' => '<i class="fa fa-level-down"></i>Unstick', 'super_text' => '<i class="fa fa-paperclip"></i>Notice'));
        $links['merge'] = bbp_get_topic_merge_link(array('merge_text' => '<i class="fa fa-code-fork"></i>Merge'));
        $links['trash'] = bbp_get_topic_trash_link(array('id' => $reply_id, 'trash_text' => '<i class="fa fa-trash"></i>Trash', 'restore_text' => '<i class="fa fa-undo"></i>Restore', 'delete_text' => '<i class="fa fa-remove"></i>Delete', 'sep' => ''));
        // Reply admin links
    } else {
        $links['edit'] = bbp_get_reply_edit_link(array('id' => $reply_id, 'edit_text' => '<i class="fa fa-pencil"></i>Edit'));
        $links['move'] = bbp_get_reply_move_link(array('id' => $reply_id, 'split_text' => '<i class="fa fa-arrows"></i>Move'));
        $links['split'] = bbp_get_topic_split_link(array('id' => $reply_id, 'split_text' => '<i class="fa fa-code-fork"></i>Split'));
        $links['trash'] = bbp_get_reply_trash_link(array('id' => $reply_id, 'trash_text' => '<i class="fa fa-trash"></i>Trash', 'restore_text' => '<i class="fa fa-undo"></i>Restore', 'delete_text' => '<i class="fa fa-remove"></i>Delete', 'sep' => ''));
    }
    // Get the admin links!
    bbp_reply_admin_links(array('id' => $reply_id, 'before' => '', 'after' => '', 'sep' => '', 'links' => $links));
}
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:34,代码来源:bbpress.php


示例17: bbp_get_forum_freshness_link

/**
 * Returns link to the most recent activity inside a forum.
 *
 * Returns a complete link with attributes and content.
 *
 * @since bbPress (r2625)
 *
 * @param int $forum_id Optional. Forum id
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_get_forum_last_reply_id() To get the forum last reply id
 * @uses bbp_get_forum_last_topic_id() To get the forum last topic id
 * @uses bbp_get_forum_last_reply_url() To get the forum last reply url
 * @uses bbp_get_forum_last_reply_title() To get the forum last reply
 *                                         title
 * @uses bbp_get_forum_last_topic_permalink() To get the forum last
 *                                             topic permalink
 * @uses bbp_get_forum_last_topic_title() To get the forum last topic
 *                                         title
 * @uses bbp_get_forum_last_active_time() To get the time when the forum
 *                                         was last active
 * @uses apply_filters() Calls 'bbp_get_forum_freshness_link' with the
 *                        link and forum id
 */
function bbp_get_forum_freshness_link($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    $active_id = bbp_get_forum_last_active_id($forum_id);
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_reply_id($forum_id);
    }
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_topic_id($forum_id);
    }
    if (bbp_is_topic($active_id)) {
        $link_url = bbp_get_forum_last_topic_permalink($forum_id);
        $title = bbp_get_forum_last_topic_title($forum_id);
    } elseif (bbp_is_reply($active_id)) {
        $link_url = bbp_get_forum_last_reply_url($forum_id);
        $title = bbp_get_forum_last_reply_title($forum_id);
    }
    $time_since = bbp_get_forum_last_active_time($forum_id);
    if (!empty($time_since) && !empty($link_url)) {
        $anchor = '<a href="' . $link_url . '" title="' . esc_attr($title) . '">' . $time_since . '</a>';
    } else {
        $anchor = __('No Topics', 'bbpress');
    }
    return apply_filters('bbp_get_forum_freshness_link', $anchor, $forum_id);
}
开发者ID:hscale,项目名称:webento,代码行数:49,代码来源:bbp-forum-template.php


示例18: display_topic

 /**
  * Display the contents of a specific topic ID in an output buffer
  * and return to ensure that post/page contents are displayed first.
  *
  * @since bbPress (r3031)
  *
  * @param array $attr
  * @param string $content
  * @uses get_template_part()
  * @return string
  */
 public function display_topic($attr, $content = '')
 {
     // Sanity check required info
     if (!empty($content) || (empty($attr['id']) || !is_numeric($attr['id']))) {
         return $content;
     }
     // Unset globals
     $this->unset_globals();
     // Set passed attribute to $forum_id for clarity
     $topic_id = bbpress()->current_topic_id = $attr['id'];
     $forum_id = bbp_get_topic_forum_id($topic_id);
     // Bail if ID passed is not a topic
     if (!bbp_is_topic($topic_id)) {
         return $content;
     }
     // Reset the queries if not in theme compat
     if (!bbp_is_theme_compat_active()) {
         $bbp = bbpress();
         // Reset necessary forum_query attributes for topics loop to function
         $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type();
         $bbp->forum_query->in_the_loop = true;
         $bbp->forum_query->post = get_post($forum_id);
         // Reset necessary topic_query attributes for topics loop to function
         $bbp->topic_query->query_vars['post_type'] = bbp_get_topic_post_type();
         $bbp->topic_query->in_the_loop = true;
         $bbp->topic_query->post = get_post($topic_id);
     }
     // Start output buffer
     $this->start('bbp_single_topic');
     // Check forum caps
     if (bbp_user_can_view_forum(array('forum_id' => $forum_id))) {
         bbp_get_template_part('content', 'single-topic');
         // Forum is private and user does not have caps
     } elseif (bbp_is_forum_private($forum_id, false)) {
         bbp_get_template_part('feedback', 'no-access');
     }
     // Return contents of output buffer
     return $this->end();
 }


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP bbp_is_topic_anonymous函数代码示例发布时间:2022-05-24
下一篇:
PHP bbp_is_subscriptions_active函数代码示例发布时间: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