Changeset 4363
- Timestamp:
- 11/08/2012 10:24:15 PM (12 years ago)
- Location:
- trunk/includes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/core/template-functions.php
r4327 r4363 317 317 } 318 318 319 // C reate new user320 $ user = get_userdata( $bbp_user );321 322 // 404 and bail if no user found, is inactive, or not a member323 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 ) ) { 324 324 $posts_query->set_404(); 325 325 return; … … 386 386 // Correct is_home variable 387 387 $posts_query->is_home = false; 388 389 // Get the user data 390 $user = get_userdata( $bbp_user ); 388 391 389 392 // User is looking at their own profile -
trunk/includes/replies/template-tags.php
r4331 r4363 1040 1040 1041 1041 // Add links if not anonymous 1042 if ( empty( $anonymous ) ) {1042 if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) { 1043 1043 foreach ( $author_links as $link => $link_text ) { 1044 1044 $link_class = ' class="bbp-author-' . $link . '"'; -
trunk/includes/topics/template-tags.php
r4331 r4363 1360 1360 1361 1361 // Add links if not anonymous 1362 if ( empty( $anonymous ) ) {1362 if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) { 1363 1363 1364 1364 // Assemble the links -
trunk/includes/users/capabilities.php
r4355 r4363 161 161 * @since bbPress (r3380) 162 162 * 163 * @uses bbp_allow_global_access() 164 * @uses bbp_is_user_inactive() 165 * @uses is_user_logged_in() 166 * @uses is_user_member_of_blog() 163 * @uses is_user_logged_in() To bail if user is not logged in 164 * @uses bbp_get_user_role() To bail if user already has a role 165 * @uses bbp_is_user_inactive() To bail if user is inactive 166 * @uses bbp_allow_global_access() To know whether to save role to database 167 * @uses bbp_get_user_role_map() To get the WP to BBP role map array 168 * @uses bbp_get_default_role() To get the site's default forums role 167 169 * @uses get_option() 168 170 * … … 573 575 return !bbp_is_user_active( $user_id ); 574 576 } 577 578 /** 579 * Does a user have a profile for the current site 580 * 581 * @since bbPress (r4362) 582 * 583 * @param int $user_id User ID to check 584 * @param int $blog_id Blog ID to check 585 * 586 * @uses bbp_get_user_id() To verify the user ID 587 * @uses get_userdata() To get the user's data 588 * @uses is_super_admin() To determine if user can see inactive users 589 * @uses bbp_is_user_inactive() To check if user is spammer or deleted 590 * @uses apply_filters() To allow override of this functions result 591 * 592 * @return boolean Whether or not the user has a profile on this blog_id 593 */ 594 function bbp_user_has_profile( $user_id = 0 ) { 595 596 // Validate user ID, default to displayed or current user 597 $user_id = bbp_get_user_id( $user_id, true, true ); 598 599 // Try to get this user's data 600 $user = get_userdata( $user_id ); 601 602 // No user found, return false 603 if ( empty( $user ) ) { 604 $retval = false; 605 606 // User found 607 } else { 608 609 // User is inactive, and current user is not a super admin 610 if ( ! is_super_admin() && bbp_is_user_inactive( $user->ID ) ) { 611 $retval = false; 612 613 // Check for site caps 614 } else { 615 $retval = (bool) bbp_get_user_role( $user_id ); 616 } 617 } 618 619 // Filter and return 620 return (bool) apply_filters( 'bbp_show_user_profile', $retval, $user_id ); 621 } -
trunk/includes/users/template-tags.php
r4352 r4363 1392 1392 1393 1393 // Add links if not anonymous 1394 if ( empty( $anonymous ) ) {1394 if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) { 1395 1395 foreach ( $author_links as $link_text ) { 1396 1396 $author_link[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', $author_url, $link_title, $link_text );
Note: See TracChangeset
for help on using the changeset viewer.