PDA

View Full Version : Extending BB Membership to Website Membership


01-24-2001, 08:06 AM
I'd like membership of the BB to be the same as website membership and vice versa. So when you register on the front page to join the site, you end up registering for the BB and viceversa. Then I want to be able to make some parts of the website only available to members.

How easy will it be to extend membership from the BB to the whole site. Perhaps a login box on the front page as well.

I'm pretty clued up with php and mysql, so I'm sure I can hack something together, but I was wondering if anyone else had attempted this. And would it be possible do you think to start extending the mysql tables so I can store extra info about members like the ratings they give for links, and comments about other sections of the site.

I think this is a better solution that having two seperate memberships, one for the BB and another for the site.

Comments please,

Pigsy.

01-24-2001, 11:07 AM
yes it can be done, ditch your current website membership scheme (if you have one) and put all the data into the vbulletin tables, then just require config.php on each page and use the same validation scheme as vb (will be sessions soon so you can use them), adding new fields to the member database is just a matter of using myphpadmin and should be no problem.

others have done it i know, a search here will probably find them

i will tell you more about how it works i have a hack done that is going to merge links SQL and vbulletin together (not being made by me though)

01-25-2001, 11:49 PM
Chris-
That's something I'd like to see- the marriage of Links and Vbulletin! (he he- I wonder what their children would look like?)

Thanks for the tips on sitewide membership- that's something I'd like to implement as well.
Thanks,
TigerLily:)

01-27-2001, 12:20 AM
Hi Guys,

I would very much appreciate it if someone could help me with a problem I am currently having when I try to use the VB registration system for other pages on my site.

I am using this code on .php pages:

<?php
chdir("/usr/local/etc/httpd/htdocs/forums");
require("/usr/local/etc/httpd/htdocs/forums/global.php");
if ($bbuserid == 0)
{
eval("echo standarderror(\$bbtitle,\"".gettemplate("error_nopermission")."\");");
exit;
}

if ($bbusername == "" || (isset($bbusername))==0)
{
$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$bbuserid");
$username=$getusername[username];
$bbusername = $username;
}
else
{
$username = $bbusername;
}

?>

The code appears to work bar the fact that I get a message as follows:

Fatal error: Failed opening required 'admin/config.php' (include_path='') in /usr/local/etc/httpd/htdocs/forums/global.php on line 33

I don't understand why it is unable to access the config file in the directory.

The fundamental problem is that I really know nothing about php.

If someone could give some pointers that would be greatly appreciated. I have read previous threads here but had no joy. The code above comes from another VB user and it works on his site.

TIA

Tim.

01-27-2001, 12:44 AM
my guess is because of the chdir you already did confuses it.

Try copying config.php into your /forums directory and see if that works.

01-27-2001, 12:58 AM
Chris,

Thanks very much for your reply.

I have just tried that and it hasn't worked. It's as if the fault is within the 'global.php' file but obviously it isn't as it works fine under normal conditions.

I am sure that the error is very simple but I just do not know enough to be able to see it.

The only change I have made to the code since being sent it by another VB user is that I changed the directory url to obviously match the directories on my site rather than his. There aren't errors there though or it would not be able to access the 'global.php' file.

Being ignorant is unusually frustrating. :)

01-27-2001, 01:05 AM
OK what I have just doen is load up a duplicate version of the global.php file and the code now sources that.

Within the duplicate file I have added the full path to the config file on line 33.

I have just tried it and I can get into the page now.

However this still doesn't work as I should be directed to the login page when not already logged in and this is not happening :(

01-27-2001, 01:11 AM
On hindsight, maybe this is now working fine.

Is it the case that it will be checking to see if a user is registered and that being logged in or out at the time is not relevant.

Sorry to ask what is probably a daft question.

TIA

01-27-2001, 01:11 AM
try:


if ($bbuserid == 0)


to


if ($bbuserid == "" )

01-27-2001, 01:14 AM
the script can only tell if you have registered if you are logged in so you would have to be logged in for it know you are registered.

are you saying that if you are not logged in it still dosen't send you to the error template?

01-27-2001, 01:17 AM
What happens now is that I am sent straight to the page with no errors.

But this happens whether I am logged into the BB or not and I was kind of expecting to not be allowed to access the page and be directed to the login template if not already logged in.

The test page can be seen here: http://www.citybull.com/pwtest.php

01-27-2001, 09:23 AM
it works for me and tells me i am not registered/logged in. You have a probelm with sending header info first somewhere (some whitespace before the cookies probably) but otherwise it works fine.

01-27-2001, 10:38 AM
Thanks very much for your help Chris.

The page has the php coding at the top and is then followed by the html. At the moment there are a few lines between the two, is this what you are refering to?

Tim.

01-27-2001, 10:56 AM
nope


Warning: Cannot add header information - headers already sent by (output started at /usr/local/etc/httpd/htdocs/pwtest.php:4) in /usr/local/etc/httpd/htdocs/forums/global2.php on line 750

Warning: Cannot add header information - headers already sent by (output started at /usr/local/etc/httpd/htdocs/pwtest.php:4) in /usr/local/etc/httpd/htdocs/forums/global2.php on line 757


you are trying to see a cookie somewhere and have already send output to the browser. White space by the looks of it. If you do this you get the error.

delete all the cookies you have from your domain and go there.