vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Decoding Bitfield for Custom Use (https://vborg.vbsupport.ru/showthread.php?t=153786)

Muppettt 07-30-2007 12:15 PM

Decoding Bitfield for Custom Use
 
Hey,

I'm currently making a custom usercp (outwith vB but including certain parts/files into it). I'm trying to reproduce the options page and notice vB stores all the option data into a bitfield.

How can i 'decode' the bitfield to show what options a user currently has set? I know i can select the data using

PHP Code:

SELECT usernameemail FROM user WHERE options 16 

so that would display everyone with adminemail set to ON, but how would i make it so that it pulls the options bitfield and 'decode' that to show what features the user currently has ON (as in text outputs - 16 = Receive Admin Emails). I assume there would be an array somewhere with all the pertinent data?

And i assume for UPDATING the user table with the a new adminemail option (if changed) it would be:

PHP Code:

UPDATE user SET options options 16 WHERE (options 16) AND userid 123 


Muppettt 08-01-2007 03:29 PM

Anyone?

Marco van Herwaarden 08-01-2007 03:57 PM

You can find most bitfield values in Updating Options En Masse with Queries

-=Sniper=- 08-01-2007 06:01 PM

excellent :) thanks that might come in use.

Marco van Herwaarden 08-01-2007 07:11 PM

It has been there for a very long time. ;)


All times are GMT. The time now is 01:08 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.00934 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete