Support » Plugin: Newsletter Sign-Up » Change Error Message based on URL?

  • Hi, great plugin works amazing! I am using it on a multi-site installation and I was wondering if it is possible to make the error messages for First Name and Email Address change based on the url you are on?

    So I have the signup on the English and French mult-site installation and everything is translated on the French side except for the error messages. I have been using a plugin called CodeStyling Localization and this plugin doesn’t get picked up by it so I can’t set it up in there, is it possible to get it to work in that?

    Or I have used this code on other plugin elements and it checks the url and based on if the url has certain text it will display what you put in. Would it be possible to integrate this code into the NewsletterSignUp.php file?

    $uri = $_SERVER['REQUEST_URI'];
    if ( strpos($uri,'french') !== false ) {
       echo 'French Text';
    } else {
       echo 'English Text';

    Can that code be integrated into this section of code?

    * Check if ANY Newsletter Sign-Up form has been submitted.
    	function check_for_form_submit()
            $opts = $this->options['form'];
            $errors = array();                  
    			$email = (isset($_POST['nsu_email'])) ? $_POST['nsu_email'] : '';
    			$name = (isset($_POST['nsu_name'])) ? $_POST['nsu_name'] : '';			
    			if(isset($this->options['mailinglist']['subscribe_with_name']) && $this->options['mailinglist']['subscribe_with_name'] == 1 && isset($opts['name_required']) && $opts['name_required'] == 1 && ($name== "First Name *" || $name== "Prénom *")) {
    				$errors['name-field'] = 'Please fill in the name field.';
                if(empty($email)) {
                    $errors['email-field'] = 'Please fill in the email address field.';
                } elseif(!is_email($email)) {
                    $errors['email-field'] = 'Please enter a valid email address.';
                $this->validation_errors = $errors;
                 if(count($this->validation_errors) == 0) {


  • The topic ‘Change Error Message based on URL?’ is closed to new replies.