Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/30/2009 05:49:55 PM (16 years ago)
Author:
apeatling
Message:

Fixing missing translation, updating group forums so topic posters can edit their post.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-templatetags.php

    r2004 r2012  
    510510    }
    511511
     512function bp_the_topic_is_mine() {
     513    echo bp_get_the_topic_is_mine();
     514}
     515    function bp_get_the_topic_is_mine() {
     516        global $bp, $forum_template;
     517   
     518        return $bp->loggedin_user->id == $forum_template->topic->topic_poster;
     519    }
     520
    512521function bp_the_topic_admin_links( $args = '' ) {
    513522    echo bp_get_the_topic_admin_links( $args );
    514523}
    515524    function bp_get_the_topic_admin_links( $args = '' ) {
    516         global $forum_template;
     525        global $bp, $forum_template;   
    517526       
    518527        $defaults = array(
     
    523532        extract( $r, EXTR_SKIP );
    524533
    525         $links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
    526 
    527         if ( 0 == (int)$forum_template->topic->topic_sticky )
    528             $links .= '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky', 'buddypress' ) . '</a> ' . $seperator . ' ';
    529         else
    530             $links .= '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic' ) . '">' . __( 'Un-stick', 'buddypress' ) . '</a> ' . $seperator . ' ';
    531 
    532         if ( 0 == (int)$forum_template->topic->topic_open )
    533             $links .= '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic' ) . '">' . __( 'Open', 'buddypress' ) . '</a> ' . $seperator . ' ';
    534         else
    535             $links .= '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'close', 'bp_forums_close_topic' ) . '">' . __( 'Close', 'buddypress' ) . '</a> ' . $seperator . ' ';
    536 
    537         $links .= '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
    538 
    539         return $links;
     534        $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic' ) . '">' . __( 'Edit', 'buddypress' ) . '</a>';
     535       
     536        if ( $bp->is_item_admin || $bp->is_item_mod || is_site_admin() ) {
     537            if ( 0 == (int)$forum_template->topic->topic_sticky )
     538                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky', 'buddypress' ) . '</a>';
     539            else
     540                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic' ) . '">' . __( 'Un-stick', 'buddypress' ) . '</a>';
     541
     542            if ( 0 == (int)$forum_template->topic->topic_open )
     543                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic' ) . '">' . __( 'Open', 'buddypress' ) . '</a>';
     544            else
     545                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'close', 'bp_forums_close_topic' ) . '">' . __( 'Close', 'buddypress' ) . '</a>';
     546
     547            $links[] = '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
     548        }
     549       
     550        return implode( ' ' . $seperator . ' ', (array) $links );
    540551    }
    541552
Note: See TracChangeset for help on using the changeset viewer.