Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/08/2012 10:24:15 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Introduce bbp_user_has_profile() function in /users/capabilities.php.
  • Use this function to suppress links to a profile of a user with no role on the site.
  • Replaces some logic in bbp_parse_query() for setting user profile query variables.
  • See #1939.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/template-functions.php

    r4327 r4363  
    317317        }
    318318
    319         // Create new user
    320         $user = get_userdata( $bbp_user );
    321 
    322         // 404 and bail if no user found, is inactive, or not a member
    323         if ( empty( $user ) || ! is_user_member_of_blog( $user->ID ) || ( ! is_super_admin() && bbp_is_user_inactive( $user->ID ) ) ) {
     319        // Cast as int, just in case
     320        $bbp_user = (int) $bbp_user;
     321
     322        // 404 and bail if user does not have a profile
     323        if ( ! bbp_user_has_profile( $bbp_user ) ) {
    324324            $posts_query->set_404();
    325325            return;
     
    386386        // Correct is_home variable
    387387        $posts_query->is_home = false;
     388
     389        // Get the user data
     390        $user = get_userdata( $bbp_user );
    388391
    389392        // User is looking at their own profile
Note: See TracChangeset for help on using the changeset viewer.