PDA

View Full Version : imported another db, want to add those users to subscribers


Loco
10-04-2009, 04:20 PM
Hello,

I've imported a couple databases with my forum and I want all those users to be subscribers to the newsletter.
I went to

admincp > gaz > tools >subscription tools > Subscribe all users > yes

but it didn't add the 4,000 users I imported (which are now in the registered user group)
do I need to upgrade GAZ or something to get this working, or maybe update another setting?

I have version 2.0.2

Thanks for the help
-Brandon

Loco
10-05-2009, 11:13 PM
anyone?
is there a support ticket system here or anything?

thx

Morgan
10-07-2009, 03:52 PM
Nope, no ticket system. The vB import is for vB, not for add-ons, so importing isn't going to change the GAZ database tables. You could uninstall and then reinstall GAZ but that means you would need to reset all your newsletters and issues, or you could code something to add the new users to the gaz_subscriptions database table where a value of one in the newsletterX columns means that the userid in the same row is subscribed to newsletter X.

Loco
10-08-2009, 12:23 AM
Hello thanks for the answer

I know the vb importer isn't going to work with gaz, what does this setting do?
admincp > gaz > tools >subscription tools > Subscribe all users > yes
the way I read it is it will subscribe all users

I had thought about uninstalling gaz and reinstalling, this may be the way I go

I'm not much of a coder, so I wouldn't know the first place to look to make my own extension.

Loco
10-09-2009, 03:09 AM
hi again

how about a sql query that I could ran in the vb maintenance area? :o

Morgan
10-09-2009, 03:50 PM
Untested but follow these steps in order:

TRUNCATE TABLE TABLE_PREFIXgaz_subscriptions;

INSERT INTO TABLE_PREFIXgaz_subscriptions (userid, emailformat) SELECT userid, 1 FROM TABLE_PREFIXuser;

ACP -> GAZ -> Tools -> Newsletter subscription tools -> Subscribe all users -> Yes for every newsletter that is listed

This should add and subscribe everyone. You should also temporarily turn off new registrations while doing this so no one slips through while you are running these queries.

Riverwire
10-21-2009, 02:55 PM
Loco did you ever figure this out , ive got the same problem and that SQL Query didnt seem to work

Loco
10-23-2009, 01:00 AM
I've actually had the flu the last week, so I haven't had time to mess with it.
Could we get a modified version of the query and have all users who have "yes" to receive admin emails, set to subscribe to the newsletter? That would fit my needs better

thanks.

Morgan
10-23-2009, 05:56 PM
Untested but follow these steps in order:

TRUNCATE TABLE TABLE_PREFIXgaz_subscriptions;

INSERT INTO TABLE_PREFIXgaz_subscriptions (userid, emailformat, newsletter1) SELECT userid, 1, 1 FROM TABLE_PREFIXuser WHERE options & 16;

INSERT INTO TABLE_PREFIXgaz_subscriptions (userid, emailformat, newsletter1) SELECT userid, 1, 0 FROM TABLE_PREFIXuser WHERE NOT options & 16;

This should add everyone to the gaz_subscriptions table and subscribe those to newsletter1 that are set to receive admin emails. You will need to look at the fields in the gaz_subscriptions table to determine what you should use in place of newsletter1 in the above queries, and do queries two and three for each newsletter field. You should also temporarily turn off new registrations while doing this so no one slips through while you are running these queries.

Loco
10-30-2009, 11:42 PM
Awesome, thanks for your time Morgan!
I'll reply and update when it works
I'll make a database backup before hand just in case I jack something up.

Thanks again, you're my hero right now :)

Loco
06-22-2010, 06:30 PM
okay, I know it's been a while since I've been here but I have this question again

what does this setting do?

admincp > gaz > tools >subscription tools > Subscribe all users > yes

doesn't it subscribe all users to the newsletter?

thx


ps.. I ran the query's and only show 30 subscribers
when I sent an email out earlier this week, it was 1800 or so
How can I get these 1800 setup on the newsletter?

thx

Morgan
06-24-2010, 08:29 PM
Subscribe all users does this:

if ($action == 'savesubscriptiontools')
{
$vbulletin->input->clean_array_gpc('p', array(
'formatall' => TYPE_UINT,
'subscribeall' => TYPE_ARRAY_BOOL
));

$format = $vbulletin->GPC['formatall'];
$subscribe = $vbulletin->GPC['subscribeall'];

if ($format)
{
$db->query_write("UPDATE " . TABLE_PREFIX . "gaz_subscriptions SET emailformat = " . intval($format));
}

if (count($subscribe))
{
foreach($subscribe AS $newsletterid => $value)
{
$newsletterid = intval($newsletterid);
$db->query_write("UPDATE " . TABLE_PREFIX . "gaz_subscriptions SET newsletter$newsletterid = 1");
}
}

redirect('tools', 'gaz_saved');
}

It depends on what queries you ran. The values in the newsletterX columns in the gaz_subscriptions table are 1 for subscribed and 0 for not.