![]() |
Simple vB User login and access control on non vB pages
1 Attachment(s)
Hack Description
This is a cut down version of the user authentication and access control system I use on the non vB pages on my website. This uses the vB 4.0 login system to log you in and out. It allows you to move between your forums and other pages on your site while remaining logged in. It allows you to do things such as restrict pages by usergroup, display different content depending on a user being logged in or not. For example, you can have banner Adds displaying to non members only, and/or let members access to specific content. I've cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating. (That is in the Deluxe version - not yet released) This is not supported, but if any questions / issues are posted here (not PM'ed or emailed) I will try and answer them if I have time. This code is a mix of my own, and pieces I have used from other hacks that are floating around. This script has been confirmed as working on
Change log Version 4.00 (15th November 2009)
Click on Install If you have this script installed then please click on the install link because;
|
Note - The following troubleshooting tips work on vB 3.7 & 3.8, they have not yet been proven on vB 4.0
Usage The hack is pretty useless without some usage instructions so here they are. We can use conditionals to hide or display depending on a number of things such as Logged in or out status, or restrict to members of a specific usergroup. We do this by using conditionals in php tags where the normal content of a webpage would go. If you want something only accessable to a certain usergroup, use this code in your webpage. This example is only visible to members of usergroup 6. PHP Code:
For example, PHP Code:
For example: PHP Code:
Another use is to display different content to users depending on if they are logged in or not. For example PHP Code:
For example PHP Code:
Troubleshooting If your reading this chances are you are having problems. Here are some common causes and fixes.
|
thaanks
reserved |
Reserved till i get my site up. I have been waiting for this. Glad it wasnt long! :)
|
Is this correct or a typo -
PHP Code:
Where do we put the login_inc file included with this hack? Any special directory, or whichever directory we are running the script? Thanks. :) *Edit - Also, do these statements work with the new VB code? PHP Code:
|
Quote:
And the statements do work. However I do have an issue. I can't use the statements twice. Not sure what is going on but if I used the statement once, it doesn't work to use it again. |
Quote:
Sorry about that, its just a typo. login_inc.php is correct. I will fix it. Quote:
I normally just put it under something like mywebside.com/includes/ |
Your example code:
PHP Code:
untested: PHP Code:
|
Quote:
Ive only ever used it to allow extra stuff for Admins and Mods so I never really had a need to optimise it for a large number of groups. |
Im getting this error -
Code:
Unable to add cookies, header already sent. |
|
Hiya Bill,
Do you think this could work as a wrapper in WordPress, where we use your authentication system to require people to authenticate against vB before they're allowed to post comments? I can easily extend WordPress' comment section and would like to do something like (pseudo code obviously): Code:
<?php |
Works on a standalone file, but won't work properly on my wordpress site.
The login boxes and what not appear, but after I am directed to the login.php file I am sent back to my wordpress page with the login boxes still showing. I tried all the steps with the cookie settings and login.php file. Moviecrematorium.com is my site. Any help would be appreciated. Great plugin btw ;) |
Quote:
|
Quote:
My Fix: well, I'm using this in the root of the site for a custom html page. I feel like a dumbass because i looked at the source and it had "<html>" twice. So my "custom.php" file that I made all I included in it was: PHP Code:
|
You should make yur file XHTML compliant, it causes over 100 errors when trying to validate at W3C Schools
|
Quote:
thanks! MOGmartin |
Quote:
Quote:
Quote:
If you get a message saying headers already sent or cookies already sent, chances are that there is something, even just a space before the 4 lines of code in part 1. Edit this and ensure that there are no spaces before it. |
This is pretty damn useful. Tagged for later.
I'm guessing once the Deluxe version comes out we gotta pay? :P It'd be nice if it had option to show newest threads, users postcount, etc. |
Quote:
|
If we hook this mod up can we extend it with features from deluxe (once it comes) without having to undo everything we installed from this mod?
|
Hello everyone,
I have a little problem on my main page of my site and that with this change that you put up here and I want to have on my page. Your code is only nickel but as I joined my current page that has a system of multi-language ca va plus. Thank you for your help. common.php Code:
<?php Code:
<?php |
Hello,
I managed to set up your mod and now I telnet to see the game appear to say whether it has the message and what we are and what login into your mod. Thank you in advance for your valuable help |
Do our webpages need to be named *.php? Virtually all of my non-vB pages are currently *.shtml as they pull dynamic data from another program. Will this mod work for me?
|
It not works on 4.0.1 :(
|
Quote:
Quote:
Unless you post some error messages its hard to guess whats happened. |
I thought i'd throw out there that i'm getting the old "no such file or directory" error for
PHP Code:
PHP Code:
|
You could add this code in the login_inc.php to have it show avatars:
PHP Code:
|
How do I use it for a site on a different domain (and server) than my vB installation?
|
Hey,
Having an issue with this mod, normally I can fix them myself being a developer. Cant seem to figure this one out tho! I'm getting this error: Undefined variable: specialtemplates on line 20 of global.php. The forum works fine stand-alone, it's just when I include this into my own system. I've already done all the normal error checking and directory checking, it's all fine. Anyone recommend something I've missed? |
Quick question, when a user is not logged in, I get the default vbulletin forum login page instead of w/e php echo i set. How can i fix this?
|
I'm trying to get this working on www.mynintendo.de. It works if I put it on a testpage, outside of wordpress. However, whenever I try to use it within wordpress it's not working. The Login process works, but it's not showing me as logged in.
I think it's related to the header code, I got this in header.php in wordpress: Code:
<?php Thanks a lot. |
thanks very much.... i needed it badly!
|
not working with wordpress.
i am logged in my forums but it is not showing Welcome Username.... showing login forum please help |
Thanks for this updated mod.
Is it possible to have the text input fields the same as on the forum login, with "user name" and "password" disappearing when you click in the text input? |
how to integrate with wordpress ??
|
OK, found solution here, its working
|
Thanks for this mod! I love it. I can make pages on my main site that requires users to be logged in, and even better: the coding is really easy to understand, no 3490859345 lines of coding that confuses the hell outa me.
Works perfectly on my site ^^ Quote:
So /home/username/public_html/forums/ for an example. It will work |
Tagged for use latter.
|
thanks very much, but is it possible to add the facebook connect button too?
|
All times are GMT. The time now is 08:29 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|