Hi there, I run a vbulletin forum, and I've made a couple of tools for the users to use. I was wondering if there are any functions/classes/snipples for me to add to this page with tools, that checks if the users are logged in to the board? I don't want unregistred users to keep using my tools. Also, if it's possible to tell the difference from normal users, admins, what group they belong to etc etc, that would be great!
This checks to see if the user is a member: <if condition="$show['member']"></if> Code (markup): This checks to see if the visitor is in the defined usergroups: <if condition="in_array($bbuserinfo[usergroupid], array(1,2))"></if> Code (markup):
That's in the templates. I'm talking about standalone sites I've made, that I just want to include to the board..
I'm bumping this thread. Take a look at Earners forum. They have built alot of extra sites. Anyone know how they can build sites OUTSIDE VB, but still have them connected to the VB database?
You have to write the file yourself... http://www.earnersforum.com/tools.php tools.php is a separate file that was uploaded to the site. Find out the code you need, create a text file, upload the text file and then change it to a php file. That's about it...the answer doesn't get easier than that. Then all you do is customize it to your needs...
You must think I'm stupid or something? Of course I know that I have the make the file and upload it! I'm asking if there is a class or something I can include, to connect to the VB database! "Find the code you need".. That's what I'm trying to do..
Well if you'd look at the damn link I gave you it tells you the files you need to include to use vBulletin's classes and functions.
So far this is the only code snip I've found that does the job.. but cookies are to unsecure: <?php $logged = ($user = $HTTP_COOKIE_VARS["bbuserid"]); if ($logged >= "1") { ?> your page code goes here. <?php } if ($logged < "1") { echo "<div align=center>You must be a registered user of the forums.<br><br>"; echo "Please click <a href=http://www.accordtuner.com?#login><i><b>here</b></i></a> "; echo "to login first...<br><br>Or click <a href=http://board.accordtuner.com/register.php?&action=signup><i>"; echo "<b>here</b></i></a> to register with our forums.</div>"; } ?> Code (markup):
This is easy. You'll love me. I do it on all of my sites. Somewhere near the top of your file, include your global.php, like this: include_once("/home/yoursite/public_html/forums/global.php"); Code (markup): Then, when you want their info, it's done like this: $currentuserid = $vbulletin->userinfo['userid']; $currentusername = $vbulletin->userinfo['userid']; etc... Code (markup): Want to know if they're in a particular membergroup? (membergroup 9 is a custom one on one of my sites) if(ereg('9', $vbulletin->userinfo['membergroupids'])) { ... Code (markup): Basically, anything from the "user" table can be pulled this way, even custom columns that you added. At the top of my sites I usually grab the currentuserid and then just: if ($currentuserid == 0) { echo("Please login or register, blah blah blah"); } else { echo("Welcome back to the site, " . $currentusername); } Code (markup): Is that what you were after?
No problem. I literally use this on all of my sites. I can show ads to different usergroups on the main site, allow downloads based on their vB status, etc. It's quite powerful. The problem now is that every time I start a new site I pretty much need to purchase another vB license. It's just too easy to let vB handle all of the user management that I can't do without it!