How to bulk change default send method for existing users?

dan_aka_jack - July 13, 2009 - 18:42
Project:Messaging
Version:6.x-2.1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Great module.

My site has about 150 users. I've just added the MIME Mail module. I'd like to send all future email notifications as an HTML email. How do I change the settings for all my existing users so they are all configured to use MIME mail? I don't really want to manually go through the edit page of all 150 users! I have looked in the MySQL database and the vital setting seems to be buried deep in the "data" field of the user table and my SQL skills aren't up to the task of swapping out just one character in that field.

Any thoughts?

Many thanks,
Jack

#1

dan_aka_jack - July 13, 2009 - 18:45
Project:Notifications» Messaging
Version:6.x-2.1» 6.x-2.1

#2

igorik - August 4, 2009 - 04:26

Good question, interesting for me too.
I have abut 8000 users on my site and I would like to change for everybody time interval.
Thanks
Igor
http://www.somvprahe.sk

#3

lelizondob - September 11, 2009 - 20:17

The same here. I like to change the time interval and the send method in +/- 1000 users. I think that the send method is controlled by messaging and the time interval is controlled by notifications (could be wrong).

I'm thinking that the only way to do this would be to uninstall notifications and reinstall, but I'm not 100% sure this will work since the info is in the 'users' table.

I also thought about creating some option with views_bulk_operations but right know is only an idea, I would need to start reading both modules to see if that's even possible.

Anyone has a better idea.

#4

jshuster@drupal.org - September 12, 2009 - 18:15

It looks like you can do this in php. Take a look at the function messaging_user_setting() in messaging.module; it looks like user settings are stored on the user object.

If you know php, you could configure one user account manually, then inspect the user object to see what account variables are set. Then write a simple function to loop through all users and set the account variable accordingly. You'd use the user_load() and user_save() functions -- see api.drupal.org for how these work. Of course, do this on a copy of your site first, and test test test.

#5

plan9 - September 13, 2009 - 02:14

I changed all of my users default send method to mime mail by running the following MySql query in phpMyAdmin:

UPDATE `notifications` SET `send_method` = 'mail';

To change the time interval you could run:

UPDATE `notifications` SET `send_interval` = '86400'; (or whatever time value).

Seems to do the trick, but (as always) backup your database before tampering with it and don't blame me if your site goes kaput afterwards.

#6

Jose Reyero - November 11, 2009 - 18:42
Status:active» fixed

Solution in #5 looks good.

#7

System Message - November 25, 2009 - 18:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.