Changeset 10982
- Timestamp:
- 08/02/2016 05:44:09 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-catchuri.php
r10899 r10982 699 699 700 700 /** 701 * Add an error message to wp-login.php. 702 * 703 * Hooks into the "bpnoaccess" action defined in bp_core_no_access(). 701 * Add a custom BuddyPress no access error message to wp-login.php. 704 702 * 705 703 * @since 1.5.0 706 * 707 * @global string $error Error message to pass to wp-login.php. 708 */ 709 function bp_core_no_access_wp_login_error() { 710 global $error; 704 * @since 2.7.0 Hook moved to 'wp_login_errors' made available since WP 3.6.0. 705 * 706 * @param WP_Error $errors Current error container. 707 * @return WP_Error 708 */ 709 function bp_core_no_access_wp_login_error( $errors ) { 710 if ( empty( $_GET['action'] ) || 'bpnoaccess' !== $_GET['action'] ) { 711 return $errors; 712 } 711 713 712 714 /** … … 718 720 * @param string $value URL to redirect user to after successful login. 719 721 */ 720 $error = apply_filters( 'bp_wp_login_error', __( 'You must log in to access the page you requested.', 'buddypress' ), $_REQUEST['redirect_to'] ); 721 722 // Shake shake shake!. 723 add_action( 'login_head', 'wp_shake_js', 12 ); 724 } 725 add_action( 'login_form_bpnoaccess', 'bp_core_no_access_wp_login_error' ); 722 $message = apply_filters( 'bp_wp_login_error', __( 'You must log in to access the page you requested.', 'buddypress' ), $_REQUEST['redirect_to'] ); 723 724 $errors->add( 'bp_no_access', $message ); 725 726 return $errors; 727 } 728 add_filter( 'wp_login_errors', 'bp_core_no_access_wp_login_error' ); 729 730 /** 731 * Add our custom error code to WP login's shake error codes. 732 * 733 * @since 2.7.0 734 * 735 * @param array $codes Array of WP error codes. 736 * @return array 737 */ 738 function bp_core_login_filter_shake_codes( $codes ) { 739 $codes[] = 'bp_no_access'; 740 return $codes; 741 } 742 add_filter( 'shake_error_codes', 'bp_core_login_filter_shake_codes' ); 726 743 727 744 /**
Note: See TracChangeset
for help on using the changeset viewer.