コード例 #1
0
/**
 * Return the admin links for the current post in the loop.
 *
 * @param array $args {
 *     @type string $separator The character to use when separating
 *           links. Default: '|'.
 * }
 * @return HTML string containing the admin links for the current post.
 */
function bp_get_the_topic_post_admin_links($args = '')
{
    global $topic_template;
    // Never show for the first post in a topic.
    if (0 == $topic_template->current_post && 1 == $topic_template->pag_page) {
        return;
    }
    $defaults = array('separator' => ' | ');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $query_vars = '';
    if ($_SERVER['QUERY_STRING']) {
        $query_vars = '?' . $_SERVER['QUERY_STRING'];
    }
    $links = array();
    $links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post') . '">' . __('Edit', 'buddypress') . '</a>';
    $links[] .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post') . '">' . __('Delete', 'buddypress') . '</a>';
    return apply_filters('bp_get_the_topic_post_admin_links', implode($separator, $links), $links, $r);
}
コード例 #2
0
function bp_the_topic_permalink()
{
    echo bp_get_the_topic_permalink();
}
コード例 #3
0
 /**
  * Add bbPress forum post ratings. This method is for old versions of bbPress & BuddyPress bundle.
  *
  * @param mixed $content
  *
  * @return string
  */
 public function rw_display_forum_post_rating($content)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence('rw_display_forum_post_rating', $params);
     }
     $rclass = 'forum-post';
     // Check if item rating is top positioned.
     if (!isset($this->forum_align[$rclass])) {
         return $content;
     }
     $post_id = bp_get_the_topic_post_id();
     /*
     // Validate that item isn't explicitly excluded.
     if (false === $this->rw_validate_visibility($post_id, $rclass))
         return $content;
     
     // Get forum-post user-rating-id.
     $post_urid = $this->_getForumPostRatingGuid($post_id);
     
     // Queue activity-comment rating.
     $this->QueueRatingData($post_urid, strip_tags($topic_template->post->post_text), bp_get_the_topic_permalink() . "#post-" . $post_id, $rclass);
     
     $rw = '<div class="rw-' . $this->forum_align[$rclass]->hor . '"><div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $post_urid . '"></div></div>';
     */
     global $topic_template;
     // Add accumulator id if user accumulated rating.
     if ($this->IsUserAccumulatedRating()) {
         $options['uarid'] = $this->_getUserRatingGuid($topic_template->post->poster_id);
     }
     $rw = $this->EmbedRatingIfVisible($post_id, $topic_template->post->poster_id, strip_tags(bp_get_the_topic_post_content()), bp_get_the_topic_permalink() . '#post-' . $post_id, $rclass, false, $this->forum_align[$rclass]->hor, false, $options, false);
     // Attach rating html container.
     return $this->forum_align[$rclass]->ver == 'top' ? $rw . $content : $content . $rw;
 }
コード例 #4
0
 function rw_display_forum_post_rating($content)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("rw_display_forum_post_rating", $params);
     }
     //        global $bp, $topic_template, $forum_template;
     // if the topic is closed, return just the rating number
     //        if ( 0 == (int)$forum_template->topic->topic_open && !is_site_admin() )
     //            return $post_text . '<div class="rfp-rate"><b>'.get_option( 'rfp_help_text_closed' ).'</b><span class="counter">' . rfp_get_post_rating_signed( $topic_template->post->post_id ) . '</span></div>';
     $rclass = "forum-post";
     // Check if item rating is top positioned.
     if (!isset($this->forum_align[$rclass])) {
         return $content;
     }
     $post_id = bp_get_the_topic_post_id();
     // Validate that item isn't explicitly excluded.
     if (false === $this->rw_validate_visibility($post_id, $rclass)) {
         return $content;
     }
     // Get forum-post user-rating-id.
     $post_urid = $this->_getForumPostRatingGuid($post_id);
     // Queue activity-comment rating.
     self::QueueRatingData($post_urid, strip_tags($topic_template->post->post_text), bp_get_the_topic_permalink() . "#post-" . $post_id, $rclass);
     /*
     // Get corresponding user's accamulator rating id.
     $uarid = $this->_getUserRatingGuid(WP_RW__FORUM_POST_SECONDERY_ID, bp_get_the_topic_poster_id());
     
     $rw = '<div class="rw-' . $this->forum_align[$rclass]->hor . '"><div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $post_urid . ' rw-uarid-' . $uarid . '"></div></div>';
     */
     $rw = '<div class="rw-' . $this->forum_align[$rclass]->hor . '"><div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $post_urid . '"></div></div>';
     // Attach rating html container.
     return $this->forum_align[$rclass]->ver == "top" ? $rw . $content : $content . $rw;
 }