View Full Version : Connector API for vBulletin
Noodles24
04-28-2006, 10:00 PM
What it does
Allows you to access vBulletin functions and data through an API. This is useful if you want to tie vBulletin into a larger site and allow the users to only have 1 login for site/forum.
Allows other applications to edit data in vBulletin
Warning
This API opens up a lot of the internal functions of vBulletin, use it carefully and do not trust any input from the browser. Clean and validate your inputs!
Installation
Unzip the files into your the root of your forum
You may need to change
/* User changable options */
// change this to your forum path.
$forumroot = $_SERVER['DOCUMENT_ROOT']."forum";
/* end of User changable options */
in the connector.class.php if your forum doesn't sit in /forum/ on your site.
[0.02]
Added addUser function
Added delUser function
Added getUser function
Added editUser function
Cleaned up code
Added comments
Fixed warnings in 3.5.4
Fixed PHP4 incompatability
[0.01]
Initial quick dirty release.
Includes basic API
Allows login/logout through API
TODO:
Error checking function(s)
Forum listings
Topic/Post listings
Connector
04-29-2006, 12:51 AM
what can i use this for ?
Noodles24
04-29-2006, 01:13 AM
So far you can use it to log users in and out from your webpage, outside of vbulletin
I'm still expanding it to do more though
DeMiNe0
04-29-2006, 04:55 AM
Could you post an example of how someone would do that with this hack?
Floris
04-29-2006, 10:05 AM
yourstuff.php <-APIplugin-> vBulletin
(login)-------------^------(login)
^-- mental screenshot
Paul M
04-29-2006, 10:32 AM
yourstuff.php <-APIplugin-> vBulletin
(login)-------------^------(login)
Huh ?
Snake
04-29-2006, 12:08 PM
I'm not sure what's the use of this. :ermm:
Blaine0002
04-29-2006, 12:48 PM
external login for your webpage that ISNT vbulletin.
Noodles24
04-29-2006, 10:46 PM
Today I'm adding:
- edit user
- delete user
- add user
To come:
- list forums
- latest posts
Any requests?
akanevsky
04-29-2006, 10:52 PM
public function...
This will only work with php5. I recommend you make it compatible w/ php4, else it won't prove useful to most users.
Noodles24
04-29-2006, 11:44 PM
Ok thanks, I'll look into that
eXaulz
04-30-2006, 12:02 AM
I think functions like:
list forums
list posts in x forum
list new posts in either all forums or by id
etc..
should just return an Array. Echo'ing or return'ing a table/pre-desgined design wouldn't really be useful. Returning a fetched_array would be MUCH better.
[email protected]
vbmenu_register("postmenu_969884", true);
05-08-2006, 03:59 PM
is it working with 3.54? anyone made it work?
Its returning lots of errors with previous declared constants and such.
[email protected]
vbmenu_register("postmenu_970056", true);
05-08-2006, 08:05 PM
Sorry, now i have a full detailed error
Upon configuration and run this script on 3.54 i got the following.
Notice: Undefined index: HTTP_REFERER in /forum/includes/class_core.php on line 1574
Notice: Undefined index: charset in /connector/connector.class.php on line 54
Notice: Undefined variable: specialtemplates in /connector/connector.class.php on line 65
Notice: Undefined index: url in /forum/includes/class_core.php on line 1992
Notice: Undefined index: HTTP_REFERER in /forum/includes/class_core.php on line 1998
Notice: Constant IPADDRESS already defined in /forum/includes/class_core.php on line 1542
Notice: Constant ALT_IP already defined in /forum/includes/class_core.php on line 1546
Notice: Constant SCRIPTPATH already defined in /forum/includes/class_core.php on line 1550
Notice: Constant SCRIPT already defined in /forum/includes/class_core.php on line 1562
Notice: Constant WOLPATH already defined in /forum/includes/class_core.php on line 1566
Notice: Constant SESSION_IDHASH already defined in /forum/includes/class_core.php on line 1569
Notice: Constant SESSION_HOST already defined in /forum/includes/class_core.php on line 1570
Notice: Constant USER_AGENT already defined in /forum/includes/class_core.php on line 1573
Notice: Undefined index: HTTP_REFERER in /forum/includes/class_core.php on line 1574
Notice: Constant REFERRER already defined in /forum/includes/class_core.php on line 1574
Notice: Undefined variable: show in /connector/connector.class.php on line 121
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: membergroupids in /forum/includes/functions.php on line 278
Notice: Undefined index: forumpermissions in /forum/includes/functions.php on line 3272
Notice: Undefined index: 1 in /forum/includes/functions.php on line 3281
Notice: Undefined index: 2 in /forum/includes/functions.php on line 3281
Notice: Undefined index: hasaccessmask in /forum/includes/functions.php on line 3286
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: HTTPS in /forum/includes/functions.php on line 1517
Notice: Undefined index: forumpermissions in /forum/includes/functions.php on line 3272
Notice: Undefined index: 1 in /forum/includes/functions.php on line 3281
Notice: Undefined index: 2 in /forum/includes/functions.php on line 3281
Notice: Undefined index: hasaccessmask in /forum/includes/functions.php on line 3286
success
Notice: Use of undefined constant VB_AREA - assumed 'VB_AREA' in /forum/includes/functions.php on line 4414
Notice: Use of undefined constant VB_AREA - assumed 'VB_AREA' in /forum/includes/functions.php on line 4414
Notice: Undefined index: badlocation in /forum/includes/functions.php on line 4421
Notice: Undefined index: badlocation in /forum/includes/functions.php on line 4446
Anyone has a fixed version that works fine on 3.54 ?
Noodles24
05-11-2006, 08:49 AM
Updated to work with 3.5.4 and added user functions.
[email protected]
vbmenu_register("postmenu_972160", true);
05-11-2006, 02:49 PM
kewl, thanks
ronoxQ
05-11-2006, 05:59 PM
Can you use this to bridge to other programs?
Noodles24
05-11-2006, 07:20 PM
Can you use this to bridge to other programs?
Yes it can be used as a bridge. You could use it sync users between an app and vbulletin, or you can use vbulletin as the user source. What you can't do is use another app as the user source for vbulletin
cristianmerz
05-12-2006, 08:24 PM
How i can use this in a subdomain....example...my forum is in forum.xxx.com y the website is in www.xxx.com...
I can login form the www.xxx.com, and i see it in forum.xxx.com...but if i try to check the status from www.xxx.com, i can?t.
Noodles24
05-14-2006, 04:41 AM
You just need to change your cookie settings in vbulletin to cover .xxx.com rather than forum.xxx.com
Alan @ CIT
05-14-2006, 10:52 AM
Good job Noodles, looks like it could be handy.
Thanks,
Alan.
cristianmerz
05-15-2006, 05:07 PM
The checkloggedin.php don?t work....the login.php is success but the checkloggedin.php sais "you are not logged in" :(
With the login.php and logout.php i can login correctly...i check it in the forum home and is fine..but i can?t check the login status with the checkloggedin.php. My VB is 3.5.4...Any idea?
Noodles24
05-16-2006, 12:47 AM
If you do:
print_r($_COOKIE);
Does it return values for bbsessionhash, bblastvisit, bblastactivity etc?
Cheertobi
05-16-2006, 08:24 AM
What is the best way to use this with another app?
Create a new user in the other app right after the registration user addUser?!
Tobi
cristianmerz
05-16-2006, 11:27 AM
If you do:
print_r($_COOKIE);
Does it return values for bbsessionhash, bblastvisit, bblastactivity etc?
Yes...
In the checkloggedin.php file...
Array ( [panel] => a6f27d70e8e57c021cdae26984d7f232 [PHPSESSID] => 0a2fd7dc2169e9cd63065e4d31f4xxxx [bblastvisit] => 1147717890 [bblastactivity] => 0 [bbuserid] => 348 [bbpassword] => 2eb747ede87107257bac080bxxxxxxxx [bbsessionhash] => d3cf58a53dd98e657028aa9fb05594be [bbthread_lastview] => 54355fc31b0b2eb1e1f86bd672764313a-1-{i-12114_i-1147718592_} [vbulletin_collapse] => [bbreferrerid] => 0 [bbthreadedmode] => [bbstyleid] => 0 [bblanguageid] => 0 )
GrendelKhan{TSU
05-17-2006, 10:48 AM
does the site need to be on the same host provider? or would this work with ANY site, so to speak?
cristianmerz
05-17-2006, 11:05 AM
Yes. My webhosting is www.xmundo.net
Noodles24
05-19-2006, 03:36 AM
does the site need to be on the same host provider? or would this work with ANY site, so to speak?
At the moment, yes. It needs to be included directly into the file you want to use the API with.
I may include some SOAP interaction later on.
Noodles24
05-19-2006, 03:44 AM
Yes...
In the checkloggedin.php file...
Array ( [panel] => a6f27d70e8e57c021cdae26984d7f232 [PHPSESSID] => 0a2fd7dc2169e9cd63065e4d31f4xxxx [bblastvisit] => 1147717890 [bblastactivity] => 0 [bbuserid] => 348 [bbpassword] => 2eb747ede87107257bac080bxxxxxxxx [bbsessionhash] => d3cf58a53dd98e657028aa9fb05594be [bbthread_lastview] => 54355fc31b0b2eb1e1f86bd672764313a-1-{i-12114_i-1147718592_} [vbulletin_collapse] => [bbreferrerid] => 0 [bbthreadedmode] => [bbstyleid] => 0 [bblanguageid] => 0 )
I'm unsure why it's not working. It uses the same code as vbulletin to intialize.
Try clearing your cookies and try logging in again
Noodles24
05-19-2006, 03:48 AM
What is the best way to use this with another app?
Create a new user in the other app right after the registration user addUser?!
Tobi
You can maintain two user tables if you want. The application I'm building at the moment is just going to use vbulletin as it's user base, then any extra information i need for a user will be stored in a seperate table against their userid
K1ng0e
06-17-2006, 08:57 PM
List product add product del product and all same for templates ;) !
dvanwijk
09-14-2006, 11:54 PM
I have installed this on vb3.5.4 and it works great.
Is there an update for 3.6.1?
Thanks,
Dan
Noodles24
10-04-2006, 01:51 AM
I'm working on an update at the moment
Will also be looking at a way to seperate the code from vbulletin as much as possible
EdKohlwey
11-02-2006, 11:14 AM
I've been pretty disappointed by vB's lack of an API, and otherwise sometimes sloppy and poorly documented codebase (I know I may get some major boo-hiss on that comment, but I'm a Java and .Net programmer).
That having been said though, major props on this! It would be good to see the addition of methods for all major vBulletin functions, like subscribe to thread(s), post/reply (actually submitting a post/reply), account maintainence, etc. Lots of people already have sites/CMS'es that do a pretty darn good job of profile management, and it doesn't make sense for a user to maintain two profiles.
tassoman
12-10-2006, 08:26 PM
Hi, after I've updated to 3.5.7 I still recieve a fatal error:
Fatal error: Call to a member function unlock_tables() on a non-object in /var/www/virtual/domain.tld/forum/htdocs/includes/functions.php on line 4488
Seems an object isn't initiated.
tassoman
12-12-2006, 02:18 PM
I have also encountered errors evalutating usernames with special chars.
Into my DB i have registered an user called <~^_ Th? T?s7 _^~> so if i try a $obj->doLogin('<~^_ Th? T?s7 _^>', 'hispasswd'); i can't get the user logged.
Is there some VB API class/method who correctly converts special chars ?
licinio
02-21-2007, 09:06 PM
Hi,
I´m using vbulletin 3.6.4
login works correctly for me,
but checkloggedin doesn´t work
any idea? I´m desperated
thanks
chubba
03-13-2007, 11:59 PM
works fine on 3.6.4, however i had to make one change to class_core.php
line 2381 from
define('TABLE_PREFIX', trim($this->config['Database']['tableprefix']));
to
define('TABLE_PREFIX', trim($config['Database']['dbname'].".".$this->config['Database']['tableprefix']));
i think its probably to do with my code, not yours, but it may help some one else out ;-0)
axe70
04-08-2007, 05:24 PM
Great! Thank to you boy!
Please, take your work always updated. Big thank to you!
toneill2000
04-25-2007, 02:24 AM
Hi Noodles,
I've installed the API and I have a few questions. Is there any documentation on the classes? For example, what does the third parameter on the doLogin mean? It's called "$cookiesend" but I don't really know what it does.
Have said that, there are other simple questions I have which could be easily answered with some documentation. Is there any documentation? thanks.
Todd
imizz
06-15-2007, 11:09 AM
Hi!
i've installed API and i've this error:
Fatal error: Call to a member function unlock_tables() on a non-object in /usr/local/apache2php/htdocs/forum/includes/functions.php on line 5189
could someone help me?
..and great API!!of course :D
treelovinhippie
08-19-2007, 03:43 AM
hey mate
Does this work for v3.6.8?
I'm not getting anything when trying to add a new user
suraev
09-05-2007, 02:01 PM
Thank you very much for this hack! It was very useful for me and I hope that its development will continue.
prawn
09-28-2007, 07:34 AM
Same for me. Thank you very much as it is a good base for my needs.
satjoe2003
11-06-2007, 08:33 AM
Brilliant add-on! Thanks a lot!
columbusgeek
11-28-2007, 11:59 AM
Agreed, can anybody verify thsi working 3.6.8
jamoss
12-29-2007, 02:47 AM
I'm on 3.6.8 and login and adduser works great... I'll keep you posted!
One snag I did run across is that BIRTHDAY is required for adduser. You need to pass username, password, email, day, month, year (where day, month, year are birthday).
jamoss
12-31-2007, 03:09 PM
I am using this on 3.6.8 and it's working really well! I appreciate this, as I needed to integrate my site login with the boards.
Thanks again!
~ Jennifer
:up:
dionsis
01-04-2008, 01:01 PM
Its appears PHP5 throws up a lock_tables error when trying to do a logout on this
Would love to see further development and updates on this as its a fantastic mod
jamoss
01-04-2008, 05:23 PM
I agree (about updates). This script has been a lifesaver and couldn't find anything similar anywhere else.
I also sometimes get a redeclare error:
Fatal error: Cannot redeclare iif() (previously
declared in
.....functions.php:51) in
....functions.php on line 51
I'm using include_once instead of include.. hoping to alleviate that, but nothing seems to work.
korbn
01-15-2008, 03:10 PM
I don't if this nice Mod still updated but, I have the error of lock_tables.
<b>Fatal error</b>: Call to a member function unlock_tables() on a non-object in <b>/var/www/dev.jardipedia.com/forum/includes/functions.php</b> on line <b>5218</b>
Hi !
I also want to ask about the cookiesend. I installed on latest vbulletin ( 3.6.8) and the doLogin function appears to be working: I see a session created in the session table in the database, but the client browser does not receive any cookie from the forum....
Could anyone tell me where is the code that should send the cookie to the client browser ?
cheers
hmm it was an issue with IE... works!
papaschloss
04-06-2008, 07:47 PM
My problem is that no changes are made to the session table in the database when a user logs in *and* no cookies get sent. I think I'm close to getting this to work but I need some help.
Thanks.
papaschloss
04-07-2008, 04:08 PM
I can get session info to be written to the database now in the goLogin function. After the call to processNewLogin(), I had to insert the code:
$vbulletin->session->save()
I'm still having problems with cookies though. In my browser, when I print out $_SERVER I see the expected cookies; however, when I inspect cookies using my browser, they are not there. Still working on it.
fredang85
11-06-2008, 12:20 AM
Is there anything similiar for 3.7?
CGhostGroup
11-22-2008, 10:26 PM
Should it be possible to get Data like:
Read/Unread PM's, Unread (new) Postings?
sknight
11-25-2008, 01:23 PM
Hi!
i've installed API and i've this error:
Fatal error: Call to a member function unlock_tables() on a non-object in /usr/local/apache2php/htdocs/forum/includes/functions.php on line 5189
could someone help me?
..and great API!!of course :D
Same problem here, that's 3 of use using 3.7
CGhostGroup
02-13-2009, 07:35 PM
Just add an error_reporting(0); :p
dcolumbus
04-02-2009, 12:30 AM
So far all I seem to be able to get is connector.class.php printed out to the page...
This is what I've done:
1) uploaded to the server
2) changed the forum root path
3) uploaded the createuser.php sample script
3) run the script directly
Am I missing something?
Burgy
04-14-2009, 10:19 AM
First of all, I don´t need the functions with the user integration, because I use already Mediwiki Bridge to vBulletin and facebook login. In combination very powerfull and works great.
BUT: The API is the only way to make our little aplications in the net work together, and that apreache - clearly it comes from a c develloper - is absolutly great.
What nearly everbody could need in this api.
Use vBulletin an comment engine for any given page, meaning to syndicate and to write from some content and have the vbulletin discussion be syndicated below or beside the outside content. Let it be comments, or let it be advice or what ever is semantic and interaction data of human conversation could be syndicated in any given content on the same or with securety mesures on any given page. That would make vBulletin to much more, than it is.
Thank you very much for this project, and I hope development is not to difficult considering the vB Code.
=> Every function is apreaciated
Sincerely yours
Burgy
Jeff@Mutant
05-27-2009, 05:37 PM
Hello
I'm running vB 3.8 and I 'm getting the following error when trying to use the Connector API
Fatal error: Call to a member function unlock_tables() on a non-object in /var/www/forums/includes/functions.php on line 5772
Any idea what's going on?
g.gadaleta
05-28-2009, 09:11 AM
Me too, same error. Any idea?
Hello
I'm running vB 3.8 and I 'm getting the following error when trying to use the Connector API
Fatal error: Call to a member function unlock_tables() on a non-object in /var/www/forums/includes/functions.php on line 5772
Any idea what's going on?
xilefen
07-17-2009, 01:36 PM
Has somebody an example for the dbConnector?
// make database connection
$db->connect(
$this->config['Database']['dbname'],
$this->config['MasterServer']['servername'],
$this->config['MasterServer']['port'],
$this->config['MasterServer']['username'],
$this->config['MasterServer']['password'],
$this->config['MasterServer']['usepconnect'],
$this->config['SlaveServer']['servername'],
$this->config['SlaveServer']['port'],
$this->config['SlaveServer']['username'],
$this->config['SlaveServer']['password'],
$this->config['SlaveServer']['usepconnect'],
$this->config['Mysqli']['ini_file'],
$this->config['Mysqli']['charset']
);
rruchte
07-21-2009, 03:32 AM
Me too, same error. Any idea?
I just got this working in vB 3.5.8. In connector.class.php, lines 99-116 do the same thing as lines 233-252 in include/init.php. In vB 3.5.8, most of those lines are commented out. Starting at line 106 in connector.class.php, change
define('SAPI_NAME', php_sapi_name());
if (!defined('NOSHUTDOWNFUNC'))
{
if (PHP_VERSION < '5' OR ((SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi') AND $this->options['gzipoutput'] AND strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false))
{
define('NOSHUTDOWNFUNC', true);
}
else
{
vB_Shutdown::add('exec_shut_down');
}
}
To:
/*
if (!defined('NOSHUTDOWNFUNC'))
{
if (PHP_VERSION < '5' OR ((SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi') AND $this->options['gzipoutput'] AND strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false))
{
define('NOSHUTDOWNFUNC', true);
}
else
{
vB_Shutdown::add('exec_shut_down');
}
}
*/
define('NOSHUTDOWNFUNC', true);
xilefen
07-27-2009, 09:06 AM
Hi,
I use the vConnector API to create and/or authenticate Users and skip login.
include ('includes/connector/connector.class.php');
$connector = new vbConnector();
// get CASUser
$casuser = phpCAS::getUser();
// get UserID if present
$result = $connector->getUserID($casuser);
// check, if user is allready registered
if(empty($result)){
// edit/save new user
$user = array('username' => $casuser, 'password' => 'default', 'email' => 'test@test.com');
$result = $connector->addUser($user);
}
// Login user
session_start();
$result = $connector->doLogin($casuser, "default", 1);
I 'm getting the following error:
Fatal error: Cannot redeclare class vBulletinHook in C:\xampp\htdocs\forums\includes\init.php on line 288
Any idea to fix this?
Thanks Felix
Clayton
11-07-2009, 11:30 AM
this was so ahead of its time
Lysekoid
06-28-2011, 10:13 AM
Where do I find something similar for vBulletin 4, since this example is from 2006 I guess it doesn't work for the new vBulletin 4.
kamilkurczak
07-14-2011, 07:29 AM
I am waiting for post/thread adding system
c0der
09-12-2011, 01:38 PM
nice
but have alot of errors
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.