The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
username stored in vB cookie
i would like to see a small hack that stores the username in the cookie along with the userid.
I have comments for multiple content areas on my website right now, and would like to force them to register an account on the forums before they can post, and then have that username automatically show up. thanks Edit, figured it out myself, just adding 2 lines to login.php so not sure if it is really a hack or just a small mod if anyone is interested, i can attach the lines here? |
#2
|
||||
|
||||
Quote:
|
#3
|
||||
|
||||
guess not.... nvm ^^
you could accomplish this by including global.php to your outside the forum pages AND a simple if stamtnet |
#4
|
||||
|
||||
I don't want to include global.php though, i want to keep the forums seperate from the other parts of the site, but still be able to enforce the use of a username.
Either way, the way I did it works like a charm and I am very happy with it |
#5
|
||||
|
||||
Quote:
|
#6
|
|||
|
|||
siLk,
Post your changes, please. Could be a simple solution to something I've been thinking about. Thanks |
#7
|
||||
|
||||
In login.php I added the following cookies:
replace: Code:
if ($_REQUEST['cookieuser']) { vbsetcookie('userid', $bbuserinfo['userid']); vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d')); } Code:
if ($_REQUEST['cookieuser']) { vbsetcookie('userid', $bbuserinfo['userid']); vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d')); vbsetcookie('username', $bbuserinfo['username']); } Code:
{ // we have a cookie from a user and we're logging in as // a different user and we're not going to store a new cookie, // so let's unset the old one vbsetcookie('userid', ''); vbsetcookie('password', ''); } Code:
{ // we have a cookie from a user and we're logging in as // a different user and we're not going to store a new cookie, // so let's unset the old one vbsetcookie('userid', ''); vbsetcookie('password', ''); vbsetcookie('username', ''); } So far it works very well, the cookie $bbusername is available all over my domain and I can force people to use there forum name. Also, to check if they are registerd for the forums already, anywhere on the site without including global.php, just use a simple if: (your vB cookies must be set to the whole domain for this to work) Code:
if (isset($bbuserid)) { arguments } else { echo "please register at the forums before posting here or accessing this part of the site etc"; } |
#8
|
|||
|
|||
Nice.
Thanks |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|