DreamOn Posted July 31, 2021 Share Posted July 31, 2021 Hello everybody, It would be great if we could block the registration of a user if the Display Name he chose contains certain words that we consider prohibited. Thanks! Link to comment Share on other sites More sharing options...
Nathan Explosion Posted July 31, 2021 Share Posted July 31, 2021 Andy135 1 Link to comment Share on other sites More sharing options...
DreamOn Posted July 31, 2021 Author Share Posted July 31, 2021 Thanks @Nathan Explosion. But this does not prevent user to register but bans it only? Link to comment Share on other sites More sharing options...
Adriano Faria Posted July 31, 2021 Share Posted July 31, 2021 No, it prevents from using that word in the user name. Link to comment Share on other sites More sharing options...
Nathan Explosion Posted July 31, 2021 Share Posted July 31, 2021 Precisely - it does exactly what you are asking for. Link to comment Share on other sites More sharing options...
DreamOn Posted July 31, 2021 Author Share Posted July 31, 2021 Thanks, that's not what I'm looking for so 😕 Do you know which class or function should I modify (with a plugin) to verify the display name when registering? Link to comment Share on other sites More sharing options...
Miss_B Posted July 31, 2021 Share Posted July 31, 2021 18 minutes ago, DreamOn said: Thanks, that's not what I'm looking for so 😕 Do you know which class or function should I modify (with a plugin) to verify the display name when registering? What do you mean by verifying the display name? It already does that. Link to comment Share on other sites More sharing options...
DreamOn Posted July 31, 2021 Author Share Posted July 31, 2021 (edited) The setting just ban member after registration: public function profileSync() { [...] foreach ( \IPS\Db::i()->select( 'ban_content', 'core_banfilters', array( "ban_type=?", 'email' ) ) as $bannedEmail ) { if ( preg_match( '/^' . str_replace( '\*', '.*', preg_quote( $bannedEmail, '/' ) ) . '$/i', $this->value ) ) { throw new \DomainException( 'form_email_banned' ); } } Edited July 31, 2021 by DreamOn Link to comment Share on other sites More sharing options...
Nathan Explosion Posted July 31, 2021 Share Posted July 31, 2021 1 minute ago, DreamOn said: The setting just ban member after registration: No, it doesn't - it validates the display name while the user is trying to register: DreamOn 1 Link to comment Share on other sites More sharing options...
DreamOn Posted July 31, 2021 Author Share Posted July 31, 2021 (edited) 6 minutes ago, Nathan Explosion said: No, it doesn't - it validates the display name while the user is trying to register: OK thanks, I thought it checked after member registered! --- But I need to create a plugin because I want to use a list of forbidden words from txt file 🙂 It would be too long for me to add all forbidden words. Edited July 31, 2021 by DreamOn Link to comment Share on other sites More sharing options...
DreamOn Posted July 31, 2021 Author Share Posted July 31, 2021 Maybe I have to extend Member > profileSync() ? Link to comment Share on other sites More sharing options...
DreamOn Posted August 1, 2021 Author Share Posted August 1, 2021 Great, I managed to do what I wanted by extending usernameIsAllowed function in Login class. Thanks everybody! Link to comment Share on other sites More sharing options...
Recommended Posts