<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Integrating Phorum with my sites Users DB</title>
        <description> Hi,

Im a newbie to all this, I have read all of the posts on &amp;quot;user_session_restore&amp;quot; and still cannnot make sense of this integration.
Is there a step by step guide to adding the users or checking the usernames and passwords in my DB and integrating it with the Phorums DB.

This is really bothering me and I cannot seem to even get the first step. can anyone help me out, as I said I have read the forums on this and I just cannot a start on it. Any help would be greatly appreciated.

Regards,
David</description>
        <link>https://www.phorum.org/support/read.php?28,136843,136843#msg-136843</link>
        <lastBuildDate>Wed, 18 Nov 2026 05:47:26 -0600</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,143996#msg-143996</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,143996#msg-143996</link>
            <description><![CDATA[ i figured i out i made my uid fields in my databse int and auto increment]]></description>
            <dc:creator>KellyLSB</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 06 Apr 2010 19:41:07 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,143995#msg-143995</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,143995#msg-143995</link>
            <description><![CDATA[ what size is your uid? the field is an int, seems like you are overflowing that field.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 06 Apr 2010 14:15:09 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,143994#msg-143994</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,143994#msg-143994</link>
            <description><![CDATA[ Ok so i just integrated this into my site.... and well i have run into a problem... and that is whenever the UID is long it randomly puts in the numbers<br />
&quot;2147483647&quot; which is causing some db errors... yah heres my code that inserts the user data.<br />
[code=&quot;php&quot;]<br />
function updatePhorumUser() {<br />
		global $dbh;<br />
		global $uid;<br />
		//Phorum<br />
		// Add the new user to the Phorum users table<br />
		<br />
		$curcwd = getcwd();<br />
		$dir = $curcwd . &quot;/forum&quot;;<br />
		chdir( $dir );<br />
		<br />
		define(&quot;PHORUM&quot;, 1);<br />
		global $PHORUM;<br />
		<br />
		//Phorum Includes<br />
		<br />
		include_once(&quot;./include/db/config.php&quot;);<br />
		include_once(&quot;./include/db/mysql.php&quot;);<br />
		include_once(&quot;./include/api/base.php&quot;);<br />
		include_once(&quot;./include/api/user.php&quot;);<br />
		<br />
		// Get the new MB user_id from the INSERT<br />
		foreach($dbh-&gt;query(&quot;Select * From users Where uid = &#039;$uid&#039;&quot;) as $row);<br />
		<br />
		$Phorum_user_id = $row[&#039;uid&#039;];<br />
		$Phorum_Username = $row[&#039;username&#039;];<br />
		$Phorum_Password = $row[&#039;password&#039;];<br />
		$Phorum_Email = $row[&#039;email&#039;];<br />
		if($row[&#039;permissions&#039;] == &quot;admin&quot;){<br />
			$Phorum_Admin = 1;<br />
		} else { <br />
			$Phorum_Admin = 0;<br />
		}<br />
		//die($Phorum_user_id);<br />
		<br />
		$user = array(<br />
			&quot;user_id&quot;   =&gt; $Phorum_user_id,<br />
			&quot;username&quot;  =&gt; $Phorum_Username,<br />
			&quot;password&quot;  =&gt; $Phorum_Password,<br />
			&quot;email&quot;     =&gt; $Phorum_Email,<br />
			&quot;admin&quot;     =&gt; $Phorum_Admin,<br />
			&quot;active&quot;    =&gt; PHORUM_USER_ACTIVE<br />
		);<br />
		phorum_api_user_save($user, PHORUM_FLAG_RAW_PASSWORD);		<br />
	<br />
		chdir($curcwd);<br />
		//End Phorum<br />
	}<br />
[/code]<br />
im not sure why its doing that...<br />
<br />
note: the admin acct uid is 1 and it works fine with that]]></description>
            <dc:creator>KellyLSB</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 06 Apr 2010 14:09:48 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,142038#msg-142038</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,142038#msg-142038</link>
            <description><![CDATA[ It was whitespace! THANKS! That was driving me crazy. Phorum is online and awesome!]]></description>
            <dc:creator>hawaiiorganics</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 21 Nov 2009 16:13:14 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,141971#msg-141971</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,141971#msg-141971</link>
            <description><![CDATA[ The error means that a header is being sent (probably to set a session cookie), while body output has already been done. The headers already sent error should tell you where previous body output was done.<br />
<br />
Possibly, you have some white-space outside &lt;?php .. ?&gt; in your code. In your code, I see no obvious body output.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 17 Nov 2009 17:02:03 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,141924#msg-141924</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,141924#msg-141924</link>
            <description><![CDATA[ I am new to Phorum (and fairly new to PHP and mySQL) but it is obviously very powerful and, as evidenced in this thread, there is an awesome support network! So first off, a big thank you to developers and Maurice whose posts have already proved  invaluable to installing and modding Phorum to my current project. <br />
<br />
The problem: I am using a slightly altered form of the script posted earlier in the thread. Phorum recognizes the session user_id and user databases are synced. However, I am consistently getting a &quot;Cannot modify header information - headers already sent&quot; warning stemming from my mod and it messes with the phorum/admin.php interface as well. From other threads and some googling, I deduce that I am making some sort of header call, but I can&#039;t find the problem. Can anyone spot the problem? Thanks!<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>modd.php</strong><br />
&lt;?php<br />
<br />
<br />
/* phorum module info<br />
title: MySite External Authentication For Phorum<br />
author: Me:  This module allows authentication to Phorum from MySite external application<br />
hook: user_session_restore|mod_phorum_User_Session_Restore<br />
*/<br />
<br />
if(!defined(&quot;PHORUM&quot;)) return;<br />
<br />
session_start();<br />
<br />
<br />
function mod_phorum_User_Session_Restore($data){<br />
<br />
		// This function restores the Phorum session, inherited from the site SESSION.<br />
<br />
		// We do not want to run this when we&#039;re in the admin or upgrade interface.<br />
		if (defined(&#039;PHORUM_ADMIN&#039;) || defined(&#039;PHORUM5_CONVERSION&#039;)) return $data;<br />
<br />
		global $PHORUM_CONNECTOR;<br />
<br />
		// Retrieve the user_id of the current user from the PHP session data. The user_id is really the<br />
		// only thing that needs to be remembered for a Phorum session, because all other data for the user is stored<br />
		// in the database. If no user id was set in the session, then use FALSE to flag this to Phorum.<br />
<br />
		$phorum_user_id = empty($_SESSION[&#039;user_id&#039;])? FALSE : $_SESSION[&#039;user_id&#039;];<br />
<br />
		// Populate the user_session_restore hook<br />
<br />
		$data[PHORUM_SESSION_LONG_TERM]  = $phorum_user_id;<br />
		$data[PHORUM_SESSION_SHORT_TERM] = $phorum_user_id;<br />
<br />
		// Check tshe admin status of user, and set flags accordingly<br />
<br />
		if ($phorum_user_id) {			// Find admin status by looking at Phorum &quot;Admin&quot; flag<br />
			// check admin flag<br />
			$user_data = phorum_api_user_get($phorum_user_id);<br />
			if ($user_data &amp;&amp; ($user_data[&#039;admin&#039;] &gt; 0)) {		// Admins are &quot;1&quot;<br />
				// user is admin<br />
				$data[PHORUM_SESSION_ADMIN] = $phorum_user_id;<br />
			}<br />
			else {<br />
				// User is not admin<br />
				$data[PHORUM_SESSION_ADMIN] = FALSE;<br />
			}<br />
		}<br />
<br />
		return $data;<br />
<br />
	}<br />
?&gt;<br />
<br />
<br />
</div></blockquote>]]></description>
            <dc:creator>hawaiiorganics</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sun, 15 Nov 2009 01:11:42 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138701#msg-138701</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138701#msg-138701</link>
            <description><![CDATA[ When you have created the Phorum user with the exact same user_id as the user in your main system, then setting these fields should work. Nothing has been changed in them.<br />
<br />
Take a look at the <a href="http://www.phorum.org/docs/html/developer/ch03s17s03.html" target="_blank" >hook documentation for user_session_restore</a> for a rather clean and extensively documented user_session_restore implementation. Compare that to what you have done so far. Also, double check that a Phorum user exists for the user_id that you have inside the function. A quick way to check would be code like:<br />
<br />
[code=&quot;php&quot;]<br />
$user_id = $_SESSION[&#039;user_id&#039;];<br />
$user = phorum_api_user_get($user_id);<br />
if (empty($user)) {<br />
    trigger_error(&quot;User with user_id $user_id does not yet exist in Phorum!&quot;, E_USER_ERROR);<br />
}<br />
[/code]]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 16 Jun 2009 14:44:05 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138694#msg-138694</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138694#msg-138694</link>
            <description><![CDATA[ I am trying to integrate my existing application&#039;s user authentication with phorum.<br />
I have done the steps described by RickM, and I too dont seem to be getting the session transferred to phorum.<br />
I am setting $_SESSION[&#039;user_id&#039;] in my application.<br />
<br />
As suggested by Maurice, I have added print_r($_SESSION); to list the session variables in the function mod_phorum_User_Session_Restore. <br />
On adding this, I see the correct value of user_id as set by my application. This means that the value of user_id session variable is correctly set when I am on the phorum page, and also that the function is being called. <br />
In spite of that, phorum does not recognize that I am logged in.<br />
<br />
Maurice, could you please give some suggestions on this? Is it possible that some of  the steps in mod_phorum_User_Session_Restore are obsolete in the version of phorum I am using (5.2.11)? For example, this function sets the user_id value from the session variable into $data[PHORUM_SESSION_LONG_TERM] and $data[PHORUM_SESSION_SHORT_TERM]. Is it possible that these variables are named differently in the phorum version I am using?<br />
<br />
I would really appreciate some suggestions / pointers on this issue.<br />
<br />
Warm Regards.<br />
<br />
P.S. I am not using &quot;session_name&quot; or &quot;session_set_cookie_params&quot;]]></description>
            <dc:creator>sonali.gupta</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 16 Jun 2009 13:46:00 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138522#msg-138522</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138522#msg-138522</link>
            <description><![CDATA[ Yep, you are right. Thanks for the advice everyone! It&#039;s up and working...]]></description>
            <dc:creator>shark262</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 03 Jun 2009 18:01:25 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138517#msg-138517</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138517#msg-138517</link>
            <description><![CDATA[ maybe you are starting a completely separate session than phorum does. <br />
You are using session_name(&#039;...&quot;), sure this will work with phorum ? <br />
first try without &quot;session_name&quot; and &quot;session_set_cookie_params&quot;]]></description>
            <dc:creator>BorisN</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 03 Jun 2009 07:27:56 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138509#msg-138509</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138509#msg-138509</link>
            <description><![CDATA[ You&#039;ll have to do some debugging on that, since the basic idea of Rick&#039;s code seems okay to me. Two things that you can do:<br />
<br />
<ul><li> Add a <span style="color:#009900">die(&quot;blah&quot;);</span> statement in the function mod_phorum_User_Session_Restore() to see if it is really called. </li><li> Add a <span style="color:#009900">print_r($_SESSION);</span> to the function, to see if the expected session data is available when running the function. </li></ul>]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 02 Jun 2009 02:03:45 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138508#msg-138508</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138508#msg-138508</link>
            <description><![CDATA[ Thank you for the help. Now the user is correctly being inserted into the &quot;phorum_users&quot; table.<br />
<br />
Now I&#039;m having trouble with the final 2 steps:<br />
5. Make sure the $_SESSION(&#039;user_id&#039;) value gets set in your main site when a valid logon takes place.<br />
6. Thats it. Now when you navigate to Phorum from within your site, the user session should get passed into Phorum.<br />
<br />
I log-in to my website (see log-in code below), but the session doesn&#039;t seem to transfer when I browse to the Phorum directory. If I turn off the module (posted above by RickM) then I can go to the Phorum pages directly and log-in there. How can I keep the module enabled and only have the user log-in once?<br />
<br />
		<span style="font-size:small">// Query the database.<br />
		$query = &quot;SELECT user_id, username, first_name, DATE_FORMAT(last_login, &#039;%M %D, %Y at %l:%i %p&#039;) as last_login, last_name, access_level, email, zip, state, city, hometelephone, mailing_address, mailing_address2, number_of_logins FROM member_database WHERE (username=&#039;$u&#039; AND password=PASSWORD(&#039;$p&#039;))&quot;;		<br />
		$result = mysql_query ($query) or die(mysql_error());<br />
		$row = mysql_fetch_array ($result, MYSQL_NUM);		<br />
		<br />
		if ($row) { // A match was made.<br />
				<br />
				// Start the session, register the values &amp; redirect.<br />
				session_name (&#039;YourVisitID&#039;);<br />
				session_set_cookie_params (600, &#039;/folder/&#039;, &#039;[<a href="http://www.mywebsiteURL/&#039" target="_blank"  rel="nofollow">www.mywebsiteURL</a>];);<br />
				session_start();<br />
				$_SESSION[&#039;user_id&#039;] = $row[0];<br />
				$_SESSION[&#039;username&#039;] = $row[1];<br />
				$_SESSION[&#039;first_name&#039;] = $row[2];<br />
				$_SESSION[&#039;last_login&#039;] = $row[3];<br />
				$_SESSION[&#039;last_name&#039;] = $row[4];<br />
				$_SESSION[&#039;access_level&#039;] = $row[5];<br />
				$_SESSION[&#039;email&#039;] = $row[6];<br />
				$_SESSION[&#039;zip&#039;] = $row[7];<br />
				$_SESSION[&#039;state&#039;] = $row[8];<br />
				$_SESSION[&#039;city&#039;] = $row[9];<br />
				$_SESSION[&#039;hometelephone&#039;] = $row[10];<br />
				$_SESSION[&#039;mailing_address&#039;] = $row[11];<br />
				$_SESSION[&#039;mailing_address2&#039;] = $row[12];<br />
				$_SESSION[&#039;number_of_logins&#039;] = $row[13];<br />
				header (&quot;Location:  [<a href="http://&quot" target="_blank"  rel="nofollow">&quot</a>]; . $_SERVER[&#039;HTTP_HOST&#039;] . dirname($_SERVER[&#039;PHP_SELF&#039;]) . &quot;/loggedin.php&quot;);<br />
				exit();</span>]]></description>
            <dc:creator>shark262</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 01 Jun 2009 22:26:14 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138507#msg-138507</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138507#msg-138507</link>
            <description><![CDATA[ 1) Check your server to make sure the mysqli.php file exists in the proper subdirectory.<br />
2) Check to make sure you are changing to the phorum directory before you run the includes.<br />
<br />
		[code=&quot;php&quot;]<br />
               $curcwd = getcwd();<br />
		$dir = $curcwd . &quot;/Phorum&quot;;<br />
		chdir( $dir );<br />
[/code]<br />
That /Phorum exists<br />
ie if you are in your root directory for the server, you can successfully change to Phorum directory.]]></description>
            <dc:creator>DavidVB</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 01 Jun 2009 21:55:39 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,138506#msg-138506</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,138506#msg-138506</link>
            <description><![CDATA[ Thanks for this code. I&#039;ve been attempting to integrate it with my user registration page, but keep getting this error:<br />
<br />
Fatal error: The Phorum MySQL database layer is unable to find the extension file ./include/db/mysql/mysqli.php on the system. Check if all Phorum files are uploaded and if you did specify the correct &quot;mysql_php_extension&quot; in the file include/db/config.php (valid options are &quot;mysql&quot; and &quot;mysqli&quot;).<br />
<br />
Could you help me with any ideas on fixing this?]]></description>
            <dc:creator>shark262</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 01 Jun 2009 20:21:30 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,137000#msg-137000</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,137000#msg-137000</link>
            <description><![CDATA[ Hi, I&#039;m also a total noob at this and I&#039;ve been banging my head over the same thing, but I think I&#039;ve worked it out now.<br />
<br />
So, step-by-step, here&#039;s what you need to do.<br />
<br />
1. Firstly you need to make sure that the users in the phorum_users table match your main system (or at the very least, the username and user_id). <br />
I did this by just adding the following code to my script which registers a new user<br />
<br />
[code=&quot;php&quot;]<br />
                // Add the new user to the Phorum users table<br />
		<br />
		$curcwd = getcwd();<br />
		$dir = $curcwd . &quot;/Phorum&quot;;<br />
		chdir( $dir );<br />
		<br />
		define(&quot;PHORUM&quot;, 1);<br />
		global $PHORUM;<br />
		<br />
		//Phorum Includes<br />
				<br />
		include_once(&quot;./include/db/config.php&quot;);<br />
		include_once(&quot;./include/db/mysql.php&quot;);<br />
		include_once(&quot;./include/api/base.php&quot;);<br />
		include_once(&quot;./include/api/user.php&quot;);<br />
<br />
		// Get the new MB user_id from the INSERT<br />
		$Query = &quot;SELECT user_id FROM members WHERE Username = &#039;$sUsername&#039;&quot;;<br />
		$rsUserID = mysql_query($Query, $conn_Mozziebite) or die(mysql_error());<br />
		$row_rsUserID = mysql_fetch_assoc($rsUserID);<br />
<br />
		$Phorum_user_id = $row_rsUserID[&#039;user_id&#039;];<br />
		$Phorum_Username = $_POST[&#039;username&#039;];<br />
		$Phorum_Password = $_POST[&#039;pass&#039;];<br />
		$Phorum_Email = $_POST[&#039;email&#039;];<br />
<br />
		$user = array(<br />
          	&quot;user_id&quot;   =&gt; $Phorum_user_id,<br />
           	&quot;username&quot;  =&gt; $Phorum_Username,<br />
           	&quot;password&quot;  =&gt; $Phorum_Password,<br />
			&quot;email&quot;     =&gt; $Phorum_Email,<br />
           	&quot;admin&quot;     =&gt; 0,<br />
           	&quot;active&quot;    =&gt; PHORUM_USER_ACTIVE<br />
       	);<br />
		<br />
       	phorum_api_user_save($user, PHORUM_FLAG_RAW_PASSWORD);		<br />
		<br />
		chdir($curcwd);<br />
<br />
[/code]<br />
<br />
<br />
<br />
<br />
2. Make a mod function which handles the user_session_restore hook. Mine is below, just change the bits in the <br />
    comments at the top where it says &quot;MySite&quot; or &quot;Me&quot; to something appropriate to you. Leave the rest of the comment      section as it is - this is the bit that tells Phorum what hooks are called. Copy this code into a module, call it &quot;mod_something.php&quot;and save in the /Phorum/mods/ directory.<br />
<br />
[code=&quot;php&quot;]<br />
&lt;?php<br />
<br />
/* phorum module info<br />
title: MySite External Authentication For Phorum<br />
category: admin<br />
category: integration<br />
category: user_management<br />
author: Me:  This module allows authentication to Phorum from MySite external application<br />
hook: user_session_restore|mod_phorum_User_Session_Restore<br />
*/<br />
<br />
if(!defined(&quot;PHORUM&quot;)) return;<br />
<br />
session_start();<br />
<br />
function mod_phorum_User_Session_Restore($data){<br />
		<br />
		// This function restores the Phorum session, inherited from the site SESSION.	<br />
		<br />
		// We do not want to run this when we&#039;re in the admin or upgrade interface.<br />
		if (defined(&#039;PHORUM_ADMIN&#039;) || defined(&#039;PHORUM5_CONVERSION&#039;)) return $data;<br />
		<br />
		global $PHORUM_CONNECTOR;<br />
<br />
		// Retrieve the user_id of the current user from the PHP session data. The user_id is really the<br />
		// only thing that needs to be remembered for a Phorum session, because all other data for the user is stored<br />
		// in the database. If no user id was set in the session, then use FALSE to flag this to Phorum.<br />
		<br />
		$phorum_user_id = empty($_SESSION[&#039;user_id&#039;])? FALSE : $_SESSION[&#039;user_id&#039;];<br />
<br />
		// Populate the user_session_restore hook<br />
<br />
		$data[PHORUM_SESSION_LONG_TERM]  = $phorum_user_id;<br />
		$data[PHORUM_SESSION_SHORT_TERM] = $phorum_user_id;<br />
		<br />
		// Check the admin status of user, and set flags accordingly <br />
		<br />
		if ($phorum_user_id) {			// Find admin status by looking at Phorum &quot;Admin&quot; flag<br />
			// check admin flag<br />
			$user_data = phorum_api_user_get($phorum_user_id);<br />
			if ($user_data &amp;&amp; ($user_data[&#039;admin&#039;] &gt; 0)) {		// Admins are &quot;1&quot;<br />
				// user is admin<br />
				$data[PHORUM_SESSION_ADMIN] = $phorum_user_id;<br />
			}<br />
			else {<br />
				// User is not admin<br />
				$data[PHORUM_SESSION_ADMIN] = FALSE;<br />
			} <br />
		}<br />
<br />
		return $data;<br />
<br />
	}<br />
<br />
?&gt;<br />
<br />
[/code]<br />
<br />
<br />
3. Upload this module to your server. This &quot;installs&quot; it.<br />
4. Go into Phorum/Admin.php. Go into Modules on the left. You should see the title of your module (the one from the comment section at the top) somewhere on the page. Change from &quot;off&quot; to &quot;on&quot;. Submit the changes. Your module is now part of Phorum and the mod_phorum_User_Session_Restore() function will be called automatically when Phorum hits its user_session_restore hook.<br />
5. Make sure the $_SESSION(&#039;user_id&#039;) value gets set in your main site when a valid logon takes place.<br />
6. Thats it. Now when you navigate to Phorum from within your site, the user session should get passed into Phorum.]]></description>
            <dc:creator>RickM</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Thu, 05 Mar 2009 18:31:59 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,136851#msg-136851</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,136851#msg-136851</link>
            <description><![CDATA[ Before you can do the integration of login, you need a way to populate the phorum user database (the cleanest way to do this is with the phorum api for adding users). You then need to keep users information in sync between the two databases (mainly email addresses, but you could also add in privacy options, groups etc.).<br />
<br />
For some of the things that need doing see:<br />
[<a href="http://www.phorum.org/phorum5/read.php?28,131041,131108#msg-131108" target="_blank" >www.phorum.org</a>]]]></description>
            <dc:creator>DavidVB</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 28 Feb 2009 08:56:36 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,136849#msg-136849</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,136849#msg-136849</link>
            <description><![CDATA[ There is a lot more than simple authentication going on in Phorum for the users.  You have things like signatures, post counts, subscriptions to posts, new message flags, etc, all of which require Phorum to have its own user table.  The best method really is to use the user_session_restore hook as this will do just what you described, authenticating the Phorum users via your external program.<br />
<br />
If you are not able to code your own module to use this hook based on the example found by searching these forums and are not able to code your own plugin to use my External Authentication module, then you will have to wait until I have the free time to help you with this or someone else has the time to help you.  Unfortunately my project list seems to be growing rapidly these days so that may be two or three months.]]></description>
            <dc:creator>Joe Curia</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Fri, 27 Feb 2009 13:49:49 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,136846#msg-136846</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,136846#msg-136846</link>
            <description><![CDATA[ Hi Joe,<br />
<br />
Thanks for the response, I think I will need to create a module. <br />
Is there not a way that I can just check my own DB when authenticating in the Phorum? There is surely a way to do that without creating a module etc? <br />
Sorry possibly a stupid question to you guys but this could possibly be way over my head as a developer.<br />
<br />
David]]></description>
            <dc:creator>daithicollins</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Fri, 27 Feb 2009 08:52:31 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,136844#msg-136844</guid>
            <title>Re: Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,136844#msg-136844</link>
            <description><![CDATA[ You could try your hand at creating a plugin for my External Authentication module.  I have a base plugin there which has many comments and tips and also a developers guide which may be useful.  If nothing else you can look at it and the other plugins built for it as examples of where you need to go.]]></description>
            <dc:creator>Joe Curia</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Fri, 27 Feb 2009 07:18:08 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,136843,136843#msg-136843</guid>
            <title>Integrating Phorum with my sites Users DB</title>
            <link>https://www.phorum.org/support/read.php?28,136843,136843#msg-136843</link>
            <description><![CDATA[ Hi,<br />
<br />
Im a newbie to all this, I have read all of the posts on &quot;user_session_restore&quot; and still cannnot make sense of this integration.<br />
Is there a step by step guide to adding the users or checking the usernames and passwords in my DB and integrating it with the Phorums DB.<br />
<br />
This is really bothering me and I cannot seem to even get the first step. can anyone help me out, as I said I have read the forums on this and I just cannot a start on it. Any help would be greatly appreciated.<br />
<br />
Regards,<br />
David]]></description>
            <dc:creator>daithicollins</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Fri, 27 Feb 2009 05:39:10 -0600</pubDate>
        </item>
    </channel>
</rss>
