View Full Version : VB Login & Info on Non-VB Page
adamgessel
10 Sep 2005, 22:44
This is nothing too big, I just thought it might help some people out so I'm putting it up here.
=====================
DEMO
=====================
You can see exactly what I did at:
http://www.forumfreedom.net/
=====================
DESCRIPTION
=====================
If someone is logged in on your board, but they are on a non-vb page, this will display their username, amount of PMs (and if they have more than 0 it will be bold), and an option to logout (properly, using their logout hash so that it does it the first time), and has a couple more options. What I've done in mine is added two extra usergroups, Premium and Platinum, and if they are either of those then it tells them what usergroup they are in. In the install file, there are two different steps to take, one to install that part and one to not. So, if you have two usergroups that are premium and platinum accounts that people pay for, this will work good for you. You can of course add more premium usergroups easily. Otherwise, just install the other step and it will still work good ;). The code is simple, but I recommend knowing how vbulletin works before installing it. You will need to change some things in the code, but I think that it's worth it if you need something like this. This doesn't edit any code in vbulletin.
=====================
INSTALL
=====================
Install Time: Depends, if you already have a page with everything going then this should only take a few seconds, unless you have to troubleshoot it.
Difficulty: Medium, I say this because there are a few things you might have to change. It's easy to install if you know what you are doing.
PLEASE CLICK INSTALL!
Andreas
10 Sep 2005, 23:31
Hmm ... where is it? ;)
Blaine0002
10 Sep 2005, 23:33
hasnt this been created already?
adamgessel
10 Sep 2005, 23:36
Must've uploaded it wrong.
There have been things like this, but nothing that I found that worked right and displayed the stuff this does.
Zelda-King
11 Sep 2005, 08:55
I tested this. The colours don't match my vB styles. In my case the result is very poor.
1st attachment is how this looks on a non-vB page with the code. 2nd attachment is how my login screen looks on the forums.
Well, if you don't include the CSS of your forum it wont change the colors and such. (Atleast that's what I think)
@topic, very nice mod and this will surely become handsome.
adamgessel
12 Sep 2005, 04:07
Zelda-King: Yeah... you can change it to suite your needs. You will have to if you want it to look like you want it to. I tried to remove all of my CSS from it, but I kind of assumed most people would have a style different from their forum so it shouldn't use the CSS from the forum.
just downloaded this as it's 100% what I need. However, I run my forums on a subdomain (as should everyone really), so I can't change folders. Is there another way around this?
//edit - scrub that, it's not possible, i'm moving my forums to the main domain.
//edit2 - just thought i'd drop back and say that it's working great... thanks for making my life very easy, I was expecting this to be a nightmare...
Zelda-King
02 Oct 2005, 00:35
Zelda-King: Yeah... you can change it to suite your needs. You will have to if you want it to look like you want it to. I tried to remove all of my CSS from it, but I kind of assumed most people would have a style different from their forum so it shouldn't use the CSS from the forum.The problem is when you have your board closed or disable certain groups from seeing the boards (eg: if forums aren't viewable by guests). Logging in from the main site page in a situation where the vB login box is overriding the site code would take them to login.php which doesn't exist outside the forums' directory. Fix by using a full URL for login.php in the STANDARD_ERROR template.
does anyone know if there's a way of using the wysiwyg on non vb pages?
Thanks for sharing Adam. Works like a charm and had no problem adding the code. Gracias.
JimmyJames
14 Oct 2005, 20:17
I have been wanting to add a login & info block to my header.....will this mod work?
ludachris
17 Oct 2005, 20:12
Received this error message:
Unable to add cookies, header already sent.
File: /var/www/mysite.com/html/index.php
Line: 3
Does this work in vBulletin 3.5.0 final? I tried it... but doesn't seem to be catching the cookie, as in, you can log into the main page fine, but when I get to to the forums, I'm under a guest (meaning it shows that I never logged in). BUT... when I look on the Who's Online list, I fond myself logged in... only I'm not...
Hope that isn't confusing.
auz1111
18 Oct 2005, 22:43
Anybody have an idea why i get these errors?
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
im gonna bump this because it doesnt seem to work and this seems to be the closest thing to logining into the vb db and session from a non VB page
I'd love to be able to use membership permissions and such on non-vb pages, without installing a portal, etc.
will this mod work for vb 3.5?
ruinernix
30 Oct 2005, 20:03
this mod works in my 3.5 gold install, thanks. that's exactly what I needed. As simple as I wanted it to be. I don't like the other login addons, they try to do too much for you... :o
Thanks!
noone else get ?
Unable to add cookies, header already sent.
File: /home/*******/public_html/testlogin.php
Line: 2
hmm it works if ur already logged onvia the forum
Mu5icMan
02 Nov 2005, 15:46
the way around that error is to remove the line 'chdir' and put the non-vb page in your forums directory. That's what i did.
Still doesn't seem to be working for me properly; I can log in, but when I go to the forums, it shows me as logged out (or guest). When I go back to the page which I logged in from, it shows me as logged in. Anyone know the cause and have a fix for it? Much appreciated.
Dark Riku
11 Nov 2005, 23:02
Yea, when i installed this script, i put it on my non-vb-page but when you submitted, it redirected you without doing anything. So i tested it on my forums, it would log me in, but it wouldnt say i was logged in. I went to forums, logged out, did the login from the page i wanted, and it logged me into forums, but didnt say i did on the page. I think this script needs some major fixes
is it me or when your logged out and view the page with IE theres a javascript error?
TF|Scorpion
20 Nov 2005, 05:49
Hi, I used your code and everything, followed each step as you stated on the document you wrote. I edited the codes to the correct information what I have on my forums, such as renamed forum to forums, because thats what i have on my website.
Here is the test site i created;
http://totalfrag.com/test.php
Now when you browse the website, it says the following error;
Fatal error: Cannot redeclare class vbulletinhook in /home/totalfr/public_html/forums/includes/class_hook.php on line 29
Please advice!
Thank You!
Hi, I used your code and everything, followed each step as you stated on the document you wrote. I edited the codes to the correct information what I have on my forums, such as renamed forum to forums, because thats what i have on my website.
Here is the test site i created;
http://totalfrag.com/test.php
Now when you browse the website, it says the following error;
Fatal error: Cannot redeclare class vbulletinhook in /home/totalfr/public_html/forums/includes/class_hook.php on line 29
Please advice!
Thank You!
Yup... thats what I get :(
http://www.dcsclan.net/b.php
Fatal error: Cannot redeclare class vbulletinhook in /home2/=====/public_html/forums/includes/class_hook.php on line 29
adamgessel
20 Nov 2005, 15:36
Sorry guys, forgot about this hack... will try to figure out why you are having your problems and I'll post back here.
I have tried this on a 3.5.1 Fresh install of vBulletin and it worked fine.
Please post which vBulletin version you have if you are having errors.
I am using "vB Version: 3.5.1 " thanks for any help you can provide.
TF|Scorpion
21 Nov 2005, 07:17
I am using vB Version : 3.5.0, but soon converting to 3.5.1 = )
TF|Scorpion
22 Nov 2005, 10:16
Have you found the solution?
Stachel
22 Nov 2005, 11:31
Wow, excellent idea for a hack!
Please post when this is working well in 3.5.1 !
Stachel
TF|Scorpion
25 Nov 2005, 06:52
I updated my forums to 3.5.1 but the problem still occurs! Is there a solution for this please? I tried both codes, "premium" and "normal" but both gave me the same exact error!
i have vb 3.5.1 and im having this error msg :
Fatal error: Cannot redeclare construct_usercp_nav() (previously declared
help please
Dark Riku
30 Nov 2005, 22:37
the way around that error is to remove the line 'chdir' and put the non-vb page in your forums directory. That's what i did.
YOu didnt have to do you... you could just do this...
<?PHP
chdir("forum/directory/");
require('./global.php');
chdir("../back/to/folder/you/want/");
?>
And to Quozt:
Make sure your code is on the VERY top line... the VERY top. Above all head and everything. Should solve your problem.
THis hacks works on 3.5.1 Its very easy to use if you have any php knowledge.
Once someone figures out the stats on non-vb page, i can add some to this code, make it kind of a welcome panel
adamgessel
01 Dec 2005, 02:43
I checked it over and over, and as long as you do everything right, then it should work
If not I can help you for $5 payable via paypal. You will have to pay only after I am done and everything is working.
garrynz
01 Dec 2005, 12:39
Works fine for me with 3.5.0, but I am getting a "Call to a member function on a non-object" in my error logs.
TF|Scorpion
01 Dec 2005, 22:13
I checked it over and over, and as long as you do everything right, then it should work
If not I can help you for $5 payable via paypal. You will have to pay only after I am done and everything is working.
Why should i donate 5 bucks for a coding mistake that didnt make sense and is in the original vb files? :mad:
malfuncion
21 Dec 2005, 19:25
works fine for us. we are using 3.5.2. now i am wondering how if possible, i can put like; users online, birthdays, ect like the portal page does. i.e. left col, right col, center col. anyone?
edit- where can i find a list of all the variables such as,
$vbulletin->userinfo['pmunread'];
is there a b-day variable and whatnot?
sesmatik
22 Dec 2005, 00:23
I am using vb 3.5.2 working 3.5.2 please answer
Smiry Kin's
22 Dec 2005, 00:49
get a new demo please! page suspended! :(
get a new demo please! page suspended! :(
I have 2 sites that both use this, check them out in place of the real demo.
www.mousepilot.co.uk
and
www.british-mercenaries.co.uk
Exitilus
22 Dec 2005, 05:11
I'm using this and it works great. Though i'm wondering how would I set it to RE-Direct the person to my forums after logging in?
Though if the person is still logged in I want them to see this page. Basically just want the re-direction after they log in.
Just thought i'd post a change I made to the chdir part of this code. It means you don't have to worry about putting in the folder structure of your host, the code will figure it out for you.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
I've not been using php for terribly wrong so I don't know if there would be problems with this on some people's hosting. If so, let me know as I'd be interested to find out what they are.
sesmatik
22 Dec 2005, 17:13
Warning: chdir(): No such file or directory (errno 2) in /home/bauforum/public_html/forum/aa.php on line 3
Unable to add cookies, header already sent.
File: /home/bauforum/public_html/forum/aa.php
Line: 3
i see this error message what can i do please help me
already i am using vb 3.5.2
sesmatik, are you using my chdir script there? if so, you need to adjust what your forum directory is called.
James B
23 Dec 2005, 14:16
Adam - this is perfect! Thanks very much...
All worked first time - just in a fairly plain page at the moment to try it out. This is going to be really handy. :)
Exitilus
24 Dec 2005, 04:38
I'm using this and it works great. Though i'm wondering how would I set it to RE-Direct the person to my forums after logging in?
Though if the person is still logged in I want them to see this page. Basically just want the re-direction after they log in.
Anyone know how I could do this?
gizmo4321
25 Dec 2005, 17:04
I have the basics of it working in 3.5.2. :up:
BTW, instead of all the if($vbulletin->userinfo['usergroupid']==xxx stuff, you could do a much simpler if(is_member_of($vbulletin->userinfo)) instead. You would have to include fuctions.php as well as the others, though.
Snoop-It
26 Dec 2005, 02:39
thats all good but how do you get the GUESTS on that 1 page to show up on the Who's Online bit on the forum.. I.E, Guests viewing Unknown Location - http://blah.com/etc
How does that go about?? same with the user once logged in..? because on my board, yes some 1 can log in on a non vb page BUT they will not be shown on who's online. i want that to be shown and any guests viewing that page aswell... what will i need to do??
please help. thanks in advance!
Hi,
When I try out this code, it works perfectly in FF. When I test it out in the IE7 Beta, I am not seeing the log-in text fields. When I am already logged in though, both browsers displays the "Welcome...." message like they should.
EDIT: Nevermind - the issue was with the <style type=text/css> line. Removing that fixed it!
Thanks,
Kirupa =)
adamgessel
30 Dec 2005, 16:54
Sorry people I've had problems logging in to vBulletin.org the last month and a half or so... anyways, the demo site isn't up because they were charging me too much for it and I couldn't keep it up. Sorry about that.
I have hosting somewhere else now and I'll look into putting up another vBulletin forum and having the demo there.
Alright. Im using PHP Includes. and When I add that Script ontop of my page. It changes the Directory. well.. when I add the Includes for the Global files it changes the directory for my Includes for the real directory obviously. :-/ Is thier anyway around this? can I use the script and Not have it screw up my Includes?
THis is my PHP code I have. I even tried using Smettys Code or whatevers..
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Exitilus
28 Feb 2006, 22:09
For some odd reason this just "quit" working. Not sure really what happened but i'm getting a completely blank page now?? .... O.o
No changes were made what so ever *L* any ideas on this one?
Jordan17
11 Apr 2006, 18:34
I was getting the "Unable to add cookies" message, but now all that happens is that If the user is not logged in, it doesn't load all of the page.
I'm guessing theres some sort of kill or exit function somewhere in the code that is executed mid-way through the page.
Paprika
03 May 2006, 14:22
Does this work for 3.5.4, and/or is there a similar mod avalible which does not require modification of the original files?
I think $5 is quite reasonable to fix YOUR inability to read directions.
As for all these "Unable to add cookies" errors people are recieving, try adding the chdir at the TOP of the lot.. not below your index.php includes (which no doubt will include <html> ref and thus ending the header portion of the PHP code.)
This was clearly stated in the installation directions.
Apart from that I installed this and it worked from the get-go. That is until I disabled the forums.. In which case the page was taken over by global.php's $warning. Which states the forums are disabled.
removing the chdir will stop the login script from working.. at all.. If you want to change the dir back try:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
After having a bit of a toy around with it i solved the inactive board problem.
I havnt even bothered looking into the disabled user yet but i thought i would post what ive got in case anybody was interested or having a similar problem.
I created a file called forumcheck.php which i simply include at the top of my formatpage (header.php) like so.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The contents of forumcheck.php (some details removed).
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
and lastly the display.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Hope that something here has helped somebody... =)
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.