Attempt (help needed) with horizontal login module for Joomla

Started by phil_roy, March 16, 2006, 07:17:55 PM

Previous topic - Next topic

phil_roy

Hi all,

I'm about to move my site from a "Joomla with integrated phpBB component" set up to "Joomla with wrapped SMF" approach. I've been testing the forum locally on my Mac for about a week (the whole conversion thing, themes etc.) and I'm really pleased with how it is all going.

One of the things my site users have asked for a lot is for the forum login to be visible in all areas of the site and not just the front page. In terms of design, the best place for this to happen would be in the horizontal menu bar that runs along the top of my template.

So...I've hacked (and trust me, "hacked" is an appropriate terms for what I've done) the "mod_smf_login.php" file....and its kinda working.

Kinda..meaning odd things happen...the "Login" button jumps when you first click on it. When you login the page redirects to an unwrapped version of the forum (which was never what I wanted) and when you log out, it again jumps to an unwrapped version.

I removed so much stuff in my attempt to develop a really simple horizontal module, that I'm fairly sure I removed the functionality needed....so I'm going back now trying to figure out what I've done.

But....someone out there knows this stuff better than me. I also have no idea if the "Remember Me" item truly will work on a live site.

So basically....is there anyone out there that wants to look at it and see what fixes are needed? I'm more than happy for anyone who wants to use this to have it and lay no claims to the code.

Temporary address for it...
http://www.bluengrey.com/mod_smf_login.php.zip

Phil
PS...I'm fairly sure this can be posted based on what I read in the license.txt file...if not, can someone kill off this post quick smart.
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

You are missing a number of required hidden inputs in the form from the login module:

<input type="hidden" name="hash_passwrd" value="" />
<input type="hidden" name="op2" value="login" />
<input type="hidden" name="option" value="com_smf" />
<input type="hidden" name="Itemid" value="', $menu_item['id'], '" />
<input type="hidden" name="action" value="login2" />
<input type="hidden" name="returnurl" value="', $params->get('login'), '" />
<input type="hidden" name="lang" value="', $mosConfig_lang, '" />
<input type="hidden" name="return" value="', $mosConfig_sef=='1' ? sefReltoAbs(basename($_SERVER['PHP_SELF']) . '?' . $_SERVER['QUERY_STRING']) : $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?' . $_SERVER['QUERY_STRING'], '" />
<input type="hidden" name="message" value="', $message_login, '" />


QuotePS...I'm fairly sure this can be posted based on what I read in the license.txt file...if not, can someone kill off this post quick smart.

As long as it is temporary, it should be fine.  The license permits you to modify files, just not to redistribute the modified files.

phil_roy

Hmm..OK....in that case I've removed the file. I'll now make the changes you suggest and if I still have no luck, I will get back to this thread.

So there's no way to allow SMF people themselves to make this file available...not that I'm suggesting my haxk is good, just possibly useful.

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

You can provide instructions on how to modify a file, but not redistribute the modified file.

So, you can give instructions like, find this code:  and replace with this code: 

Or, what you could do, because your login module is very much different, is just make sure to use only your own code, and not a derivative of the original mod_smf_login module.  Your module is already so different that it shouldn't be too hard.  You can probably do away with most of the params initiated in the xml file, and loaded at the beginning of the module.

This is an interesting question, because other modules for use with the bridge are released by others under the GPL license.  Of course, none of those are alternatives to the basic bridge release, they are add-ons.

phil_roy

Yes...it's why I asked. I could claim it's my own code, but I'd be lying....I can't code...just figure out and rearrange other peoples (the module is a combination of the bridge one and SMF code I pasted back in when I made a mess). Because I've done so much changing I may not be able to figure what instructions I need to write. Not to worry.

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

phil_roy

I've put the file up again briefly to see if anyone can offer some more advice. The login button still jumps left when clicked on...so you have to enter info again. The site still redirects to an unwrapped version of the forum, which isn't what I'm after...and on logout, it redirects to an unwrapped version also.

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

phil_roy

I've gone back to the original login module and found the code I was missing to get the login working to redirect to the right page.....but still, when I click logout, it redirects to an unwrapped forum?

I also tidied up the code to remove the table I had setting it all up and now use DIV tags.

Anyone have any idea why it still won't logout and redirect to the right place? (see file link in first post)

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

Anything that redirects to the stand alone forum is caused by a PHP error.  Check your SMF error log in your SMF admin panel for clues.

phil_roy

I'm getting the same error, but seems to be happening on login even though login works. Have no idea what it means...
QuoteToday at 10:17:50 AM
192.168.1.2
9a48b29cc364d82a34fc7ea330d1426e
http://127.0.0.1/nzmac/forums/index.php?option=com_smf&amp;Itemid=159&amp;action=login2

8: Undefined index: sa
File: /Library/WebServer/Documents/nzmac/components/com_smf/smf.php
Line: 497
Note that I'm testing locally on my Mac. Also not that the redirect error does not happen if I revert back to the original login module...so it's definitely mine that is the fault.

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Kindred

the sa error is a known issue with the 1.1.2 bridge....

see thecombined readme for the fix to that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

phil_roy

The fix you mention about 'sa' and listed here...

http://www.simplemachines.org/community/index.php?topic=25718.0

...certainly means my error log on the forum is now free or errors. But it doesn't resolve the issue that I'm having with the hacked module discussed....in other words....when logging out, it is still redirecting to an unwrapped forum (I should point out that I set the bridge to redirect to the same page)....so not only is it going to an unwrapped forum...I didn't want it to go to the forum in the first place.

I know it's my hacked module that is causing it, but I can't see anything in the original that I don't have in my version?

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

phil_roy

Anyone? Launching my new SMF forum at the end of the week and I'm desperate to get this working....steering at the code and not seeing what I've hacked to cause the issue.

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

Did you get all the hidden input variables?  They are all required.

phil_roy

Yep...I'm fairly sure it has something to do with this code (as the issue is only happening on logout) but as I have no idea what it means, I'm stuck...
Quoteif ($params->get('logout')=="2")
         $_SESSION['return'] = sefReltoAbs(basename($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING']);

         echo '<a href="', sefReltoAbs($scripturl . 'action=logout&amp;returnurl='.$params->get('logout').'&amp;sesc='. $context['session_id']), '">', $smf_logout_button ? '<img src="' . (!empty($smf_logout_button_image) && $smf_logout_button_image!="" ? $smf_logout_button_image : $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif').'" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108], '</a>
Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

phil_roy

Sorry...what I should also ask...is how could I replace this code so that it simply says "Logout" (text, never any graphic) and it will always redirect to the page the user is on? I'm not going to want it any other way and can avoid dealing with 'params' then can't I?

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

echo '<a href="', sefReltoAbs($scripturl . 'action=logout&amp;sesc='. $context['session_id']), '">', $txt[108], '</a>';

phil_roy

http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Advertisement: