Description
Filters the default terms for user facing strings in the plugin. Can be used for managing translations.
Parameters
(array) (required) An array of any strings being changed from the defaults.
Defaults:
$defaults = array( // Login form. 'login_heading' => __( 'Existing Users Log In', 'wp-members' ), 'login_username' => __( 'Username or Email', 'wp-members' ), 'login_password' => __( 'Password', 'wp-members' ), 'login_button' => __( 'Log In', 'wp-members' ), 'remember_me' => __( 'Remember Me', 'wp-members' ), 'forgot_link_before' => __( 'Forgot password?', 'wp-members' ) . ' ', 'forgot_link' => __( 'Click here to reset', 'wp-members' ), 'register_link_before' => __( 'New User?', 'wp-members' ) . ' ', 'register_link' => __( 'Click here to register', 'wp-members' ), // Password change form. 'pwdchg_heading' => __( 'Change Password', 'wp-members' ), 'pwdchg_password1' => __( 'New password', 'wp-members' ), 'pwdchg_password2' => __( 'Confirm new password', 'wp-members' ), 'pwdchg_button' => __( 'Update Password', 'wp-members' ), // Password reset form. 'pwdreset_heading' => __( 'Reset Forgotten Password', 'wp-members' ), 'pwdreset_username' => __( 'Username', 'wp-members' ), 'pwdreset_email' => __( 'Email', 'wp-members' ), 'pwdreset_button' => __( 'Reset Password' ), 'username_link_before' => __( 'Forgot username?', 'wp-members' ) . ' ', 'username_link' => __( 'Click here', 'wp-members' ), // Retrieve username form. 'username_heading' => __( 'Retrieve username', 'wp-members' ), 'username_email' => __( 'Email Address', 'wp-members' ), 'username_button' => __( 'Retrieve username', 'wp-members' ), // Register form. 'register_heading' => __( 'New User Registration', 'wp-members' ), 'register_username' => __( 'Choose a Username', 'wp-members' ), 'register_rscaptcha' => __( 'Input the code:', 'wp-members' ), 'register_tos' => __( 'Please indicate that you agree to the %s Terms of Service %s', 'wp-members' ), // @note: if default changes, default check after wpmem_tos_link_txt must change. 'register_clear' => __( 'Reset Form', 'wp-members' ), 'register_submit' => __( 'Register', 'wp-members' ), 'register_req_mark' => '<span class="req">*</span>', 'register_required' => '<span class="req">*</span>' . __( 'Required field', 'wp-members' ), // User profile update form. 'profile_heading' => __( 'Edit Your Information', 'wp-members' ), 'profile_username' => __( 'Username', 'wp-members' ), 'profile_submit' => __( 'Update Profile', 'wp-members' ), 'profile_upload' => __( 'Update this file', 'wp-members' ), // Error messages and dialogs. 'login_failed_heading' => __( 'Login Failed!', 'wp-members' ), 'login_failed' => __( 'You entered an invalid username or password.', 'wp-members' ), 'login_failed_link' => __( 'Click here to continue.', 'wp-members' ), 'pwdchangempty' => __( 'Password fields cannot be empty', 'wp-members' ), 'usernamefailed' => __( 'Sorry, that email address was not found.', 'wp-members' ), 'usernamesuccess' => __( 'An email was sent to %s with your username.', 'wp-members' ), 'reg_empty_field' => __( 'Sorry, %s is a required field.', 'wp-members' ), 'reg_valid_email' => __( 'You must enter a valid email address.', 'wp-members' ), 'reg_non_alphanumeric' => __( 'The username cannot include non-alphanumeric characters.', 'wp-members' ), 'reg_empty_username' => __( 'Sorry, username is a required field', 'wp-members' ), 'reg_password_match' => __( 'Passwords did not match.', 'wp-members' ), 'reg_email_match' => __( 'Emails did not match.', 'wp-members' ), 'reg_empty_captcha' => __( 'You must complete the CAPTCHA form.', 'wp-members' ), 'reg_invalid_captcha' => __( 'CAPTCHA was not valid.', 'wp-members' ), 'reg_generic' => __( 'There was an error processing the form.', 'wp-members' ), 'reg_captcha_err' => __( 'There was an error with the CAPTCHA form.', 'wp-members' ), 'reg_file_type' => __( 'Sorry, you can only upload the following file types for the %s field: %s.', 'wp-members' ), // Links. 'profile_edit' => __( 'Edit My Information', 'wp-members' ), 'profile_password' => __( 'Change Password', 'wp-members' ), 'register_status' => __( 'You are logged in as %s', 'wp-members' ), 'register_logout' => __( 'Log out', 'wp-members' ), 'register_continue' => ( isset( $wpmem->user_pages['profile'] ) && '' != $wpmem->user_pages['profile'] ) ? __( 'Edit profile', 'wp-members' ) : __( 'Begin using the site.', 'wp-members' ), 'login_welcome' => __( 'You are logged in as %s', 'wp-members' ), 'login_logout' => __( 'Click to log out', 'wp-members' ), 'status_welcome' => __( 'You are logged in as %s', 'wp-members' ), 'status_logout' => __( 'click to log out', 'wp-members' ), 'menu_logout' => __( 'Log Out', 'wp-members' ), // Widget. 'widget_status' => __( 'You are logged in as %s', 'wp-members' ), 'widget_logout' => __( 'click here to log out', 'wp-members' ), 'widget_login_failed' => __( 'Login Failed!<br />You entered an invalid username or password.', 'wp-members' ), 'widget_login_failed_new' => __( 'Invalid username or password.', 'wp-members' ), // @todo New string replacement. Replace widget_login_failed when translated. 'widget_not_logged_in' => '', 'widget_login_username' => __( 'Username or Email', 'wp-members' ), 'widget_login_password' => __( 'Password', 'wp-members' ), 'widget_login_button' => __( 'log in', 'wp-members' ), 'widget_login_forgot' => __( 'Forgot?', 'wp-members' ), 'widget_login_register' => __( 'Register', 'wp-members' ), // Default Dialogs. 'restricted_msg' => __( "This content is restricted to site members. If you are an existing user, please log in. New users may register below.", 'wp-members' ), 'success' => __( "Congratulations! Your registration was successful.<br /><br />You may now log in using the password that was emailed to you.", 'wp-members' ), // @todo Under consideration for removal from the Dialogs tab. 'user' => __( "Sorry, that username is taken, please try another.", 'wp-members' ), 'email' => __( "Sorry, that email address already has an account.<br />Please try another.", 'wp-members' ), 'editsuccess' => __( "Your information was updated!", 'wp-members' ), // @todo These are defaults and are under consideration for removal from the dialogs tab, possibly as we change the password reset to a link based process. 'pwdchangerr' => __( "Passwords did not match.<br /><br />Please try again.", 'wp-members' ), 'pwdchangesuccess' => __( "Password successfully changed!", 'wp-members' ), 'pwdreseterr' => __( "Either the username or email address do not exist in our records.", 'wp-members' ), 'pwdresetsuccess' => __( "Password successfully reset!<br /><br />An email containing a new password has been sent to the email address on file for your account.", 'wp-members' ), 'product_restricted' => __( 'Sorry, your account does not have access to %s content', 'wp-members' ), ); // End of $defaults array.
Usage
Use this filter to change the plugin’s default text strings as needed. You only need to return the array keys being changed from the defaults.
The following example changes the default values for the form headings (login and registration):
add_filter( 'wpmem_default_text', function( $text ) { // Based on the default values, set an array value // for each of the text strings that you need changed. $text['login_heading'] = 'Log In to Your Account'; $text['register_heading'] = 'Register New Account'; return $text; });
Looking at the list of default values in the $text
array, you can use the framework of the above example to change as many or as few of the user facing strings as needed.
Changelog
Added in 3.2.7
Source
wpmem_default_text is located in includes/class-wp-members-dialogs.php