Integrating phpBB into my site

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Wishbone
Registered User
Posts: 11
Joined: Thu Sep 06, 2007 11:41 pm

Integrating phpBB into my site

Post by Wishbone » Thu Sep 06, 2007 11:52 pm

I'm starting up a site that will contain some public content, but much of the content will only be available to members. I currently have my own database for the member info, and would like to integrate a phpBB forum into my site.

It's an easy process for my site to refer to the phpbb members table for login names, and md5 passwords. I would rather not have a separate login for the site and for the forum, and would like to use phpBB's authentication for the site. also just recently read an article that shows how to use phpBB session information to restrict access to content, and to have my own login/password form on the site and have phpBB authenticate it, and set up the user session.

Here is the issue. My users might go to the site to peruse the content, etc, and might not want to browse the forum at that time. The issue will be that the forum will be "marked as read" when they leave and come back to view what they missed in the forum. Is there some way to log into a phpBB session, but not update the "last visited" field in the database, unless they actually browse the forum?

I'm trying not to have a separate login for the site, and for the forum, even if they use the same database.

Wayne
http://foas.us
Last edited by drathbun on Fri Sep 07, 2007 4:16 am, edited 1 time in total.
Reason: bbcode removed, it should be used to emphasize rather than format your entire post, thanks

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: Integrating phpBB into my site

Post by drathbun » Fri Sep 07, 2007 4:23 am

One thing you could do is to set an additional variable like IN_PHPBB that is set only on your site pages, rather than the phpBB pages. If that var is set, then skip updating the last_visit during the sessions logic.

Since you're looking for "how to" coding tips, the best place is the MOD Writers forum rather than the discussion forum, so I will move your topic there now.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

Wishbone
Registered User
Posts: 11
Joined: Thu Sep 06, 2007 11:41 pm

Re: Integrating phpBB into my site

Post by Wishbone » Fri Sep 07, 2007 8:17 pm

drathbun wrote:One thing you could do is to set an additional variable like IN_PHPBB that is set only on your site pages, rather than the phpBB pages. If that var is set, then skip updating the last_visit during the sessions logic.
That would be pretty easy to setup another variable, but your mentioning of "skipping updating the last_visit" during the session is exactly what I'm trying to achieve.. How is that done?
Last edited by Wishbone on Tue Sep 11, 2007 7:03 pm, edited 1 time in total.

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10941
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: Integrating phpBB into my site

Post by battye » Sat Sep 08, 2007 6:04 am

It is in this part of sessions.php:

Code: Select all

		$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; 

		if (!$admin)
		{
			$sql = "UPDATE " . USERS_TABLE . " 
				SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
				WHERE user_id = $user_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
			}
		}

		$userdata['user_lastvisit'] = $last_visit;
Customisations Team Member

https://github.com/battye/php-array-parser - Give it a Star! :D

Wishbone
Registered User
Posts: 11
Joined: Thu Sep 06, 2007 11:41 pm

Re: Integrating phpBB into my site

Post by Wishbone » Tue Sep 11, 2007 5:23 pm

This post had been moved to the Mod Writers forum, but I'm a bit too new to start writing mods, though it is something I want to do. I was hoping that there was a feature for this or an existing mod.

With all the posts here and elsewhere about using the phpBB authentication system to grant access to specific parts of websites, I was hoping for an easy way to not mark forum posts read if the forum wasn't actually viewed.

I can probably hack the code to not update last_visit when logging into the site itself by using a variable as suggested, but if the user does actually view the forum in that session, last_visit won't be updated, unless I insert more code into the phpBB scripts to update it when the forum index is viewed the first time and not subsequent times. If a user jumps to a specific URL in the forum, this will be bypassed unless I insert this code in each of the forum php scripts, unless I can hack some central init routine that all the scripts call to do this.

Thanks for the help,

Wayne

Post Reply

Return to “[2.0.x] MOD Writers Discussion”