| 1729 | | if ( is_a( $user, 'WP_User' ) && 2 == $user->user_status ) |
| 1730 | | return new WP_Error( 'bp_account_not_activated', __( '<strong>ERROR</strong>: Your account has not been activated. Check your email for the activation link.', 'buddypress' ) ); |
| | 1729 | if ( is_a( $user, 'WP_User' ) && 2 == $user->user_status ) { |
| | 1730 | $resend_url_params = array( |
| | 1731 | 'action' => 'bp-resend-activation', |
| | 1732 | 'user' => $user->user_login, |
| | 1733 | ); |
| | 1734 | |
| | 1735 | $resend_url = wp_nonce_url( |
| | 1736 | add_query_arg( $resend_url_params, wp_login_url() ), |
| | 1737 | 'bp-resend-activation' |
| | 1738 | ); |
| | 1739 | |
| | 1740 | $resend_string = '<br /><br />' . sprintf( __( 'If you have not received an email yet, <a href="%s">click here to resend it</a>.', 'buddypress' ), $resend_url ); |
| | 1741 | |
| | 1742 | return new WP_Error( 'bp_account_not_activated', __( '<strong>ERROR</strong>: Your account has not been activated. Check your email for the activation link.', 'buddypress' ) . $resend_string ); |
| | 1743 | } |
| | 1751 | * On the login screen, resends the activation email for a user. |
| | 1752 | * |
| | 1753 | * @since BuddyPress (2.0.0) |
| | 1754 | * |
| | 1755 | * @see bp_core_signup_disable_inactive() |
| | 1756 | */ |
| | 1757 | function bp_members_login_resend_activation_email() { |
| | 1758 | global $error; |
| | 1759 | |
| | 1760 | if ( empty( $_GET['user'] ) || empty( $_GET['_wpnonce'] ) ) { |
| | 1761 | return; |
| | 1762 | } |
| | 1763 | |
| | 1764 | // verify nonce |
| | 1765 | if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'bp-resend-activation' ) ) { |
| | 1766 | die( 'Security check' ); |
| | 1767 | } |
| | 1768 | |
| | 1769 | // fetch the signup ID |
| | 1770 | // note: this is different than the user ID |
| | 1771 | $signup_query = BP_Signup::get( array( |
| | 1772 | 'user_login' => $_GET['user'] |
| | 1773 | ) ); |
| | 1774 | |
| | 1775 | // no match, stop now! |
| | 1776 | if ( empty( $signup_query['signups'][0] ) ) { |
| | 1777 | return; |
| | 1778 | } |
| | 1779 | |
| | 1780 | // resend the activation email |
| | 1781 | // also updates the 'last sent' and '# of emails sent' values |
| | 1782 | $resend = BP_Signup::resend( array( $signup_query['signups'][0]->signup_id ) ); |
| | 1783 | |
| | 1784 | // add feedback message |
| | 1785 | if ( ! empty( $resend['errors'] ) ) { |
| | 1786 | $error = __( '<strong>ERROR</strong>: Your account has already been activated.', 'buddypress' ); |
| | 1787 | } else { |
| | 1788 | $error = __( 'Activation email resent!', 'buddypress' ); |
| | 1789 | } |
| | 1790 | } |
| | 1791 | add_action( 'login_form_bp-resend-activation', 'bp_members_login_resend_activation_email' ); |
| | 1792 | |
| | 1793 | /** |