BTW: I managed to edit the activation e-mail to include the username. But still no good solution.
Hi @zenimot
See 5185 for some background and a discussion on the topic.
Thanks.
Still can’t believe no warning is shown. Strange.
But fixed it by editing the input field, so only letters and numbers are possible to type.
And a message above the field.
Nasty workaround…
@zenimot
If you wanted to, you could disallow spaces in usernames by validating the field during registration. This is how you’d do it:
function zenimot_validate_username() {
$bp = buddypress();
if ( strpos( $_POST['signup_username'], ' ' ) !== false ) {
$bp->signup->errors['signup_username'] = __( 'Spaces are not allowed', 'buddypress' );
}
}
add_action( 'bp_signup_pre_validate', 'zenimot_validate_username' );
I added that snip to the bottom of the PLUGIN bbpress.php, NOT the THEME functions.php
I am going to scrounge to see how I can add that warning to the top of the page in the welcome.
I think it’s better to give registrants and newbies a break by warning them to not use spaces BEFORE they try first to register instead of frustrating them ‘neener neener’ after they do it wrong (don’t ya think?)
at wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/index.php
at line 46 then and 66 I added the following 2 edits in bold
/** This action is documented in bp-templates/bp-legacy/buddypress/activity/index.php */
do_action( ‘template_notices’ ); ?>
<p><?php _e( ‘Registering for this site is easy. Just fill in the fields below, and we\’ll get a new account set up for you in no time. NO-SPACES-ALLOWED-IN-USER-NAMES. If you have an EXISTING ACCOUNT try logging in with Username (one-word) instead of User Name‘, ‘buddypress’ ); ?></p>
<?php
/**
* Fires before the display of member registration account details fields.
*
* @since BuddyPress (1.1.0)
*/
do_action( ‘bp_before_account_details_fields’ ); ?>
<div class=”register-section” id=”basic-details-section”>
<?php /***** Basic Account Details ******/ ?>
<h4><?php _e( ‘Account Details’, ‘buddypress’ ); ?></h4>
<label for=”signup_username”><?php _e( ‘Username NO SPACES‘, ‘buddypress’ ); ?> <?php _e( ‘(required)’, ‘buddypress’ ); ?></label>
<?php
`
Edit as you wish