Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Add Multiple Options Per User (via Bitfields)
akanevsky
Join Date: Apr 2005
Posts: 3,972

by akanevsky akanevsky is offline 20 May 2006

Create Multiple Options Per User (via Bitfields)

This How-To should serve as a reference to coders, who have a basic knowledge of PHP and who want to make their own mods.
Help on writing hacks will NOT be provided, and any such posts will be ignored.

Whereever it says mybitoptionsfield, you'll need to replace that with the actual fieldname that you are going to use.
  • The following step is to create bitfield xml for vBulletin.
    Create a file named bitfield_myproductid.xml, where myproductid is the id of your product, with the following content, in ./includes/xml/:
    Note: In the <bitfield> tag, name="" must contain the desired title of the option. You are going to use that title to access the options later on. The title must contain ALPHANUMBERIC characters only, and it should not contain spaces. The digit in between the opening and closing <bitfield> tags is the bit value. Each consecutive bit value must be 2 x (Previous Value). Sample valid sequence: 1, 2, 4, 8, 16, 32.

    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to define installation process of the bitfield in your product.
    Create a new product and add the following codes as install and uninstall, respectively:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to have the new options fetched together with userinfo.
    Create a plugin @ fetch_userinfo with the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to add new options to UserCP Option Page on Template Level.
    In template modifyoptions, add the following code whereever you want the options to appear:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to add new options to UserCP Option Page on Code Level.
    Create a plugin @ profile_updateoptions with the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to add new options to AdminCP User Manager.
    Create a plugin @ useradmin_edit_column1 with the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to have the new options saved when the button is clicked.
    Create a plugin @ useradmin_update_save with the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  • The following step is to have the new bitfield added to the vBulletin_User_Dm.
    Create a plugin @ userdata_start with the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.


Once done, rebuild your btifields.
Now, you should be able to access the new options simply by using $userinfo['mybitoptiontitle'].

>> EOD

Last edited by akanevsky; 22 Jun 2013 at 15:11..
Views: 6546
Reply With Quote
Comments
  #2  
Old 20 May 2006, 13:14
-=Sniper=-'s Avatar
-=Sniper=- -=Sniper=- is offline
 
Join Date: May 2002
bookmarked thanks dude
Reply With Quote
  #3  
Old 20 May 2006, 14:40
Logikos Logikos is offline
 
Join Date: Jan 2003
You saved the day! Thank you very much Anthony!
__________________
Full Time PHP Developer
Please feel free to contact me if you have any paid work to be done.
Reply With Quote
  #4  
Old 28 May 2006, 16:31
rogersnm's Avatar
rogersnm rogersnm is offline
 
Join Date: Apr 2006
Location: Cyberspace, UK
Real name: Nick Rogers
i just get

Invalid File Specified

when i try to import the xml product file containing:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #5  
Old 28 May 2006, 16:34
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
Don't import that file, place it under ./includes/xml/ of your forum (filename should be: bitfield_myproductid.xml).
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #6  
Old 28 May 2006, 16:45
rogersnm's Avatar
rogersnm rogersnm is offline
 
Join Date: Apr 2006
Location: Cyberspace, UK
Real name: Nick Rogers
ahh thanks for the quick response

btw myproductid is myproductid

lol
Reply With Quote
  #7  
Old 28 May 2006, 16:54
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
You should use a unique string as your product id, not keep the default one. Two product with the same product id cannot co-exist.
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #8  
Old 28 May 2006, 17:04
rogersnm's Avatar
rogersnm rogersnm is offline
 
Join Date: Apr 2006
Location: Cyberspace, UK
Real name: Nick Rogers
yeah i am just testing i will change afterwards.

do you know how to get 2 radio buttons yes or no?
Reply With Quote
  #9  
Old 28 May 2006, 17:06
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
Please refer to the following text from the first post:

Help on writing hacks will NOT be provided, and any such posts will be ignored.
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #10  
Old 28 May 2006, 17:07
rogersnm's Avatar
rogersnm rogersnm is offline
 
Join Date: Apr 2006
Location: Cyberspace, UK
Real name: Nick Rogers
so how am i supposed to learn
Reply With Quote
  #11  
Old 28 May 2006, 17:13
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
You could start by referring to the following thread:
http://www.vbulletin.org/forum/showthread.php?t=99570

Also, if you have specified questions, post them in "Modifications Questions" forum.
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #12  
Old 28 May 2006, 17:14
rogersnm's Avatar
rogersnm rogersnm is offline
 
Join Date: Apr 2006
Location: Cyberspace, UK
Real name: Nick Rogers
already have. lol ....
Reply With Quote
  #13  
Old 26 Feb 2008, 12:07
Cloud-Warrior's Avatar
Cloud-Warrior Cloud-Warrior is offline
 
Join Date: Feb 2002
A great tutorial!

I had two issues, that others might also run into:

* you might have to execute the querys from step 2 manually (as i followed all the steps here to create the product, and didn't acually "install" it via the import product button)

* If you want to create a plugin that changes the template (instead of manually inserting the code into the template modifyoptionslike in step 4) you have to do some extra things - explained in this thread
Reply With Quote
  #14  
Old 26 Jan 2010, 16:06
SorentoUltimate's Avatar
SorentoUltimate SorentoUltimate is offline
 
Join Date: Jul 2009
Real name: Giorgos
Very Good Article
Reply With Quote
  #15  
Old 29 Jan 2010, 02:05
Neo_obs Neo_obs is offline
 
Join Date: Mar 2006
Real name: Jeff Baldwin
I have a side question, I know it says no help will be provided. But I want to have an option like "Enable Override" and then my options would override the usergroup options. For instance, if enable override is on and voting is off, the user can't vote whether they have usergroup permissions or not. If the voting is on then they can vote whether they have usergroup permissions or not. This way I can allow certain users to vote even if their usergroup doesn't allow it, or deny them access to vote even if their usergroup allows it.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 20:29.

Layout Options | Width: Wide Color: