Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by NotGoddess
I assume you are using Image Handler 2.0 for v1.3 (Tim Kroeger) ?
Taking a quick look I don't see any overlap.
I'll check when I get to my dev machine in a few hours, but I don't see the connect. I have IH2 on a cart and haven't run into issues.
The function that checks for a valid email is:
zen_validate_email() which is in includes/functions/functions_email.php
Are you familiar with using WinMerge or similar file diff utility? If so you can try comparing the contrib to the existing files to see if any has changed.
Pay special attention to the file includes/modules/pages/subscribe/header_php.php as that is where the check is performed.
Unfortunately it's not something I can diagnose from here. :(
-Ng_
[oann- looks like you'll want the sidebox width patch. on my site or outlined in this thread (just need a few spaces or br's before input/submit)]
I am wondering if this might be the cause of the issues I am having with the mod. I installed a products type mod that Moku created.
He said:
Quote:
You may have to change the default ID for "product_type_id". The default I used
is "7", but please manually check that this ID is not already used on your
"zc_product_types" table!
This might be causing the issue instead of image handler.
Re: Newsletter-Only Subscriptions for v1.3x
I have another question, I don't have HTML TEXT-Only in my newsletter subscription sidebox. How do I get those to show up?
Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by ctcentralinfo
I installed a products type mod that Moku created.
I'd advise you to compare these to files:
/includes/modules/pages/subscribe/header_php.php
/includes/functions/functions_email.php
and compare them to what is included in the contribution (use WinMerge or your fave diff utility).
The first file does all the validation, and the second has the function (zen_validate_email) that the first calls. Either the function is not being called, or it was changed somewhere.
Something I did notice is that I failed to add a 'default' fallback-ie you go to main_page=subscribe and don't have the post value 'act' set, the email won't get added to the database, but you do get the 'thanks for subscribing' message.
(*bonk*) I will fix this in the next release (out Sunday-ish).
Check your subscription manager to see if they fake emails are actually being added. If they aren't this is most likely the issue (tho if it is then you get to investigate why you suddenly are sending some, but not all post info, since the page is also sent via post).
Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by ctcentralinfo
I have another question, I don't have HTML TEXT-Only in my newsletter subscription sidebox. How do I get those to show up?
Check your email settings. The option only shows up if you enable HTML mail in your admin settings (if you choose not to send HTML mail, then it defaults to text).
-Ng_
Re: Newsletter-Only Subscriptions for v1.3x
First of all I would like to say you create a great mod. That being said I have know idea why this the function is not being called. These are the files. I used both winmerge and textpad and Nothing seems to be wrong. Here are the files:
includes/modules/pages/subscribe/header_php.php
Quote:
} elseif (zen_validate_email($email_address) == false) {
$error = true;
$messageStack->add('subscribe', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
// check if email address exists in CUSTOMERS table or in SUBSCRIBERS table
$check_cust_email_query = "select count(*) as total from " . TABLE_CUSTOMERS .
" where customers_email_address = '" . zen_db_input($email_address) . "'";
$check_cust_email = $db->Execute($check_cust_email_query);
$check_news_email_query = "select count(*) as total from " . TABLE_SUBSCRIBERS .
" where email_address = '" . zen_db_input($email_address) . "'";
$check_news_email = $db->Execute($check_news_email_query);
if ($check_cust_email->fields['total'] > 0) {
$error = true;
$messageStack->add('subscribe', SUBSCRIBE_DUPLICATE_CUSTOMERS_ERROR);
} elseif ($check_news_email->fields['total'] > 0) {
$error = true;
$messageStack->add('subscribe', SUBSCRIBE_DUPLICATE_NEWSONLY_ERROR);
} else {
// we generate a random confirmation code so we can use it as an
// extra security measure to prevent spoofs/scams.
$confirm_code = substr(base64_encode(crypt(str_shuffle(time()))),4,6);
$db->Execute('insert into ' . TABLE_SUBSCRIBERS .
' (email_address, email_format, subscribed_date, confirmed) ' .
"VALUES ('".$email_address."', '".$email_format."', now(), '".$confirm_code."')"
);
// Send confirmation request.
// get the proper uri
$confirm_uri = zen_href_link(FILENAME_SUBSCRIBE_CONFIRM, 'confirm='.$confirm_code.'&email=' . $email_address, 'NONSSL');
// initial welcome
$email_text .= EMAIL_WELCOME;
$html_msg['EMAIL_WELCOME'] = str_replace('\n','',EMAIL_WELCOME);
// add in regular email welcome text
$email_text .= "\n\n" . EMAIL_TEXT . sprintf(EMAIL_CONFIRMATION_TEXT, $confirm_uri ). EMAIL_CONTACT . EMAIL_CLOSURE;
$html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\n','',EMAIL_TEXT );
$html_msg['EMAIL_CONFIRMATION_LINK'] = str_replace('\n','', sprintf(EMAIL_CONFIRMATION_TEXT, '<a href="'.$confirm_uri.'">'.$confirm_uri.'</a>' ));
$html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
$html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_CLOSURE);
// include create-account-specific disclaimer
$email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
$html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
// send welcome email
zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletter_subscription');
}
}
}
$breadcrumb->add(NAVBAR_TITLE);
?>
includes/functions/functions_email.php
Quote:
function zen_validate_email($email) {
$valid_address = true;
// fail if contains no @ symbol
if (!strstr($email,'@')) return false;
// split the email address into user and domain parts
// need to update to trap for addresses in the format of "first@last"@someplace.com
// this method will most likely break in that case
list( $user, $domain ) = explode( "@", $email );
$valid_ip_form = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';
$valid_email_pattern = '^[a-z0-9]+[a-z0-9_\.\'\-]*@[a-z0-9]+[a-z0-9\.\-]*\.(([a-z]{2,6})|([0-9]{1,3}))$';
//preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9\._-]+)+$/', $email))
//preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is');
$space_check = '[ ]';
// strip beginning and ending quotes, if and only if both present
if( (ereg('^["]', $user) && ereg('["]$', $user)) ){
$user = ereg_replace ( '^["]', '', $user );
$user = ereg_replace ( '["]$', '', $user );
$user = ereg_replace ( $space_check, '', $user ); //spaces in quoted addresses OK per RFC (?)
$email = $user."@".$domain; // contine with stripped quotes for remainder
}
// fail if contains spaces in domain name
if (strstr($domain,' ')) return false;
// if email domain part is an IP address, check each part for a value under 256
if (ereg($valid_ip_form, $domain)) {
$digit = explode( ".", $domain );
for($i=0; $i<4; $i++) {
if ($digit[$i] > 255) {
$valid_address = false;
return $valid_address;
exit;
}
// stop crafty people from using internal IP addresses
if (($digit[0] == 192) || ($digit[0] == 10)) {
$valid_address = false;
return $valid_address;
exit;
}
}
}
if (!ereg($space_check, $email)) { // trap for spaces in
if ( eregi($valid_email_pattern, $email)) { // validate against valid email patterns
$valid_address = true;
} else {
$valid_address = false;
return $valid_address;
exit;
}
}
return $valid_address;
}
?>
Re: Newsletter-Only Subscriptions for v1.3x
okay. do this to confirm if it might be the issue I described above (act='subscribe' post field not passing):
edit the subscribe/header_php.php file:
Comment out line 31 and add if(1) { below it like so:
Code:
// if (isset($_POST['act']) && ($_POST['act'] == 'subscribe')) {
if(1) {
If it now gives an error about the email, reply back w/ which error.
-Ng_
Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by NotGoddess
okay. do this to confirm if it might be the issue I described above (act='subscribe' post field not passing):
edit the subscribe/header_php.php file:
Comment out line 31 and add if(1) { below it like so:
Code:
// if (isset($_POST['act']) && ($_POST['act'] == 'subscribe')) {
if(1) {
If it now gives an error about the email, reply back w/ which error.
-Ng_
I just clicked subscribe without adding anything,
This is the error I am getting
Quote:
Is your email address correct? It should contain at least 6 characters. Please try again.
Re: Newsletter-Only Subscriptions for v1.3x
What that indicates is that the 'act' and 'email' etc aren't getting passed at all.
I just noticed that you have 'nice' urls. I'm wondering if the sefu is doing it...
edit the sidebar template and change the 'post' to 'get'
includes/templates/yourTemplate/sideboxes/tpl_subscribe.php ::
Code:
$content .= zen_draw_form('subscribe', zen_href_link(FILENAME_SUBSCRIBE, '', 'SSL'), 'get', '');
You should then see the email/act in the browser address bar.
-Ng_
Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by NotGoddess
What that indicates is that the 'act' and 'email' etc aren't getting passed at all.
I just noticed that you have 'nice' urls. I'm wondering if the sefu is doing it...
edit the sidebar template and change the 'post' to 'get'
includes/templates/yourTemplate/sideboxes/tpl_subscribe.php ::
Code:
$content .= zen_draw_form('subscribe', zen_href_link(FILENAME_SUBSCRIBE, '', 'SSL'), 'get', '');
You should then see the email/act in the browser address bar.
-Ng_
You are right, I turned off the sefu urls and changed the files you originally told me to mod back and it started to work fine.
This is the URL I got when I changed 'post' tp 'get'
but I still didn't get the error I wanted.
Re: Newsletter-Only Subscriptions for v1.3x
Quote:
Originally Posted by sleepless
I was able to set this up and added my email addresses. It doesn't recognize newsletter only subscribers.
Hi, I have set up the newsletter subscribe and it seems to be storing the emails correctly which is great! Now I am wanting to send an email newsletter to these subscribers only but the newsletter manager doesn't seem to recognise them, only the customers that have signed up. From what I understand, this isn't possible with the addon and I can only email them individually? or am I missing something?