• I had a wordpress “classified ads” website called LakoMai.com. I was previously given a code that brings up an “alert” if users create ads with bad words on my “post an ad” page… That alert basically stops them from creating an ad with bad words on my site.

    This is the code I was given for that…

    <script>
    jQuery(document).ready(function($) {
    	$( "#MainSaveBtn" ).click(function() {
    		if ($("input:text[name='form[post_title]']").length > 0) {
    			var title = $("input:text[name='form[post_title]']").val();
    			var title = title.toLowerCase();
    		} else {
    			var title = "";
    		}
    		if ($("textarea[name='form[post_content]']").length > 0) {
    			var description = $("textarea[name='form[post_content]']").val();
    			var description = description.toLowerCase();
    		} else {
    			var description = "";
    		}
    		if ($("input:text[name='custom[post_tags]']").length > 0) {
    			var tags = $("input:text[name='custom[post_tags]']").val();
    			var tags = tags.toLowerCase();
    		} else {
    			var tags = "";
    		}
    		var badwords = ["badword1", "badword2", "badword3"];
    		var breakOut = false;
    		var usedwords = [];
    		var count = 0;
    
    		badwords.forEach(function(entry) {
    			if(title.indexOf(entry) !== -1 || description.indexOf(entry) !== -1 || tags.indexOf(entry) !== -1){
    				breakOut = true;
    				if(breakOut == true) {
    					usedwords[count++] = entry;
    				}
    			}
    		});
    
    		if(breakOut == true) {
    			alert("Your Listing Contains Inappropriate Words, Please Remove Them Before Posting This Ad.");
    			return false;
    		}
    	});
    });
    </script>

    Now I need something similar, but this time I need the code to bring up an “alert” if the user registers an account with us using a SPECIFIC email address or username. This happens on my Registration Page (click here). I would SERIOUSLY APPRECIATE any help on editing this code so that it is usable on my registration page for usernames and email address. I just want to stop certain people from creating accounts with specific usernames and email addresses. THANKS!!!!

The topic ‘Need HTML/CSS code that blocks users with specific email addresses or usernames’ is closed to new replies.