vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   "Receive Email from Administrators": Which members have set this to "no"? (https://vborg.vbsupport.ru/showthread.php?t=293542)

John Lester 01-04-2013 05:31 PM

Quote:

Originally Posted by kh99 (Post 2394667)
It would be:
Code:

SELECT username FROM user WHERE options & 16 = 0

For the "Do not receive email notification upon new pms" change the 16 in the above code to 4096

WorldCraft 01-05-2013 08:29 AM

How do you know which option goes to which bit position value?

kh99 01-05-2013 12:46 PM

Quote:

Originally Posted by WorldCraft (Post 2394852)
How do you know which option goes to which bit position value?

The actual values are defined in the file includes/xml/bitfield_vbulletin.xml . The bits used in the user table options field are in a group named "useroptions". But you'd really have to look at the code to figure out which value does what (well, for some you might be able to guess).

Another way you can find out some of the values is to go (in the admicp) to Maintenance > Execute SQL Query, and look at the Automatic Query list. There are automatic queries to set all users to receive admin emails or not, so if you select one of those queries you can see how it's changing the database. If you choose "Yes - Receive Admin Emails" and press continue, you'll see this:
Code:

UPDATE user SET options = options + 16 WHERE NOT (options & 16)

and you can tell from that that the value you want for that option is 16. (BTW, you can choose a query from the Automatic Query menu and press Continue, and it will show you the query but not execute it unless you press Continue again).

WorldCraft 01-06-2013 08:29 AM

Thanks Kevin, great information. :)

licensinglinks 01-06-2013 10:21 AM

Thanks all for your help.

Quote:

Originally Posted by kh99 (Post 2394667)
It would be:
Code:

SELECT username FROM user WHERE options & 16 = 0

Quote:

Originally Posted by John Lester (Post 2394708)
For the "Do not receive email notification upon new pms" change the 16 in the above code to 4096

This all worked perfectly. Cheers!

Now I have another question that's related to this. Basically I have set up some custom profile buttons for members' communication preferences. They are simple Yes/No radio buttons:


(1) Newsletter subscription (monthly): Yes/No
(2) Digest subscription (weekly): Yes/No
(3) Promotional email subscription (monthly): Yes/No


I have set every member to "Yes" for both, but I want to change everyone who doesn't receive admin emails to "No" for (1), (2) and (3) and everyone who doesn't want PM notification to "No" for (2). This is to ensure I don't annoy anyone with unwanted emails.

Can anyone please advise what queries I would need to run to do this?

Simon Lloyd 01-06-2013 12:13 PM

Custom profile fields are are in the userfield table, to alter those its something like
PHP Code:

UPDATE`userfield`SET`fieldX`='No' WHERE`fieldX` =Yes

so change fieldX to your field number like field10. Dont forget to change the userfield for how it is in your database, if you used a prefix "vb_" then it would be vb_userfield, if you used a prefix say "xy" then it would look like this xyuserfield.

licensinglinks 01-06-2013 04:53 PM

So if, for example, I want to change people everyone who doesn't receive admin emails to "No" for newsletter subscription it would be:

PHP Code:

UPDATE`userfield`SET`field15`='No' WHERE`field16` =Yes

(Custom profile field for newsletter subscription (Yes/No) is field15)

Something doesn't seem right about the above code. Shouldn't field 16 =0 ?

kh99 01-06-2013 05:24 PM

You'd need something like:
Code:

UPDATE user LEFT JOIN userfield USING(userid)
  SET fieldX='No', fieldY='No', fieldZ='No'
  WHERE (options & 16) = 0


and
Code:

UPDATE user LEFT JOIN userfield USING(userid)
  SET fieldY='No'
  WHERE (options & 4096) = 0


of course you need to set X, Y, and Z to the actual ids.


All times are GMT. The time now is 12:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01057 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete