<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Another integration question</title>
        <description>I also would like to use my standard login on my homepage as the main source for logging in but still have the ability to use phorum but without logging in, just a straight homepage to phorum approach.  I understand it&#039;s all about passing the right session variable to phorum.

This is part of my login code where I set my sessions and this is where the phorum session probably should be created to, 

  session_start(); 
        $_SESSION[&#039;user_id&#039;]= $id;  
	$_SESSION[&#039;user_name&#039;] = $user_name;
        //phorum sessions here?

but what are the correct phorum sessions to set?  Any help/guidance would be greatly appreciated..</description>
        <link>https://www.phorum.org/support/read.php?28,144473,144473#msg-144473</link>
        <lastBuildDate>Wed, 16 Sep 2026 16:29:45 -0500</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144575#msg-144575</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144575#msg-144575</link>
            <description><![CDATA[ Hey Maurice, seemed simple enough..  Somethings you never think of but that makes sense.  I&#039;m going to do a 301 redirect in my htaccess file..  You think that should be fine..<br />
<br />
Thank you for all your help..]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 22:31:54 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144573#msg-144573</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144573#msg-144573</link>
            <description><![CDATA[ I tested out your site with the data you sent me in PM and I found the problem.<br />
<br />
The reason that things did no longer work after the first click in Phorum is that you had yoursite.com configured in the Phorum HTTP Path setting, while you are accessing your main site and the first page of Phorum through www.yoursite.com.<br />
<br />
Because of the hostname difference, cookies were not transferred after the first click in the forums.<br />
<br />
If things do work for you, then you probably strart out at the yoursite.com URL instead of www.yoursite.com, making the cookie available over all pages.<br />
<br />
I updated you HTTP Path in the forum general settings to fix the cookie issue.<br />
<br />
To make things robust, you should add some rewriting rules to you site to always redirect &quot;yoursite.com&quot; to &quot;www.yoursite.com&quot;.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 18:00:24 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144572#msg-144572</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144572#msg-144572</link>
            <description><![CDATA[ Is the hostname in the URL still the same when you leave the Phorum front page? Does it still mention the username when you have left the front page?]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 17:50:12 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144571#msg-144571</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144571#msg-144571</link>
            <description><![CDATA[ I have a couple test accounts setup and it logs everyone in fine, but when they goto reply to a topic some people can, others get sorry only registered members can post..<br />
<br />
Also, all users who sign in from my site and goto the forum link, it says on the main forum page welcome and there username but it&#039;s when they leave the main forum page for example if they click a folder and goto a topic inside the folder instead of the reply box it says &quot;sorry only registered users....&quot;<br />
<br />
just trying to give as much information as possible..]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 15:46:21 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144570#msg-144570</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144570#msg-144570</link>
            <description><![CDATA[ Hey Thomas, I meant to answer you earlier also.  In external authentication settings you can enable log on/log out register in the settings so I had turned that on to see if they could login that way.<br />
<br />
Maurice they say it&#039;s still not working for them.. Can I give you access to my site and have you check it out to see if you see anything out of the ordinary..?]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 14:49:51 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144563#msg-144563</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144563#msg-144563</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Maurice Makaay</strong><br />
With &quot;matching&quot; I mean the actual value, not the naming. But if this would fix things for you, it&#039;s fine of course.</div></blockquote>
<br />
Yea, that&#039;s is what I meant as well, that the values for each user based on id we&#039;re the same but while confirming that I saw that id from my users table and user_id from phorum_users were not the same.<br />
<br />
Thanks in advance and i&#039;ll let you know if this was it..]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 09:20:07 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144562#msg-144562</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144562#msg-144562</link>
            <description><![CDATA[ With &quot;matching&quot; I mean the actual value, not the naming. But if this would fix things for you, it&#039;s fine of course.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 08:33:24 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144561#msg-144561</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144561#msg-144561</link>
            <description><![CDATA[ I knew my user ids matched however instead of using user_id in my user table structure, I used just id, so I changed my id to user_id went back on my php pages changed it there as well and i&#039;m going to have them see if that fixes the issue.  Should..  thanks for your help guys.  Let you know if that&#039;s the case.]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 08:16:25 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144552#msg-144552</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144552#msg-144552</link>
            <description><![CDATA[ Are the user ids matching between the main application and Phorum? It almost sounds like they might be not, resulting in a not logged in user in the end.<br />
<br />
If you have the module enabled, do you see the &quot;welcome, username&quot; in the page showing the correct username?]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 03:48:33 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144549#msg-144549</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144549#msg-144549</link>
            <description><![CDATA[ uhm, thats all confusing. how do you login to the phorum &quot;from your website&quot; when the module is disabled?]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Wed, 19 May 2010 02:30:13 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144547#msg-144547</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144547#msg-144547</link>
            <description><![CDATA[ Hey David, no it is not..  set to 0 along with the other two users.  All 3 of us are set to active = 1 and admin = 0.  It&#039;s kind of a weird problem, I just enabled login and logout from external authentication and tried to login that way, when i login with any user &quot;I get the sorry only registered users...&quot; error.  But if I login from my website and and goto the forums I can post with any user..  If I disable external authentication module it gives me the option to reply but if the module is enabled the option to reply gives the error &quot;sorry, only register users...&quot;]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 18 May 2010 19:37:54 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144546#msg-144546</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144546#msg-144546</link>
            <description><![CDATA[ Is your account set up as an administrator? (admin accounts can access everything)]]></description>
            <dc:creator>DavidVB</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 18 May 2010 18:46:27 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144545#msg-144545</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144545#msg-144545</link>
            <description><![CDATA[ Why would I(also being a regular user) be able to do it and not them?  Nothing was special about my account than theirs..]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 18 May 2010 16:33:16 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144543#msg-144543</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144543#msg-144543</link>
            <description><![CDATA[ Maybe forum permissions that don&#039;t allow regular users access to the forum(s)?]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 18 May 2010 16:10:38 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144541#msg-144541</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144541#msg-144541</link>
            <description><![CDATA[ Hey Maurice, i&#039;m having a weird problems.  I have no issue login in, posting, replying, however my test users are having problems.  I had 2 friends create accounts on my main page where I insert in 2 different tables, my user table and the phorum_users table.  My code for the phorum_users insert is <br />
<br />
[code=&quot;php&quot;]<br />
mysql_query(&quot;INSERT into phorum_users(`username`,`display_name`,`password`, `email`, `active`, `admin`, `date_added`)<br />
		    VALUES (&#039;$user_name&#039;,&#039;$user_name&#039;, &#039;$md5pass&#039;, &#039;$usr_email&#039;, &#039;1&#039;, &#039;0&#039;,&#039;$time&#039;)&quot;) or die(mysql_error());<br />
[/code]<br />
<br />
The users show up in both databases fine, I have no issue with my account like I said posting or replying but 2 of my users, different states/different houses say when they try and reply it says &quot;Sorry, only registered users may post in this forum.&quot;<br />
<br />
Why would I have no issue but they would?<br />
<br />
Thanks]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Tue, 18 May 2010 16:02:24 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144528#msg-144528</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144528#msg-144528</link>
            <description><![CDATA[ From the user_session_restore hook you can tell Phorum explicitly that no session is available. From the developer documentation for this hook:<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>Phorum developer documentation</strong><br />
The array that is passed to this hook, contains a key for each of the Phorum session types:<br />
<br />
    * PHORUM_SESSION_LONG_TERM<br />
    * PHORUM_SESSION_SHORT_TERM<br />
    * PHORUM_SESSION_ADMIN<br />
<br />
What the module has to do, is fill the values for each of these keys with the user_id of the Phorum user for which the session that the key represents should be considered active. Other options are FALSE to indicate that no session is active and NULL to tell Phorum to handle session restore on its own.</div></blockquote>
<br />
Therefore, you will need an else block in your code to logout the user:<br />
<br />
<pre class="bbcode">
if (!empty($_SESSION[&#039;user_id&#039;])) {
    $session_data[PHORUM_SESSION_LONG_TERM] = $_SESSION[&#039;user_id&#039;];
    $session_data[PHORUM_SESSION_SHORT_TERM] = $_SESSION[&#039;user_id&#039;];
} else {
    $session_data[PHORUM_SESSION_LONG_TERM] = FALSE;
    $session_data[PHORUM_SESSION_SHORT_TERM] = FALSE;
}
</pre>]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 21:04:29 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144527#msg-144527</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144527#msg-144527</link>
            <description><![CDATA[ Hey Maurice, is the approach the same when it comes to logging out?  I want to logout from my main site, when I do that now it leaves the user logged in to the forum..  I notice that there are a couple cookies<br />
<br />
name - phorum_session_v5<br />
phorum_session_v5 - 2%3Af95a9ee79834793f373259cfacfcce38<br />
host - mywebsite.com<br />
path - /forum<br />
<br />
name - PHPSESSID<br />
content - 1e78992a237453473bacc1a902ee232b<br />
host - mywebsite.com<br />
path - /<br />
<br />
My logout page:<br />
<br />
[code=&quot;php&quot;]<br />
&lt;?php<br />
session_start(); <br />
/************ Delete the sessions ************/<br />
unset($_SESSION[&#039;user_id&#039;]);<br />
unset($_SESSION[&#039;user_name&#039;]);<br />
<br />
/************ Delete the cookies ************/<br />
setcookie(&quot;user_id&quot;, &#039;&#039;, time()-60*60*24*60, &quot;/&quot;);<br />
setcookie(&quot;user_name&quot;, &#039;&#039;, time()-60*60*24*60, &quot;/&quot;);<br />
<br />
/************ redirect to home page ************/<br />
header(&#039;Location: [<a href="http://&#039" target="_blank"  rel="nofollow">&</a>]; . $_SERVER[&#039;HTTP_HOST&#039;] . $_SERVER[&#039;REQUEST_URL&#039;].&#039;/site/&#039;);<br />
?&gt; <br />
[/code]]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 20:56:10 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144526#msg-144526</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144526#msg-144526</link>
            <description><![CDATA[ Great, have fun with it!]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 20:05:10 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144525#msg-144525</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144525#msg-144525</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Maurice Makaay</strong><br />
Hard to tell without knowing your setup. E.g. is $_SESSION[&#039;user_id&#039;] actually the user id as setup by your main application or is your main app handling sessions differently? And did you also create a Phorum user for the provided user id, prior to trying to enforce a session for that user through this hook construction? If you have no matching Phorum user, then setting the user id through the user_session_restore hook will never work.<br />
<br />
Something tells me that all of the above might be true. So far, you seem to be copying and pasting pieces of code, trying to get it to work. Coding rarely works like that. Maybe I&#039;m wrong of course.<br />
<br />
The clear issue in the code that you pasted is that you check $_SESSION[&#039;user_id&#039;] and you set $user_id. That $user_id variable is never initialized.<br />
<br />
The code should therefore at least read:<br />
<pre class="bbcode">
    if (!empty($_SESSION[&#039;user_id&#039;])) {
		$session_data[PHORUM_SESSION_LONG_TERM] = $_SESSION[&#039;user_id&#039;];
		$session_data[PHORUM_SESSION_SHORT_TERM] = $_SESSION[&#039;user_id&#039;];
    }
</pre></div></blockquote>
<br />
YES! This was it^..  Thanks Maurice for all your help!]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 20:00:05 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144524#msg-144524</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144524#msg-144524</link>
            <description><![CDATA[ Hard to tell without knowing your setup. E.g. is $_SESSION[&#039;user_id&#039;] actually the user id as setup by your main application or is your main app handling sessions differently? And did you also create a Phorum user for the provided user id, prior to trying to enforce a session for that user through this hook construction? If you have no matching Phorum user, then setting the user id through the user_session_restore hook will never work.<br />
<br />
Something tells me that all of the above might be true. So far, you seem to be copying and pasting pieces of code, trying to get it to work. Coding rarely works like that. Maybe I&#039;m wrong of course.<br />
<br />
The clear issue in the code that you pasted is that you check $_SESSION[&#039;user_id&#039;] and you set $user_id. That $user_id variable is never initialized.<br />
<br />
The code should therefore at least read:<br />
<pre class="bbcode">
    if (!empty($_SESSION[&#039;user_id&#039;])) {
		$session_data[PHORUM_SESSION_LONG_TERM] = $_SESSION[&#039;user_id&#039;];
		$session_data[PHORUM_SESSION_SHORT_TERM] = $_SESSION[&#039;user_id&#039;];
    }
</pre>]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 19:50:15 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144523#msg-144523</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144523#msg-144523</link>
            <description><![CDATA[ I&#039;ve got no clue what&#039;s wrong with it, I&#039;ve tried just about everything.  <br />
<br />
[code=&quot;php&quot;]<br />
    if (!session_id()) session_start();<br />
    // If the user is logged into the main session, then tell Phorum<br />
    // to use the user_id from the session.  <br />
<br />
    if (!empty($_SESSION[&#039;user_id&#039;])) {<br />
		$session_data[PHORUM_SESSION_LONG_TERM] = $user_id;<br />
		$session_data[PHORUM_SESSION_SHORT_TERM] = $user_id;<br />
    }<br />
[/code]<br />
<br />
that&#039;s the updated code, but it&#039;s like it just doesn&#039;t recognize the session. Any ideas?  It&#039;s beginning to get frustrating to figure out.]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 19:32:19 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144522#msg-144522</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144522#msg-144522</link>
            <description><![CDATA[ Yes, that is the one.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 19:19:58 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144521#msg-144521</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144521#msg-144521</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Maurice Makaay</strong><br />
The external authentication module uses a different variable name for storing the sessions. Also, at the end you won&#039;t have to return it. Just set the active sessions in the variable as provided by external authentication. It was something like $phorum_sessions I think, but check the examples as included in the bundle to check if this is correct.</div></blockquote>
<br />
I dont see $phorum_sessions, I see<br />
<br />
$session_data[PHORUM_SESSION_LONG_TERM] = $user_id;<br />
$session_data[PHORUM_SESSION_SHORT_TERM] = $user_id;<br />
<br />
Is this it?]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 19:12:02 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144519#msg-144519</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144519#msg-144519</link>
            <description><![CDATA[ The external authentication module uses a different variable name for storing the sessions. Also, at the end you won&#039;t have to return it. Just set the active sessions in the variable as provided by external authentication. It was something like $phorum_sessions I think, but check the examples as included in the bundle to check if this is correct.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 16:45:45 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144517#msg-144517</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144517#msg-144517</link>
            <description><![CDATA[ So this is the new code i&#039;m using that I dug out of the archives here..<br />
<br />
[code=&quot;php&quot;]<br />
&lt;?php<br />
<br />
/* phorum module info<br />
hook:  user_session_restore|external_authentication<br />
title: External Authentication<br />
desc:  This module uses a external authentication system to log user into Phorum.<br />
*/<br />
<br />
// Check if we are loaded from the Phorum code.<br />
// Direct access to this file is not allowed.<br />
if (! defined(&quot;PHORUM&quot;)) return;<br />
<br />
    // Override the session handling for front end forum sessions.<br />
    // Retrieve a session from a standard PHP session by first<br />
	// starting a PHP session if that was not done yet...<br />
    if (!session_id()) session_start();<br />
<br />
    // ...and then retrieving the user_id of the current user<br />
    // from the PHP session data. The user_id is really the<br />
    // only thing that needs to be remembered for a Phorum<br />
    // session, because all other data for the user is stored<br />
    // in the database. If no user id was set in the session,<br />
    // then use FALSE to flag this to Phorum.<br />
    $phorum_user_id = empty($_SESSION[&#039;user_id&#039;])<br />
                    ? FALSE : $_SESSION[&#039;user_id&#039;];<br />
	<br />
    // The other two need to be updated. If the main system does<br />
    // not use the concept of one long and one short term cookie<br />
    // (named &quot;tight security&quot; by Phorum), then simply assign<br />
    // the user_id to both PHORUM_SESSION_LONG_TERM and<br />
    // PHORUM_SESSION_SHORT_TERM.<br />
    $sessions[PHORUM_SESSION_SHORT_TERM] = $phorum_user_id;<br />
    $sessions[PHORUM_SESSION_LONG_TERM] = $phorum_user_id;<br />
	$sessions[PHORUM_SESSION_ADMIN] = FALSE; // ignores any previous admin sessions<br />
<br />
	// If user is admin, fill out the following. This changes<br />
	// the default behaviour for external logins.<br />
	if ($phorum_user_id) {<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)) {<br />
			// user is admin<br />
			$sessions[PHORUM_SESSION_ADMIN] = $phorum_user_id;<br />
		} <br />
	}<br />
<br />
    return $sessions;<br />
?&gt;<br />
[/code]<br />
<br />
This is in a file called hook_user_session_restore.php, inside of mods/external_authentication/plugins_bin/tgl(my folder)/hook_user_session_restore.php.  <br />
<br />
My users are synced in both tables by user id and username and in the phorum_users are set to active = 1.  <br />
<br />
With this explanation do you guys see anything that would be causing the phorum to not log my users into the phorum?]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Mon, 17 May 2010 13:42:00 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144504#msg-144504</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144504#msg-144504</link>
            <description><![CDATA[ Yea, I seem to be missing something somewhere because when i login from my homepage and click my forum link in my nav it takes me to my phorum forum but it must not be passing my session, I tried both ways above with no luck.  I made it it&#039;s own module(repeated login from homepage), tried using the external authentication way without the function with no luck as well.  I have one user in both user tables, my users table and the phorum_users table with the same id, same username, same password.  Do the sessid_lt, sessid_st need to be cleared of the data inside them for this to work?<br />
<br />
I appreciate both of your patience, again any help or guidance would be greatly appreciated.]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 15 May 2010 09:40:01 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144498#msg-144498</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144498#msg-144498</link>
            <description><![CDATA[ As Thomas already states, I posted a simple module to inherit the user id from $_SESSION[&#039;user_id&#039;]. It was not an example file for the external authentication module. If you want to use that module, then do not put a function in the hook_user_session_restore.php file. Instead, put the body of my code in there. The external authentication module includes those hook files from its own hook implementations, so if you put a function in there, all you&#039;ll be doing is define a new function without really executing any code.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 15 May 2010 03:15:26 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144496#msg-144496</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144496#msg-144496</link>
            <description><![CDATA[ the example module given doesn&#039;t require the external authentication module at all.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 15 May 2010 02:22:27 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144494#msg-144494</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144494#msg-144494</link>
            <description><![CDATA[ Ok, very helpful information.  Some more questions though so I can finish figuring this out.  When I create my own hook_user_session_restore file and create a new plugin folder in the external authentication mod and add my hook_user_session_restore file, I set the default settings on the modules page, choose the new folder I created for my hook, change the setting for the external path to my site where users login and it should be up and running?  Just want to make sure i&#039;m not missing anything, if I use that same code from that forum post for my hook will it still work, from the code I don&#039;t see why it wouldnt as my session is set on the login page the same as that, $_SESSION[&#039;user_id&#039;], the code was..<br />
<br />
[code=&quot;php&quot;]<br />
function phorum_mod_your_user_session_restore($sessions)<br />
{   <br />
    // Phorum does not start a session, so we have to start it<br />
    // here to be able to access the main application&#039;s $_SESSION data.<br />
    // The session_id() is checked to not to call session_start() twice.<br />
    if (!session_id()) session_start();<br />
    // If the user is logged into the main session, then tell Phorum<br />
    // to use the user_id from the session.  <br />
    if (!empty($_SESSION[&#039;user_id&#039;])) {<br />
        $sessions[PHORUM_SESSION_SHORT_TERM] = $_SESSION[&#039;user_id&#039;];<br />
        $sessions[PHORUM_SESSION_LONG_TERM] = $_SESSION[&#039;user_id&#039;];<br />
    }<br />
 <br />
    return $sessions;<br />
}<br />
[/code]]]></description>
            <dc:creator>parduezy</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 15 May 2010 01:54:11 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?28,144473,144489#msg-144489</guid>
            <title>Re: Another integration question</title>
            <link>https://www.phorum.org/support/read.php?28,144473,144489#msg-144489</link>
            <description><![CDATA[ No, you cannot use that. You do not setup a Phorum session from your login code. Instead, you let Phorum restore a session based on your main application&#039;s session. So in your case, from within Phorum you would check the $_SESSION data of your main app and tell Phorum to restore a session for the user_id that you found. &quot;From within Phorum&quot; here means &quot;From a custom Phorum module&quot;.<br />
<br />
It seems generally hard to understand this, so don&#039;t worry about that. Most applications handle the single sign on issue by setting up session data for child applications. I don&#039;t know why though. The Phorum way is definitely better.<br />
<br />
* No hacking in the main app required<br />
* Clean module solution for Phorum<br />
* Sessions are always perfectly in sync<br />
<br />
<a href="http://www.phorum.org/phorum5/read.php?61,144419" target="_blank" >Here&#039;s a recent thread</a> that handles the same issue. It also shows a tiny example module for letting Phorum inherit a $_SESSION data based session from a main app.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Integration</category>
            <pubDate>Sat, 15 May 2010 00:05:41 -0500</pubDate>
        </item>
    </channel>
</rss>
