Newsletter Import

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
filou
Posts: 8
Joined: Wed 26. Jan 2005, 13:04

Newsletter Import

Post by filou »

Hi,

ich habe 3 Newsletter angelegt.
Jetzt möchte ich meine vorhandenen Abonnenten importieren.
Leider kann ich nur 2 Felder importieren: Name und Email.
Wie importiere ich welchen Newsletter der importierte Abonnent bekommt?

I put on 3 newsletter.
Now I would like to import the existing receivers.
Unfortunately I can import only 2 fields: Name and email.
How do I import which Newsletter of the imported receivers get?
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

this is not implemented - talked about that 1 or more Year ago
only way is to 'manipulate' the Database by Hand with phpMyAdmin - also the 'verified' Field must set by Hand :(
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
filou
Posts: 8
Joined: Wed 26. Jan 2005, 13:04

Post by filou »

Hi Horst,

Danke für den Hinweis.
Das sind keine guten Nachrichten.
Ich habe über 20.000 Adressen?
Gibt es vielleicht die Möglichkeit für jeden Newsletter eine eigene Datenbank anzulegen?
Oder eine andere Lösung?
Danke für jeden Tip.

Those are not good messages.
I have over 20.000 addresses?
Is an own data base for each letter possible?
Or is there another solution?
Thanks for each tip.
hal
Posts: 66
Joined: Mon 9. Feb 2004, 22:07

Post by hal »

I have a problem quite silimar:

I have imported adresses and want to assign combinations of 3 different types of subscriptions: Either No 1 only, or No 2 or No 3 only or a combination from 2 of them or all three.

But before the reason I came to that: Besides from importing I had some subscribers who signed in by themselves. Some of them belong to the company staff, some are customers. Then I created a newsletter for our staff and sent it (so I thought) only to the subscribers who signed in on a special staff signin page, that was never availabe for someone else.

Guess what - all my customers had the invitation for the staffmeeting in their mailboxes :x . And this was the origin of the work described below - as I wanted to understand the system in order to correct the recipients entries.

First I found out that in the database the subscription information is saved IN BLOB FORMAT :shock: . Why???

Anyway - I then started to figure out how to extract that BLOB stuff and this is what I found out:

Code: Select all

First subscription only is:       a:1:{i:0;s:1:"1";}
Second subscription only:         a:1:{i:0;s:1:"2";}
Third subscription only:          a:1:{i:0;s:1:"3";}

a combination from 1 and 2:       a:2:{i:0;s:1:"1";i:1;s:1:"2";}
or from 2 and 3:                  a:2:{i:0;s:1:"2";i:1;s:1:"3";}
or from 1 and 3:                  a:2:{i:0;s:1:"1";i:1;s:1:"3";}

or all three:                     a:3:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";}

signing in for alltogether results in: a:1:{i:0;i:0;}
But I suppose that each value in the blob field that makes no sense to the system will result in a sent newsletter for this particular person.

I finally managed to re-import this data and re-create the correct BLOBS.

For this I backuped the phpwcms_adress table, emptied it and copied a set of "test" recipients with the different BLOBs for the entries listed above into this table.

Guess what - it didn't work! It displays them appropriately in the "subscribers" section but does not send them any newsletters.

Now my questions:

1. How could it happen that all customers got the staff-newsletter although I only marked the "staff" checkbox when sending it?????

2. Is there a way to find out why my "reimport" trick doesn't work

3. WHY A BLOB??? - couldn't it have been so easy just to assign a number to each subscription, fill these numbers with a delimiter into a text field of the phpwcms_adress table and have the system check the number for the appropriate recipients/ newsletters.

Please anyone help, (maybe it will have to be Oliver) - the newsletter feature as it is now seems to be pretty useless if not dangerous when using more than just one subscription.

And it could be soooo nice :cry:
sebby
Posts: 28
Joined: Thu 28. Apr 2005, 00:31

Import multiple users to different subscription 1.2.8

Post by sebby »

Hello all:

Here is quick fix that worked for me when importing multiple users into different 'phpWCMS subscriptions' (v1.2. 8 ).

Although BLOB is not the most common format, I realized that the data was a simple array that was serialized before being added into the database...

BEFORE YOU START, BACKUP CORRESPONDING FILES AND DB!

[OPEN /include/inc_tmpl/message.subsribersimport.tmpl.php]

Code: Select all

-- REPLACE--
list($cvs['csv'][$csv_count][0], $cvs['csv'][$csv_count][1]) = explode($delimeter, $value);

Code: Select all

-- WITH --
list($cvs['csv'][$csv_count][0], $cvs['csv'][$csv_count][1], $cvs['csv'][$csv_count][2]) = explode($delimeter, $value);

Code: Select all

-- AFTER --
$csv[$csv_count][0] = trim($cvs['csv'][$csv_count][0]);
$csv[$csv_count][1] = trim($cvs['csv'][$csv_count][1]);
$csv[$csv_count][0] = preg_replace('/^["|\']{0,1}(.*?)["|\']{0,1}$/', "$1", $cvs['csv'][$csv_count][0]);
$csv[$csv_count][1] = preg_replace('/^["|\']{0,1}(.*?)["|\']{0,1}$/', "$1", $cvs['csv'][$csv_count][1]);
$csv[$csv_count][0] = trim($cvs['csv'][$csv_count][0]);
$csv[$csv_count][1] = trim($cvs['csv'][$csv_count][1]);

Code: Select all

-- ADD--
$csv[$csv_count][2] = explode(',',trim($cvs['csv'][$csv_count][2]));

Code: Select all

-- REPLACE --
$sql  = "INSERT INTO ".DB_PREPEND."phpwcms_address SET ";
$sql .= "address_key='".generic_string(16)."', ";
$sql .= "address_email='".aporeplace($csv[$csv_key][0])."', ";
$sql .= "address_name='".aporeplace($csv[$csv_key][1])."', ";
$sql .= "address_verified='1';";

Code: Select all

-- WITH --
$sql  = "INSERT INTO ".DB_PREPEND."phpwcms_address SET ";
$sql .= "address_key='".generic_string(16)."', ";
$sql .= "address_email='".aporeplace($csv[$csv_key][0])."', ";
$sql .= "address_name='".aporeplace($csv[$csv_key][1])."', ";
$sql .= "address_verified='1', ";
$sql .= "address_subscription='".aporeplace(serialize($csv[$csv_key][2]))."';"; 

YOU ARE DONE! For multiple import from a text file, just add a comma separated list of the subscriptions into the third column (put 0 for subscribers included in all mailings). So the format is the following:
myname@email.com;My full name;2,4,6
Check your DB to know the ID the system attributed to your different subsriptions.

Test your setup while disabling the mail in /include/inc_act/act_sendnewsletter.php:

Code: Select all

/*if(!$mail->Send()) {
	$_SESSION['false'] .= 'ERR: '.$key.' ('.html_specialchars($mail->ErrorInfo).')<br>';
	} else {*/
	//echo '. ';
	echo $key.'; ';
	flush();
	//}
This will prevent sending mail while you are testing and display the subsribers included in your different lists, so you can check if your import worked.

Here is another way to check the integrity of your data (put this file into your inc_act directory):

Code: Select all

require_once ('../../config/phpwcms/conf.inc.php');
require_once ('../inc_lib/default.inc.php');
require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
require_once (PHPWCMS_ROOT.'/include/inc_lang/backend/en/lang.inc.php');
if($_SESSION["wcs_user_lang_custom"]) { //use custom lang if available -> was set in login.php
	include_once (PHPWCMS_ROOT.'/include/inc_lang/backend/'.$_SESSION["wcs_user_lang"].'/lang.inc.php');
}

?>
<html>
<head>
<title>phpwcms: Send Newsletter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><pre><?php

	//get all recipients
		$sql = "SELECT * FROM ".DB_PREPEND."phpwcms_address WHERE address_verified=1;";
		if($result = mysql_query($sql, $db)) {
		
			while($row = mysql_fetch_assoc($result)) {
		
			print_r($row).'<br />';
			$i = unserialize($row['address_subscription']);
			print_r($i);

	
	}
}

?>
</pre></body>
</html>
Let me know what you think !

seb
User avatar
Oliver Georgi
Site Admin
Posts: 9920
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

coming release has a completely reworked newsletter part - sort, import, export, filter, edit and so on. Check the nightly build (search forum).

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
sebby
Posts: 28
Joined: Thu 28. Apr 2005, 00:31

Post by sebby »

Hi:

I can not implement the nightly build just yet as my phpWCMS projects are all live.

I look forward to the new release ! :D

Kind Regards,

Seb
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Post by phalancs »

Hey Oliver!
Is there a possibility to update only the newsletter part of phpwcms? I mean is the newsletter system a pretty isolated part with relatively independent files, or would the changes go too deep into the system?

It would be no problem to do database changes and file replaces. What do you think?

I fear I cannot update my live sites to the nightly build :O

Thanx in advance
2008
User avatar
Oliver Georgi
Site Admin
Posts: 9920
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

use winmerge and compare

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Post by phalancs »

Just wanted to mention that this thread helped me a lot, now I managed to implement the newsletter subscription into the registration CP. Although its was not that easy, it now works.

Anyways I had difficulties with "partial update". I wonder if thers another 1.2.9 midnight release, cause newsletter did not properly work in mine.

Doesnt matter anymore. Got time to wait now ;)

BUT: I wonder why but I now can only send one newsletter per session. If I already have sent one and then try to edit an existing one or create a new one date is always set to 1970 and no saving or sending is possible.

Whats that????? I guess it must have something to do with database settings such as "timestamp" (I did not touch core files). Am I right? What to do?

UPDATE: I replaced the phpwcms_newsletter with the original strucute from sql_init and the 1970 error is not there anymore, but it is still not perfect:

After having send a newsletter if I then try to create a new one on of the channels is already selected and cannot be changed, saving does not work. If I log out and in agin its all fine. Any idea???

I feel like it takes data from somewhere I dont know :S OR is there something within the session?
2008
User avatar
Oliver Georgi
Site Admin
Posts: 9920
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

the newslettr part in 129 available for you is NOT final.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
jscholtysik

Post by jscholtysik »

Hi Oliver,


when IS the 1.2.9 FINAL?


Joachim
Post Reply