Skip to:
Content

bbPress.org

Changeset 2971


Ignore:
Timestamp:
04/01/2011 01:53:46 AM (14 years ago)
Author:
johnjamesjacoby
Message:

More clean-up to bbp_pre_get_posts. Fixes #1450.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-general-functions.php

    r2970 r2971  
    847847 */
    848848function bbp_pre_get_posts( $wp_query ) {
    849     global $bbp, $wp_version;
     849    global $bbp;
    850850
    851851    // Bail if $wp_query is empty or of incorrect class
     
    885885        }
    886886
    887         // Confirmed existence of the bbPress user
    888 
    889         // Define new query variable
     887        /** User Exists *******************************************************/
     888
     889        // View or edit?
    890890        if ( !empty( $is_edit ) ) {
     891
    891892            // Only allow super admins on multisite to edit every user.
    892893            if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) )
    893894                wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) );
    894895
     896            // We are editing a profile
    895897            $wp_query->bbp_is_user_profile_edit = true;
    896898
    897             // Load the required user editing functions
     899            // Load the core WordPress contact methods
    898900            if ( !function_exists( '_wp_get_user_contactmethods' ) )
    899901                include_once( ABSPATH . 'wp-includes/registration.php' );
    900902
     903            // Load the edit_user functions
    901904            if ( !function_exists( 'edit_user' ) )
    902905                require_once( ABSPATH . 'wp-admin/includes/user.php' );
    903906
     907        // We are viewing a profile
    904908        } else {
    905909            $wp_query->bbp_is_user_profile_page = true;
     
    925929    } elseif ( !empty( $bbp_view ) ) {
    926930
    927         // Check if the view exists by checking if there are query args are set or not
     931        // Check if the view exists by checking if there are query args are set
    928932        $view_args = bbp_get_view_query_args( $bbp_view );
    929933
     
    934938        }
    935939
     940        // We are in a custom topic view
    936941        $wp_query->bbp_is_view = true;
    937942
     
    939944    } elseif ( !empty( $is_edit ) ) {
    940945
    941         // It is a topic edit page
     946        // We are editing a topic
    942947        if ( get_query_var( 'post_type' ) == bbp_get_topic_post_type() )
    943948            $wp_query->bbp_is_topic_edit = true;
    944949
    945         // It is a reply edit page
     950        // We are editing a reply
    946951        elseif ( get_query_var( 'post_type' ) == bbp_get_reply_post_type() )
    947952            $wp_query->bbp_is_reply_edit = true;
Note: See TracChangeset for help on using the changeset viewer.