Firefox PHP

Module: External Authentication

Posted by Joe Curia 
Re: Module: External Authentication
November 01, 2009 07:08PM

Thanks for pointing out that bug, I'm not sure why I never saw it. I have fixed it in R4 of the Drupal plugin (you really only need to install the hook_user_save.php file).

Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: External Authentication
November 04, 2009 06:58AM
Thnx! Uploading new version as we speak.


^AU^ Assassins United
November 27, 2009 05:43PM

Edited 1 time(s). Last edit at 12/10/2009 01:42PM by jorgealexander.
Re: Module: External Authentication
March 26, 2010 01:17PM

Firstly just to say thanks for this mod and the Drupal plugin. It looks like an excellent solution and I've pretty much got it all working.

One slight problem I've had is the call to phorum_mod_external_authentication_db_get_user in hook_user_session_restore.php. I was getting an undefined function call error. Adding

Language: PHP

to the top of hook_user_session_restore.php fixed the issue but I think I'm probably missing something since no one else has reported this problem.

I've deployed phorm into the root of my Drupal site. The folder structure from there is:

        db_bin (location of phorum_mod_external_authentication_db_get_user)
        plugins_bin (location of hook_user_session_restore.php that causes the error)

Any advise would be really appreciated on this.

Finally I'm not currently embedding the forum in the site. Login to Drupal is correctly creating the session in phorm (which is great!) but when I navigate to the forum there is no logout link. Should I expect to see one? Equally what would be the correct approach for showing a register/login link at the top of the forum for anonymous users looking at the forum?

Thanks in advance for any help,
Re: Module: External Authentication
March 26, 2010 04:56PM

but when I navigate to the forum there is no logout link. Should I expect to see one? Equally what would be the correct approach for showing a register/login link at the top of the forum for anonymous users looking at the forum?

No, you won't expect to see a login/register or logout links (the embedding template assumes that the main page you are embedding phorum in will take care of that). They could be added in the header.tpl file in the template directory you use. You could look at the header.tpl file in the emerald template to see for the code that will generate the links (around lines 113-137 - user-info div). You would need to change the link addresses to point to the site's registration, login and logout pages in your revised header.tpl file.

Edited 2 time(s). Last edit at 03/26/2010 05:15PM by DavidVB.
Re: Module: External Authentication
March 29, 2010 12:19PM

Thanks for clarifying David.

I've found a couple more little quirks/bugs in the drupal module, hope this helps:
  • There's a typo in phorum_module_external_authentication.module on line 233. Instead of $GLOBALS it says "$GLABALS". This looks like it would impact the language used on the forum if it was anything other than English.
  • In the "Phorum server path" admin settings within Drupal the path contains "common.php" by default. So it looks something like "c:\www\forum\common.php" it should just be "c:\www\forum". It took me a while of debugging to realise this. The value of this setting is used to set the current working directory. The call to chdir($PHORUM_DIR) fails due to the presence of common.php.

A quick question: I've now embedded the forum within the drupal site and it seems to be working fine. I haven't switched the template yet to "Generic Integration" as described in the documentation - can anyone tell me what the difference is between the "Generic Integration" and the default phorum template? Since it seems to be working ok on the default template what would switching to "Generic Integration" do?


Edited 1 time(s). Last edit at 03/29/2010 07:27PM by pauld.
Re: Module: External Authentication
May 07, 2010 08:56PM
The module does not work well when the Drupal memcache module is enabled, exactly User logs in correctly in Drupal, but the forum is not logged. How do I fix this?
Re: Module: External Authentication
May 11, 2010 05:01PM
Hi Damian,

I was just about to post a fix for this. As you've found the module assumes Drupal uses the session DB table.

I'm not sure why the session table is explicitly used - because a full drupal bootstrap has been performed the global $user is available.

All I'll I've done is edit hook_user_session_restore.php and replace this code:

Language: PHP
foreach($_COOKIE as $session_id) { $user = db_fetch_object(db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = ';%s';", $session_id));   // We found the client';s session record and they are an authenticated user if ($user && $user->uid > 0) { // This is done to unserialize the data member of $user $user_data = drupal_unpack($user);   break; } }

With this code:
Language: PHP
global $user; $user_data = $user;

I haven't tested thoroughly yet but it seems to work fine. Does anyone know _why_ it wasn't done this way to start with? Does it cause issues I've yet to discover?

I've also found that if you set $base_url in Drupals settings php the forum won't correctly load for anonymous users. My fix was simply to unset the variable (we didn't need it) and this corrected the problem.

Hope this helps,
Re: Module: External Authentication
May 12, 2010 07:39PM
I seem to be having a slightly one sided conversation here!

Hopefully someone can help with this. I've found an issue which causes the user session to be terminated when they try to send a private message or access the control center. The issue is caused by a conflict in how Drupal uses global $user and line 115 in control.php:

Language: PHP
$user = $PHORUM[';user';];

Prior to this code being executed hook_user_session_restore.php has been invoked when has done a full Drupal bootstrap. This sets up the global $user. Line 115 in control.php then overwrites global $user with the phorum user.

Finally sess_write (found in in Drupal) is called as the session ends, this accesses the now corrupted global $user variable and tries to update the users session - but unfortunately causes the session to expire. In turn this logs the user out of phorum because next time hook_user_session_restore.php is called it can't marry up the forum and Drupal sessions.

I reverted the changes I suggested in the previous post to see if that made any difference - it didn't.

Does anyone have any idea what I can do about this because I'm totally stumped?


Edited 1 time(s). Last edit at 05/12/2010 07:44PM by pauld.
Re: Module: External Authentication
May 13, 2010 11:26AM
I take it that the problem comes in after all the phorum code has run.

In the mod, I would save the uncorrupted user date to a variable in the global $PHORUM array (be sure you generate a unique name for this)
At the end of footer.tpl add some php code to restore the user variables.
Sorry, only registered users may post in this forum.

Click here to login