|
From: Alexandre L. <ale...@le...> - 2006-03-21 15:33:04
|
Hi list, Here's what I want to do: change the setting of all my users and the default setting for "Journal Entry by Friend" and "Journal Reply" to 'email' by default. This is found in Messages user preferences. The related tables are users_messages and message_codes. mysql> describe users_messages; +-------+-----------------------+------+-----+--------- +----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-----------------------+------+-----+--------- +----------------+ | id | int(11) | | PRI | NULL | auto_increment | | uid | mediumint(8) unsigned | | MUL | 0 | | | code | int(11) | | | 0 | | | mode | tinyint(4) | | | 0 | | +-------+-----------------------+------+-----+--------- +----------------+ 4 rows in set (0.00 sec) mysql> select * from users_messages where uid='3'; +-----+-----+------+------+ | id | uid | code | mode | +-----+-----+------+------+ | 929 | 3 | 0 | 0 | | 928 | 3 | 1 | 0 | | 927 | 3 | 4 | 0 | | 930 | 3 | 5 | 0 | | 926 | 3 | 7 | 0 | | 925 | 3 | 11 | 0 | +-----+-----+------+------+ 6 rows in set (0.00 sec) mysql> select * from message_codes; +------+----------------------------+---------+-------+------------ +-----------+-------+ | code | type | seclev | modes | send | subscribe | acl | +------+----------------------------+---------+-------+------------ +-----------+-------+ | -2 | Registration Mail | 1 | 0 | now | 0 | | | -1 | Unknown Message | 1 | 0 | now | 0 | | | 0 | Daily Newsletter | 1 | 0 | now | 0 | | | 1 | Daily Headlines | 1 | 0 | now | 0 | | | 2 | Metamoderation Results | 1 | | collective | 0 | | | 3 | Comment Moderation | 1 | | collective | 0 | | | 4 | Comment Reply | 1 | | now | 0 | | | 5 | Journal Entry by Friend | 1 | | now | 0 | | | 6 | New Submission | 100 | 0 | now | 0 | | | 7 | Journal Reply | 1 | | now | 0 | | | 8 | New Comment | 1000000 | | now | 0 | | | 10 | Daily Site Stats | 100 | 0 | now | 0 | stats | | 11 | Email Story | 1 | 0 | now | 0 | | | 12 | Relationship Change | 1 | | collective | 1 | | | 13 | Bad login attempt warnings | 1 | 1 | now | 0 | | | 14 | Daily Moderation Stats | 100 | 0 | now | 0 | stats | | 18 | Invalid HTML Input | 100 | | now | 0 | | +------+----------------------------+---------+-------+------------ +-----------+-------+ 17 rows in set (0.00 sec) I am not really a sql pro, but I guess to set the default values to 'email' I should do: >update messages_codes set modes='0' where code='5'; >update messages_codes set modes='0' where code='7'; Now, in order to change existing accounts (about 450) settings, I must update the users_messages table and add mode='0' to code='5' and '7' to all uid with an incremental 'id'. Is this needed or does the messages_codes table update enough? How do you suggest I proceed? Thanks a lot! Alex http://slashgeo.org - In+ersec+ion for Spatial People News and discussions about GIS, Remote Sensing and everything geospatial. |