Ticket #7349: 7349.ray.patch
File 7349.ray.patch, 3.7 KB (added by , 8 years ago) |
---|
-
src/bp-core/bp-core-buddybar.php
61 61 * To mimic legacy behavior, if bp_core_create_nav_link() returns false, we make 62 62 * an early exit and don't attempt to register the screen function. 63 63 */ 64 if ( false === $nav_item ) {64 if ( false === $nav_item && ! isset( $r['visibility'] ) ) { 65 65 return false; 66 66 } 67 67 … … 151 151 'default_subnav_slug' => $r['default_subnav_slug'] 152 152 ); 153 153 154 if ( isset( $r['visibility'] ) ) { 155 $nav_item['visibility'] = $r['visibility']; 156 } 157 158 if ( isset( $r['visibility'] ) && false === $r['visibility'] ) { 159 return $nav_item; 160 } 161 154 162 // Add the item to the nav. 155 163 buddypress()->{$component}->nav->add_nav( $nav_item ); 156 164 … … 226 234 * the logged in user is not the displayed user 227 235 * looking at their own profile, don't don't register this screen function. 228 236 */ 229 if ( empty( $r['show_for_displayed_user'] ) && ! bp_user_has_access() ) {237 if ( ! isset( $r['visibility'] ) && empty( $r['show_for_displayed_user'] ) && ! bp_user_has_access() ) { 230 238 return false; 231 239 } 232 240 -
src/bp-core/bp-core-catchuri.php
670 670 // Error message is displayed with bp_core_no_access_wp_login_error(). 671 671 case 2 : 672 672 if ( !empty( $redirect ) ) { 673 bp_core_redirect( add_query_arg( array( 'action' => 'bpnoaccess' ), wp_login_url( $redirect ) ) ); 673 bp_core_redirect( add_query_arg( array( 674 'action' => 'bpnoaccess', 675 'auth' => 1 676 ), wp_login_url( $redirect ) ) ); 674 677 } else { 675 678 bp_core_redirect( $root ); 676 679 } … … 698 701 } 699 702 700 703 /** 704 * Login redirector. 705 * 706 * If a link is not publicly available, we can send members from external 707 * locations, like following links in an email, through the login screen. 708 * 709 * If a user clicks on this link and is already logged in, we should attempt 710 * to redirect the user to the authorized content instead of forcing the user 711 * to re-authenticate. 712 * 713 * @since 2.9.0 714 */ 715 function bp_login_redirector() { 716 // Redirect links must include the `redirect_to` and `auth` parameters. 717 if ( empty( $_GET['redirect_to'] ) || empty( $_GET['auth'] ) ) { 718 return; 719 } 720 721 /* 722 * If the user is already logged in, 723 * skip the login form and redirect them to the content. 724 */ 725 if ( bp_loggedin_user_id() ) { 726 wp_safe_redirect( esc_url_raw( $_GET['redirect_to'] ) ); 727 exit; 728 } 729 } 730 add_action( 'login_init', 'bp_login_redirector', 1 ); 731 732 /** 701 733 * Add a custom BuddyPress no access error message to wp-login.php. 702 734 * 703 735 * @since 1.5.0 -
src/bp-messages/classes/class-bp-messages-component.php
162 162 163 163 // Add 'Messages' to the main navigation. 164 164 $main_nav = array( 165 'name' 166 'slug' 167 'position' 168 ' show_for_displayed_user'=> $access,169 'screen_function' 170 'default_subnav_slug' 171 'item_css_id' 165 'name' => $nav_name, 166 'slug' => $slug, 167 'position' => 50, 168 'visibility' => $access, 169 'screen_function' => 'messages_screen_inbox', 170 'default_subnav_slug' => 'inbox', 171 'item_css_id' => $this->id 172 172 ); 173 173 174 174 // Add the subnav items to the profile.