[How-To] vBulletin API Basics: Variables, Functions, Objects
vBulletin API Basics: Variables, Functions, Objects
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. $vbulletin (Type: Object) Contains vBulletin data that has been in separate variables in vB 3.0.x. Below you can find a translation table of changed variables and functions. This is an expanded version of the list that you can find in vBulletin's source code (functions_legacy.php). vBulletin 3.0.3 locations are on the left hand side, and the corresponding vBulletin 3.5.0 locations are on the right hand side. Legacy locations can be enabled by running legacy_enable(), although this is officially not recommended for long term compatibility. Code:
* $vboptions['x'] --> $vbulletin->options['x']
$db (Type: Object) As you might have judged from the Table 1 in this tutorial, the database object in vB3.5 is $vbulletin->db. However, $db is another way to access that object; it is the way that used everywhere unless you call it from within a function. In functions, use $vbulletin->db. Obviously, the purpose of the database method is to perform various operations on the database. Most common methods are described below.
Data Managers Data Managers (DMs) are an interface to various data objects used within vBulletin. They enforce necessary constraints and administrator-set options on the data to ensure that the data is valid. You can read more about Data Managers in vBulletin's online manual. Also, you can read specifically about the User DM in this KirbyDE's How-To, and about Thread DM here. Authentication Storage The authentication data is stored in the following way (thank to Kirby for this info): $_COOKIE: {cookiepfx}userid - plain(userid) {cookiepfx}password - md5(md5(md5('PlaintextPassword') . salt) . 'LicenseNo'). TABLE user: password - md5(md5('PlaintextPassword') . salt) Note that for cookie, {cookiepfx} is your board's cookie prefix. It is configurable via admincp and is accessible via the COOKIE_PREFIX constant. Important Functions
>> EOD |
this is my first subscribed thread (no email notifications).
in other way, i bookmarked. Thank You so much, DV! |
very handy. thanks.
|
Excellent!!
|
NICE work Dark Visor. :D
|
Very nice! Bookmarking for future references :)
Great job. Matt |
Thanks everyone for feedback.
Tutorial has been updated with two pairs of emendations to the $db class documentation: - $db->escape_string(); + $db->escape_string_like(); - $db->show_errors(); + $db->hide_errors(); |
Brilliant - I've actually bookmarked this thread. Why do Jelsoft make it so bloody difficult for people? I've been looking for some simple software documentation on this type of thing and it's just "not provided".
Many thanks, keep up the good work! Keith L |
Not bad young grasshoper. Not bad at all. :)
|
Quote:
|
Quote:
|
Quote:
Pass it on as a link to this thread. |
Quote:
If I was gonna have a vbulletin 3.5 change tutorial on my site I would definatly make my own. |
Quote:
|
Quote:
Anyway thanks for the great tutorial :) |
Quote:
Quote:
|
I need to make a query (from the table user) that returns an array and the key of the array would be the userid and the value would be the value of another field in the database (eg referrerid).
For example if the array is $array and the users with userid 100, 200, 300 have a referrerid of 1,1 and 50 respectively that array should have the values $array[100]=1 $array[200]=1 $array[300]=50 Is that hard? How can I do it without adding many queries? Thanks a lot in advance :) edit: [offtopic] OMG I just saw you are 16!!! Wow! I'd never had expected that! I thought you were about 25+! OMG, most 16 year olds in Greece do not know how an opening tag of php is and generally they only care about playing games... Of course there are exeptions, like my bf which is in that age but still there is a huge difference... OMG, I still can't believe it! [/offtopic] Nevermind, I figured out another way to get the results I wanted :) |
That could be done with just one query. :)
PHP Code:
Quote:
EDIT: Quote:
|
Something similar but WAY more messy than yours :o
However the 100,200,300 where just examples, in an actual forum it should go through all the userids :) Well, that's not very hard to change, I'll just put instead of your WHERE a WHERE referrerid>0 (cause I want it to only return the users with a referrer) :) Thanks so much!! That's much more organized than my code. I'm still trying to figure out how those SQL things work, it's quite hard :nervous: edit: And it works too! Woo hoo!! :D Thanks, thanks, thanks!!! :D :D :D |
np, and what are you trying to make, if it's not a secret? :)
|
I'm trying to make a mod to display referrer statistics, so that a forum can have referrer contests etc. I've seen this requested many times in the modification requests and I would also like it for my forum. :)
I have lots of learning to do though in order to make it, but I'm determined :p :p |
Quote:
EDIT: Yes, I thought so. They have it, but they do not release it anymore: http://www.talkloud.net/forums/vbsta...on=memberrefer :( |
Thanks so much!!! :D
How can I ask you if I have a question? In this thread or via pm? :nervous: I wish I could code for hours today, I am really eager to do it but I have a trip so I have to start packing in about an hour, so I'll continue working at night when I arrive (it's 6:46 in the morning here) :) Anyway, when I really want to make something I can sit at the computer for hours till I make it, lol :p I made smilie maker in one night and for my (low) level of knowledge that's an achievement :p Quote:
Anyway mine will be better :p OMG I am totally insane! :p I postponed my trip 5 hours so I can work at the script! LOOOOOOOOOOL!!! :p |
Quote:
Quote:
Quote:
Quote:
Update: Added "Authentication Storage" section, based on a random Kirby's post that I've found. |
I hope someone here can help me :( I have a hack that stopped working after upgrading to 3.5.1. I have already made the change for "db" from "DB_site", but this page seems to still be having a problem:
http://www.familycorner.com/forums/contest.php3 You will see if you scroll down to where it says "Posts Today" in a purple box that the total number of posts are missing. This is what the post count is calling from: PHP Code:
THANK YOU! Sorry, I should have posted this as well. This code is at the top of the page, just under the body tag: PHP Code:
PHP Code:
|
Some screenshot please?
|
Not exactly related to the first post but some things I find very very useful when coding.
At the bottom of includes/functions.php I have the following: PHP Code:
All of the above were taken off user comments at php.net Usages: PHP Code:
Extremely useful for seeing what vB knows at any point, especially if you need to call some of that data. A tip: don't pre($vbulletin), it's really messy. PHP Code:
PHP Code:
PHP Code:
PHP Code:
These are all bound to your IP or localhost to save unnecessary outputting to the board. |
Quote:
|
Thank you for pointing that out. Corrected.
|
Thanks for taking the time to put this together anthony, i have been using it as a reference quite frequently.
|
Yup. :)
|
Quote:
Code:
md5(md5('PlaintextPassword'), salt) Code:
md5(md5('PlaintextPassword'). 'salt') I'd be keen on getting some clarification on this, cheers :D |
I got that from Kirby's post and haven't actually verified the information, but you are most likely correct.
|
Yep you need a . instead of , otherwise things will go horribly wrong.
|
Quote:
|
Hi Psionic Vision, do you know what do I wrong?
Here is the code: PHP Code:
Thank you |
Quote:
Second question - don't know, sorry. Post in modification questions please. |
holy cow, how did i miss this thread.............
|
Any updates for 3.7 on this article? Looking to get some documentation as I am trying to write a hack but am completely stumped when it comes to vBulletin and writing hacks for it.
|
most of the stuff herein still applies to 3.7
|
All times are GMT. The time now is 10:48 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|