vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to decode user options (https://vborg.vbsupport.ru/showthread.php?t=82533)

hardwareirc.com 06-05-2005 05:21 AM

How to decode user options
 
Hello,
I would like to use my forum for mailing list purposes too, and I want to send emails only to the members that have the "Receive emails" option enabled.

I looked on the vbulletin 3 database, and I saw that the user options preferences are coded with a number, so it's quite difficult to see which number represents the desire to receive emails...

Can anyone help me "decoding" the number?

Thanks ;)

Andreas 06-05-2005 09:18 AM

The user options are just a bitfield.
From init.php
PHP Code:

// Defined constants used for user field.
$_USEROPTIONS = array(
    
'showsignatures'    => 1,
    
'showavatars'       => 2,
    
'showimages'        => 4,
    
'coppauser'         => 8,
    
'adminemail'        => 16


So if you want to get all users which have this options enabled;:

[sql]SELECT username, email FROM user WHERE options & 16[/sql]

hardwareirc.com 06-05-2005 04:04 PM

Quote:

Originally Posted by KirbyDE
The user options are just a bitfield.
From init.php
PHP Code:

// Defined constants used for user field.
$_USEROPTIONS = array(
    
'showsignatures'    => 1,
    
'showavatars'       => 2,
    
'showimages'        => 4,
    
'coppauser'         => 8,
    
'adminemail'        => 16


So if you want to get all users which have this options enabled;:

[sql]SELECT username, email FROM user WHERE options & 16[/sql]

Great ;)
It works fine :D

hardwareirc.com 06-08-2005 10:01 AM

Hi guys, I'm not familiar with bitfields... There's a way to set the bit #16 to 0 with just a mysql query?

Thanks ;)

Andreas 06-08-2005 11:16 AM

Yes. Bit #16 = 2^15 = 32768
[sql]UPDATE table SET field=field-32768 WHERE field & 32768[/sql]

Or to set it where it is not set
[sql]UPDATE table SET field=field+32768 WHERE NOT (field & 32768)[/sql]

Paul M 06-08-2005 11:22 AM

Except, I think he means the bit valued at 16, not the 16th bit . In the above options case the value should be 16. :)

Andreas 06-08-2005 11:26 AM

But he said bit #16 ;)

Paul M 06-08-2005 11:28 AM

Quote:

Originally Posted by KirbyDE
But he said bit #16 ;)

Technically Yes, because he doesn't understand bit fields - read the posts and I think you will agree with me. :)

hardwareirc.com 06-08-2005 11:48 AM

Quote:

Originally Posted by Paul M
Technically Yes, because he doesn't understand bit fields - read the posts and I think you will agree with me. :)

hmmm... well, could you explain me bitfields in order to avoid any further doubts? :P

or where could I find more info? google doesn't help :(

Paul M 06-08-2005 11:54 AM

Correct me if I'm wrong - but you want to set the 'adminemail' option (which is bit 5, value 16) to zero ?


All times are GMT. The time now is 03:10 AM.

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.02402 seconds
  • Memory Usage 1,735KB
  • 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
  • (2)bbcode_php_printable
  • (3)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
  • (10)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