Skip to:
Content

BuddyPress.org

Changeset 4846


Ignore:
Timestamp:
07/25/2011 12:21:20 AM (13 years ago)
Author:
boonebgorges
Message:

Global/slug audit in forums component. See #3325

Location:
trunk/bp-forums
Files:
3 edited

Legend:

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

    r4821 r4846  
    107107    global $bp;
    108108
    109     if ( $bp->current_action == 'forum' && !empty( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] )
     109    if ( bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) )
    110110        if ( bp_has_forum_topic_posts() )
    111111            $title .= bp_get_the_topic_title() . " $sep ";
  • trunk/bp-forums/bp-forums-screens.php

    r4821 r4846  
    105105    global $bp;
    106106
    107     if ( !bp_is_forums_component() || !bp_is_current_action( 'forum' ) || empty( $bp->action_variables[0] ) )
     107    if ( !bp_is_forums_component() || !bp_is_current_action( 'forum' ) || !bp_action_variable( 0 ) )
    108108        return false;
    109109
     
    117117    global $bp;
    118118
    119     if ( !bp_is_forums_component() || !bp_is_current_action( 'topic' ) || empty( $bp->action_variables[0] ) )
     119    if ( !bp_is_forums_component() || !bp_is_current_action( 'topic' ) || !bp_action_variable( 0 ) )
    120120        return false;
    121121
  • trunk/bp-forums/bp-forums-template.php

    r4844 r4846  
    313313    // If we're viewing a tag URL in the directory, let's override the type and
    314314    // set it to tags and the filter to the tag name
    315     if ( 'tag' == $bp->current_action && !empty( $bp->action_variables[0] ) ) {
    316         $search_terms = $bp->action_variables[0];
     315    if ( bp_is_current_action( 'tag' ) && $search_terms = bp_action_variable( 0 ) ) {
    317316        $type = 'tags';
    318317    }
     
    858857    }
    859858
     859/**
     860 * Echoes the output of bp_get_forums_tag_name()
     861 *
     862 * @package BuddyPress
     863 * @todo Deprecate?
     864 */
    860865function bp_forums_tag_name() {
    861866    echo bp_get_forums_tag_name();
    862 }
     867}   
     868    /**
     869     * Outputs the currently viewed tag name
     870     *
     871     * @package BuddyPress
     872     * @todo Deprecate? Seems unused
     873     */
    863874    function bp_get_forums_tag_name() {
    864         global $bp;
    865 
    866         if ( bp_is_directory() && bp_is_forums_component() && !empty( $bp->action_variables[0] ) )
    867             $tag_name = $bp->action_variables[0];
    868         else
    869             $tag_name = false;
    870 
     875        $tag_name = bp_is_directory() && bp_is_forums_component() ? bp_action_variable( 0 ) : false;
     876       
    871877        return apply_filters( 'bp_get_forums_tag_name', $tag_name );
    872878    }
     
    902908    global $bp;
    903909
    904     if ( in_array( 'post', (array)$bp->action_variables ) && in_array( 'edit', (array)$bp->action_variables ) )
     910    if ( bp_is_action_variable( 'post' ) && bp_is_action_variable( 'edit' ) )
    905911        return false;
    906912
     
    10361042
    10371043function bp_has_forum_topic_posts( $args = '' ) {
    1038     global $topic_template, $bp;
     1044    global $topic_template;
    10391045
    10401046    $defaults = array(
     
    10481054    extract( $r, EXTR_SKIP );
    10491055
    1050     if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && !empty( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && !empty( $bp->action_variables[1] ) )
    1051         $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );
    1052     elseif ( empty( $topic_id ) && bp_is_current_component( 'forums') && bp_is_current_action( 'topic' ) && !empty( $bp->action_variables[0] ) )
    1053         $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[0] );
     1056    if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) && bp_action_variable( 1 ) )
     1057        $topic_id = bp_forums_get_topic_id_from_slug( bp_action_variable( 1 ) );
     1058    elseif ( empty( $topic_id ) && bp_is_current_component( 'forums') && bp_is_current_action( 'topic' ) && bp_action_variable( 0 ) )
     1059        $topic_id = bp_forums_get_topic_id_from_slug( bp_action_variable( 0 ) );
    10541060
    10551061    if ( empty( $topic_id ) ) {
     
    10601066
    10611067        // Current topic forum_id needs to match current_group forum_id
    1062         if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) )
     1068        if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) )
    10631069            return false;
    10641070    }
     
    12061212}
    12071213    function bp_get_the_topic_post_edit_text() {
    1208         global $bp;
    1209 
    1210         $post = bp_forums_get_post( $bp->action_variables[4] );
     1214        $post = bp_forums_get_post( bp_action_variable( 4 ) );
    12111215        return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
    12121216    }
Note: See TracChangeset for help on using the changeset viewer.