Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @dgtalgoodies

    This requires customization on your end. You can try adding the following code snippet to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code:

    function um_021422_errors_hook__blockedwords( $args ) {
    	$words = UM()->options()->get( 'blocked_words' );
    	if ( empty( $words ) ) {
    		return;
    	}
    
    	$words = strtolower( $words );
        $words = array_map( 'rtrim', explode( "\n", $words ) );
        $key = "nickname";
        if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( strtolower( $args[ $key ] ), $words ) ) {
            UM()->form()->add_error( $key, __( 'You are not allowed to use this word as your nickname.', 'ultimate-member' ) );
        }
    	
    }
    add_action( 'um_submit_form_errors_hook__blockedwords', 'um_021422_errors_hook__blockedwords', 9999 );
    add_action( 'um_submit_form_errors_hook__profile', 'um_021422_errors_hook__blockedwords', 9999 );

    Regards,

    Thread Starter dgtalgoodies

    (@dgtalgoodies)

    Hi there, thanks for reaching out ??

    I have just installed a snipped plugin to try the code but it gives an error.

    `Don’t Panic
    The code snippet you are trying to save produced a fatal error on line 2:

    syntax error, unexpected ‘&’
    The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.

    Thank you.

    Thread Starter dgtalgoodies

    (@dgtalgoodies)

    Sorry, my bad, it’s because I copied from the email I receive and some of the characters changed, I will now test this.

    Thread Starter dgtalgoodies

    (@dgtalgoodies)

    Thank you so much @champsupertramp it works, ?? I really appreciate the time you took to help.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know how it resolved your issue.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Blacklist Words’ is closed to new replies.