diff --git a/src/bp-core/bp-core-actions.php b/src/bp-core/bp-core-actions.php
index d8fc1d6..05786b3 100644
a
|
b
|
add_action( 'bp_activation', 'bp_add_activation_redirect' ); |
117 | 117 | |
118 | 118 | // Email unsubscribe. |
119 | 119 | add_action( 'bp_get_request_unsubscribe', 'bp_email_unsubscribe_handler' ); |
| 120 | |
| 121 | // Login screen pass-through for currently logged-in members. |
| 122 | add_action( 'login_init', 'bp_login_redirector', 1 ); |
diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php
index 5dae2bc..32d3460 100644
a
|
b
|
function bp_email_get_unsubscribe_link( $args ) { |
3775 | 3775 | function bp_email_get_salt() { |
3776 | 3776 | return bp_get_option( 'bp-emails-unsubscribe-salt', null ); |
3777 | 3777 | } |
| 3778 | |
| 3779 | /** |
| 3780 | * Login redirector. |
| 3781 | * |
| 3782 | * If a link is not publicly available, we can send members from external |
| 3783 | * locations, like following links in an email, through the login screen. |
| 3784 | * |
| 3785 | * If a user clicks on this link and is already logged in, we should attempt |
| 3786 | * to redirect the user to the authorized content instead of forcing the user |
| 3787 | * to re-authenticate. |
| 3788 | * |
| 3789 | * @since 2.9.0 |
| 3790 | */ |
| 3791 | function bp_login_redirector() { |
| 3792 | // Redirect links must include the `redirect_to` and `auth` parameters. |
| 3793 | if ( empty( $_GET['redirect_to'] ) || empty( $_GET['auth'] ) ) { |
| 3794 | return; |
| 3795 | } |
| 3796 | |
| 3797 | /* |
| 3798 | * If the user is already logged in, |
| 3799 | * skip the login form and redirect them to the content. |
| 3800 | */ |
| 3801 | if ( bp_loggedin_user_id() ) { |
| 3802 | wp_safe_redirect( esc_url_raw( $_GET['redirect_to'] ) ); |
| 3803 | exit; |
| 3804 | } |
| 3805 | } |
| 3806 | No newline at end of file |
diff --git a/src/bp-messages/bp-messages-functions.php b/src/bp-messages/bp-messages-functions.php
index 4e78ea6..1341ee0 100644
a
|
b
|
function messages_notification_new_message( $raw_args = array() ) { |
603 | 603 | 'notification_type' => 'messages-unread', |
604 | 604 | ); |
605 | 605 | |
| 606 | // Send the user to the message thread via the login screen. |
| 607 | $message_url = add_query_arg( |
| 608 | array( |
| 609 | 'action' => 'bpnoaccess', |
| 610 | 'auth' => 1, |
| 611 | 'redirect_to' => urlencode( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/view/' . $thread_id . '/' ) |
| 612 | ), |
| 613 | wp_login_url() |
| 614 | ); |
| 615 | |
606 | 616 | $args = array( |
607 | 617 | 'tokens' => array( |
608 | 618 | 'usermessage' => wp_strip_all_tags( stripslashes( $message ) ), |
609 | | 'message.url' => esc_url( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/view/' . $thread_id . '/' ), |
| 619 | 'message.url' => esc_url( $message_url ), |
610 | 620 | 'sender.name' => $sender_name, |
611 | 621 | 'usersubject' => sanitize_text_field( stripslashes( $subject ) ), |
612 | 622 | 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), |