WordPress.org

Ready to get started?Download WordPress

Forums

Newsletter Sign-Up
Change Error Message based on URL? (1 post)

  1. Souljah67
    Member
    Posted 1 year ago #

    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();                  
    
    		if(isset($_POST['nsu_submit']))
    		{
    			$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) {
                 	$this->send_post_data($email,$name,'form');
                 }
    		}
    		return;
    	}

    Thanks

    http://wordpress.org/extend/plugins/newsletter-sign-up/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.