Using Forum Members Site-Wide
Posted February 21st, 2007 @ 10:50am by Erik J. Barzeski
This is a bit of a LazyWeb request here, or rather an "I'm busy doing other things and don't yet have the two hours necessary to find the answers, but maybe someone knows offhand" type of post.
Anyway, the question is this: are there any forum packages that "expose" their member list for extensibility and use outside of the forum software?
In other words, I'll soon be working with a members-based site. A forum is one of the components, and we'd like to use the forum member logins across every section of the site - from the forum itself to the more specific members-only areas. Or perhaps the question is backwards - perhaps there's forum software that can use a members list supplied externally.
I think something like vBulletin or Invision can do this, but I'm not certain. Please, no recommendations for bbPress - it's just too simple at this point.
Posted 21 Feb 2007 at 12:00pm #
You might want to dig into VB a bit more. By reading this, I think your wanting a secured area for "special" members? Maybe a paying membership hang out or downloads. VB community has plenty of add ons and hooks for things like this. http://www.vbulletin.org is an incredible place to look for things specific to your version of VB. So much so, I've recently found an add on to hook MediaWiki with forum membership.
If you can post more specifics or want to email me them, I might be able to find if VB will do it for you.
Posted 21 Feb 2007 at 2:46pm #
[quote comment="39596"]By reading this, I think your wanting a secured area for "special" members?[/quote]
No, I'm looking to build an entire tiered member-based site around it. The forums are just one aspect of the site. Within each tier, members will even have different privileges based on whether they've purchased certain things or not.
In other words, I not only need control of the "level" of user within the forum (so they can see or not see different sections of the forum, like private threads and so on), but I need access to the usernames/logins and levels outside of the forum along with the ability to extend the member table to include other data like whether they've purchased "item 32" or not.
Posted 21 Feb 2007 at 6:15pm #
Sounds like what you need is a full Content Management System (CMS).
I recommend Drupal, a flexible and free PHP-based CMS. It is very easy to set up, with a module-based approach to allow making it as simple or sophisticated as desired.
See my Dejal website at http://www.dejal.com/ for an example. It includes a forum, blog, and FAQ all supporting comments and posting with a unified user login system. Hog Bay Software also uses Drupal to power their site.
You can extend the information asked of users when they sign up, too.
Hope this helps.
Posted 21 Feb 2007 at 6:30pm #
Sounds like you need custom written MySQL/PHP database stuff. You can always search VB sites to see if it's been built already, but sounds like you already have what you want in mind.
Vbulletin.org is going to be the best search option.
Posted 21 Feb 2007 at 6:30pm #
[quote comment="39608"]I recommend Drupal…[/quote]
I don't believe that any one package will be so easily modified to suit the specific needs of this site in a more economical fashion than building a custom application. Drupal may be able to do it, but at incredible cost and research and at the expense of being able to "get started" fairly quickly, as Drupal masters aren't exactly as widespread as general PHP or RoR practitioners.
I'll email you, though, as perhaps I'm wrong or perhaps you may even be interested.
[quote comment="39609"]Sounds like you need custom written MySQL/PHP database stuff. You can always search VB sites to see if it's been built already, but sounds like you already have what you want in mind.[/quote]
Steve, that misses the point. I know that I need a custom-designed site. What I'd like is to not have to write an entirely new forum package. I am interested in hearing whether existing forum packages allow their "members" table to be expanded upon and/or used outside of the forum itself.
Posted 22 Feb 2007 at 6:56am #
PHPBB's pretty easy to do that. There's a few lines of PHP you can put at the start of every page and then you have access to all the user stuff.
For example:
define('IN_PHPBB', true);
$phpbb_root_path = 'bboard/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$page_title = 'Homepage';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// Do stuff here
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
If you don't want to use PHPBB's header and footer templates, omit the last two include lines.
You can then get the current member's information by reading $userdata (for example, $userdata['username'] or $userdata['user_id']).
You can get a list of members with:
$sql = "SELECT * FROM " . USERS_TABLE;
You can work out if a user is currently logged in by checking $userdata['user_logged_in']. The code that goes at the top of your page starts the PHPBB session on every page.
To check the user is a member of a given group, use:
$query = "SELECT * FROM '.USERS_TABLE.' WHERE group_id = '194' AND user_id = ". $userdata[user_id] . " LIMIT 1";
(Obviously replace the 194 with the ID of the group you want to check membership of. This can be useful for things like a moderator area.)
To check if a user is an admin, use $userdata['user_level'] == ADMIN;
These things all work for PHPBB 2. Things have changed a bit in PHPBB 3, but since it's still in beta I've not re-learned everything yet.
Posted 22 Feb 2007 at 7:01am #
Just to add to my previous comment:
You can add new fields to the members table with no problem at all. They all get stored in $userdata[] -- it's just a dump of the current member's row.
For your different user levels, the groups function would be appropriate. Make a few groups for different user levels, hardcode those group IDs into your script, then use PHPBB's user management interface to handle adding and removing users from the group. (Set it to a closed group, so users can't add themselves.) Users can be members of multiple groups with no problem.
Finally, don't forget to change $phpbb_root_path to whatever it is! I suggest you leave PHPBB itself in a folder, and have your own files outside that folder -- in that case, use a root path of './phpbb/' or something.
Posted 22 Feb 2007 at 9:49am #
Amorya, I think you've misunderstood the question in some ways, but you have reminded me that both phpBB and vBulletin do allow for extra fields. We aren't required to use them in the forum section of the site, after all… Thanks.
Posted 22 Feb 2007 at 11:44am #
[...] posted briefly about this "thing" yesterday, but today I'm officially announcing that I'm looking for an entrepreneurial web [...]
Posted 22 Feb 2007 at 7:57pm #
[quote comment="39618"]Amorya, I think you've misunderstood the question in some ways, but you have reminded me that both phpBB and vBulletin do allow for extra fields. We aren't required to use them in the forum section of the site, after all… Thanks.[/quote]
I can't off hand see what I misunderstood -- care to enlighten me?
I was under the impression that you wanted to use PHPBB's member database and permissions manager in pages you were coding yourself in PHP, to maintain a single username/password combo for each member, rather than having them log into the forums and the site separately. Is this not the case?
If you are wanting to interface PHPBB with other (free or commercial) existing scripts, then you'll either need scripts that know about PHPBB, or to use the Authentication Plugin functionality that exists in PHPBB3 beta.
Have a look at http://www.scifiminds.net -- a site that is kinda inactive these days (alas) but demonstrates the tech I'm talking about. The same login is used to post stories and access the secure areas, and for the forum.
Posted 22 Feb 2007 at 8:04pm #
[quote comment="39630"]I can't off hand see what I misunderstood - care to enlighten me?[/quote]
It's more that I felt as though you were encouraging a system built on top of phpBB rather than building an entirely stand-alone system that integrated with phpBB.
Admittedly, truly understanding is difficult in these short snippets. I certainly meant no offense by any possible misunderstanding - on my part or yours. If anything, I viewed it as a failure to be clear on my part.
Posted 23 Feb 2007 at 8:29am #
That is what I'm encouraging - but only in the sense that PHPBB's session handling is run on every page (which is necessary to get a single login) and its core functions are included.
Essentially, it's a lot more work to get two systems synchronised than it is to just use the existing code for user management and the like. Doing it any other way would be repetition of effort. If you don't run PHPBB's function session_pagestart() then you would have to make sure you read the values of the session cookie yourself, parse them, and query the database to work out who it is. That's more work for little gain, in my mind.
I understand that you might feel tied or trapped to one product if you do it this way. I just maintain it's less effort. The choice is of course yours 🙂
Posted 24 Feb 2007 at 2:23pm #
[quote comment="39610"]Drupal may be able to do it, but at incredible cost and research and at the expense of being able to "get started" fairly quickly, as Drupal masters aren't exactly as widespread as general PHP or RoR practitioners.[/quote]
I would argue that Drupal costs far less than other CMS frameworks, requires far less research to get started quickly, that the Drupal community is larger and more mature than the RoR community, and that PHP executes far faster than Ruby in web application environments.