/** * Filters a user's display name before the user is created or updated. * * @since 2.0.3 * * @param string $display_name The user's display name. */ $display_name = apply_filters( 'pre_user_display_name', $display_name );
And
* @global string $user_identity The display name of the user
// user_login must be between 0 and 12 characters. if ( empty( $user_login ) ) { return new WP_Error( 'empty_user_login', __( 'Cannot create a user with an empty login name.' ) ); } elseif ( mb_strlen( $user_login ) > 12 ) { return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 12 characters.' ) ); }
AND
/* * If a nicename is provided, remove unsafe user characters before using it. * Otherwise build a nicename from the user_login. */ if ( ! empty( $userdata['user_nicename'] ) ) { $user_nicename = sanitize_user( $userdata['user_nicename'], true ); if ( mb_strlen( $user_nicename ) > 12 ) { return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 12 characters.' ) ); } } else { $user_nicename = mb_substr( $user_login, 0, 12 ); }
/** * Filters a user's nicename before the user is created or updated. * * @since 2.0.3 * * @param string $user_nicename The user's nicename. */ $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
$user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login ) );
if ( $user_nicename_check ) { $suffix = 2; while ( $user_nicename_check ) { // user_nicename allows 12 chars. Subtract one for a hyphen, plus the length of the suffix. $base_length = 11 - mb_strlen( $suffix ); $alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix"; $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login ) ); $suffix++; } $user_nicename = $alt_user_nicename; }
AND
/** * Filters a user's display name before the user is created or updated. * * @since 2.0.3 * * @param string $display_name The user's display name. */ $display_name = apply_filters( 'pre_user_display_name', $display_name );
Codes work on WP Core. But if we use the Forum Registration, will hunt code there.
Will also have to change the verbiage on the registration page. It shows there 3 to 15.
I’ll change it to 3 to 12. This is because of the Error Code above, which says
– Couldn’t register you, Contact the Site Admin
That can be solved by just saying use a username between 3 to Maximum 12 (otherwise you’ll receive an error that says ” Couldn’t register you, Contact the Site Admin”)
Username length must be between 3 characters and 15 characters.
Click Edit
Changed it to
Username *
Length must be between 3 characters and 12 characters. Use the Name as you would like it to appear in posts, comments, and likes. (example: JoeSmith or JoeS or Joe, or joe)
Hide Display Name (an oxymoron)
CODE:
/*Do not display Display Name Label & Text Field - PROFILE PAGE*/
Hi Alvina, Thanks for responding and getting your developers to look into this. In the meantime, I have temporarily used the code below to hide the “Display Name” from the Account Profile. I thought I would share it here, in case others might want to use it too.
I found it important because I saw another portal get heavily spammed and when I noticed they were using WP, I tested it on our forums too.
I was able to tweak the WP Core user file, so our WP site now has only 12 character limits for the Username (which on the forum, gets duplicated into the “Display Name” and the “Nickname” fields by default).
The issue I see in the form at the Member’s Account Profile, on the “Display Name” text field, it seems to not have a maxlength character limit on the field itself, so if anyone inputs extremely long Display Name, it will break the forum layout (“Profile“, “Post” Box, and the “Likes” as shown in above screenshot).
So in the mean time, I put the codes below (Forum Settings > Styles > Custom CSS)
/*Do not display Display Name Label & Text Field - PROFILE PAGE*/ div.wpf-field.wpf-field-type-text.wpf-field-name-display_name.wpf-field-required { display: none; }
And since the Nickname field also has a maxlength of 50 characters, it also protrudes through the comment box, and does not look good so, I also added this code below:
/*Automatically adjust long Nicenames or Nicknames to responsively fit smaller screens – COMMENT BOX*/
I switched the Top Container to white at SH. The white bar shows up on the latest version 1.8.4. 🙂
So I changed the settings on the WP Theme. (I am so happy I made our own here, I know JUST where to tweak in a moment!)
{
background-color: white;
}
I also did this … (and helping other Admins with it)
———
Hi Dok ,
I looked at your attached screenshot above, and thought I’d type out a suggestion you can try.
Have you tried the wpForo’s “Phrases” functionality? It’s awesome and highly customizable. For your use case, maybe you can also try to edit the “Topic Title” and add your text there? Just go to…
1) Forum Dashboard 2) Phrases 3) On the “Front-end Phrases” Search box, type “Topic Title” 4) Under the Phrase key, hover your mouse, so the Edit appears 5) Then on the Phrase Key, you wish to edit, in this example “Topic Title” , delete the Phrase key and just change it to “Topic Title (ideally, with maximum of 50 characters)” (as an example) 6) Then save.
You can do the same process for “Attach File” and “Topic Tags”
Might be a workaround. (I did that for my forum to remind members to be mindful of the length of their topics) 🙂
Good luck and God bless you! 🙂
I think I am done with the helpaholic mode, LOL!
This is good to go to open to announced and scheduled Registrations, then closed after a specific time.
I’ll copy the tweaks I did on here, and put it on SH. 🙂
Over an out.
That in ALL things God will be glorified. (And we can always help others along the way… 🙂
What the code does is it grabs the title of whatever page you are at, and you can easily share.
Do not sell the code. I’m sharing it here so other Christians who are not selling anything on their sites can use it. To protect their website visitors from other snoopathons from other plugins or themes.
Test Topic
For General Discussions Forum
Customized Share Buttons for SH and CLG
Here’s a better Share Code. Final (bigger icons that pop out of the box slightly …. )
Display Name
OLD CODE:
And
Will test Registration New User
NewUsero1012
NewUsero10123456789
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70cccccccc80
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70cccccccc80
– The Username Registration cuts of at 30
– Couldn’t register you, Contact the Site Admin
Testing 30
– Couldn’t register you, Contact the Site Admin
NewUsero10cccccccc20cccccccc30
– Couldn’t register you, Contact the Site Admin
Testing up to 16
– Couldn’t register you, Contact the Site Admin
Testing up to 15
NewUserc10ccc15
– Couldn’t register you, Contact the Site Admin
Because I set it up to the Core file to default at 12
Testing 12
NewUserccc12
IT WORKED!
Check Registration Email
Got this from wordpress@CLG:
Username: NewUserccc12
To set your password, visit the following address:
Where you can set your new password.
Then now, Let’s test the Nickname again, will change from
default (and allowable max of 12 characters)
Nickname (which copies the username)
newuserccc12
Changing to
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70cccccccc80
– User Data update failed … let’s see the max for this
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70
– User Data update failed … let’s see the max for this
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60
– User Data update failed … let’s see the max for this
NewUsero10cccccccc20cccccccc30cccccccc40cccccccc50
Max for Nickname that displays is 50
I’ll dig dipper into the code again …
NEW CODES (wp-includes > user.php)
AND
AND
AND
Codes work on WP Core. But if we use the Forum Registration, will hunt code there.
Will also have to change the verbiage on the registration page. It shows there 3 to 15.
I’ll change it to 3 to 12. This is because of the Error Code above, which says
That can be solved by just saying use a username between 3 to Maximum 12 (otherwise you’ll receive an error that says ” Couldn’t register you, Contact the Site Admin”)
Plugin Editor > wpforo > wpf-themes > classic > register.php
OR
Forum > Phrases
Do a search on “15”
This will display
Username length must be between 3 characters and 15 characters.
Click Edit
Changed it to
Hide Display Name (an oxymoron)
CODE:
Tested this Display Name:
CrisWwww10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70cccccccc80cccccccc90ccccccc100
If not for the earlier code I put, it would break the Account Profile Page.
The Likes would be interesting…
Testing the nickname
CrisWwww10cccccccc20cccccccc30cccccccc40cccccccc50cccccccc60cccccccc70cccccccc80cccccccc90ccccccc100
– User Data update failed.
criswwww10cccccccc20cccccccc30cccccccc40cccccccc50
– Max Length at 50. This also has to be reduced to 12.
OK I put the code back. 🙂
For the Nicenames / URL , I added this code and it should stay.
OK Will share this with other Admins.
Hi Alvina, Thanks for responding and getting your developers to look into this. In the meantime, I have temporarily used the code below to hide the “Display Name” from the Account Profile. I thought I would share it here, in case others might want to use it too.
I found it important because I saw another portal get heavily spammed and when I noticed they were using WP, I tested it on our forums too.
I was able to tweak the WP Core user file, so our WP site now has only 12 character limits for the Username (which on the forum, gets duplicated into the “Display Name” and the “Nickname” fields by default).
The issue I see in the form at the Member’s Account Profile, on the “Display Name” text field, it seems to not have a maxlength character limit on the field itself, so if anyone inputs extremely long Display Name, it will break the forum layout (“Profile“, “Post” Box, and the “Likes” as shown in above screenshot).
So in the mean time, I put the codes below (Forum Settings > Styles > Custom CSS)
And since the Nickname field also has a maxlength of 50 characters, it also protrudes through the comment box, and does not look good so, I also added this code below:
/*Automatically adjust long Nicenames or Nicknames to responsively fit smaller screens – COMMENT BOX*/
I hope that the Developers can look into the max-length of the field names for “Display Name” and “Nickname”.
Thanks! God bless you! 🙂
Related:
How to hide some fields in the user's Account Profile
https://wpforo.com/community/how-to-and-troubleshooting-2/trouble-when-removing-social-networks-fields-in-profile/#post-28480
I switched the Top Container to white at SH. The white bar shows up on the latest version 1.8.4. 🙂
So I changed the settings on the WP Theme. (I am so happy I made our own here, I know JUST where to tweak in a moment!)
{
background-color: white;
}
I also did this … (and helping other Admins with it)
———
Hi Dok ,
I looked at your attached screenshot above, and thought I’d type out a suggestion you can try.
Have you tried the wpForo’s “Phrases” functionality? It’s awesome and highly customizable. For your use case, maybe you can also try to edit the “Topic Title” and add your text there? Just go to…
1) Forum Dashboard
2) Phrases
3) On the “Front-end Phrases” Search box, type “Topic Title”
4) Under the Phrase key, hover your mouse, so the Edit appears
5) Then on the Phrase Key, you wish to edit, in this example “Topic Title” , delete the Phrase key and just change it to “Topic Title (ideally, with maximum of 50 characters)” (as an example)
6) Then save.
You can do the same process for “Attach File” and “Topic Tags”
Might be a workaround. (I did that for my forum to remind members to be mindful of the length of their topics) 🙂
Good luck and God bless you! 🙂
I think I am done with the helpaholic mode, LOL!
This is good to go to open to announced and scheduled Registrations, then closed after a specific time.
I’ll copy the tweaks I did on here, and put it on SH. 🙂
Over an out.
That in ALL things God will be glorified. (And we can always help others along the way… 🙂
Removing my funny looking nicename now.
@criswwww10cccccccc20cccccccc30cccccccc40cccccccc50
My code snippets work!
I have changed the Share Codes
from THIS (Yup I made that! It’s not an extra plugin!)
And Added our BRAND NEW CLG Share Code! Woo hoo!!!
What the code does is it grabs the title of whatever page you are at, and you can easily share.
Do not sell the code. I’m sharing it here so other Christians who are not selling anything on their sites can use it. To protect their website visitors from other snoopathons from other plugins or themes.
Test Topic
For General Discussions Forum
Customized Share Buttons for SH and CLG
Here’s a better Share Code. Final (bigger icons that pop out of the box slightly …. )
Remove the Topic Title from the Phrases. Shows up on the Forum (and not on the Add Topic area)
Removed
” (ideally, with maximum of 50 characters)”