News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Redirect on Login and/or Logout mod.

Started by PJLawrence, October 05, 2008, 06:52:07 PM

Previous topic - Next topic

PJLawrence

Link to Mod

This mod will allow admins to be able to select the URLs where users will be directed to after they have either login or logout.

This mod I've used on my own site to redirect people to the forum when they login.
Then when they logout to the main website home page. 

Once installed, go to the Features and Options, Basic Settings area of your admin panel.
(SMF version 2 go to Miscellaneous under Configuration, Modifications of your admin panel)
-Find the enable logon redirect and logout settings.
-Select whether you want to redirect the user when they login and/or logout.
-Enter the required URLs.

Notes...
If you don't provide the full url path (i.e. http://yoursite.xxx/home.html) SMF assumes it's an SMF function and appends http://yoursite.xxx/index.php? before the URL address.
For example if you specify board=1.0 this automatically becomes http://yoursite.xxx/index.php?board=1.0
Other examples, to send the user to the forum front page enter the URL as action=forum, to send them to board two enter board=2.0 etc etc...
To send them to another webpage enter http://yoursite.xxx/mywebpage and so on.

If for some reason you are informed that your browser cannot display a webpage when you login/out.
Simply retype your forum web address and go to feature and option settings and correct the login or logout URL loaction.
Alternatively type http://yoursite.xxx/index.php?action=featuresettings which will take you directly to your forum setting page if the problem occurred when logging in.

This mod only redirects the user if the $_SESSION['login_url'] or $_SESSION['logout_url'] are not set, hence should be compatible with other mods/functions which assign these variables.

Disclaimer: This mod is provided "as is" without express or implied warranty.

Changelog
   0.2 - October, 2008 (First release)
   0.3 - 20th October, 2008 (Support for SMF Version 2.0 Beta 4)

SMF Versions: 1.1.5, 1.1.6 and 2.0 Beta 4


Bass_Chaz

I tried this through the 1.1.6 admin and go an error in the scources.modsettings.php file.

I tried to edit that file but it came up with the error again when I tried to install again.


Filipina

Love this mod idea :)  When I downloaded it showed all files ok so I completed the install.  Then this was showing at the top of my forum.  Any idea?

// PJL : Start of Redirect on login Mod. $txt['logon_redirect_enable'] = 'Enable Logon Redirect
(This redirect users to given URL when they login)'; $txt['logon_redirect_url'] = 'Enter Login URL'; $txt['logout_redirect_enable'] = 'Enable Logout Redirect?
(This redirect users to given URL when they logout)'; $txt['logout_redirect_url'] = 'Enter Logout URL'; // End Mod.

PJLawrence

Bass_Chaz
This mod searches for the following code in the sourcedir/ModSettings.php file.

array('check', 'securityDisable'),
'',


If for some reason this is missing it won't install correctly, for example changed by another module you've installed.

If you go to your admin feature settings is there a line under your Disable administration security option?

PJLawrence

#5
Filipina,

The text you see at the top of your forum should be inserted at the end of the following files...
Modifications.english.php
Modifications.english_british.php
Modifications.english_british-utf8.php
When you installed the mod did you see which one of these were modified?

If you can open your Modifications.english.php
Make sure that ?> is at the end of the file. If not, move it there.
Save and upload.

Also, did the un-install work ok?

Filipina

thanks PJ that was it the little ?> needed moved down a line and over.  Yes it did unistall fine and now I have reinstalled and all is working fine.  Thanks!

Bass_Chaz

Quote from: PJLawrence on October 07, 2008, 05:28:02 AM
Bass_Chaz
This mod searches for the following code in the sourcedir/ModSettings.php file.

array('check', 'securityDisable'),
'',


If for some reason this is missing it won't install correctly, for example changed by another module you've installed.

If you go to your admin feature settings is there a line under your Disable administration security option?

Yes. Hide SMF version from normal users

PJLawrence

Bass_Chaz,

For now I can only suggest that you un-install the Hide SMF version mod first. Then install this mod followed by re-installing the Hide SMF version mod which should work.
Note that to remove this mod once the Hide SMF version mod has been re-install you may need to un-install Hide SMF version mod first.

Possibly at the weekend I will look at whether I can change the way this redirection mod installs so that it can accommodate changes like this made by other mods.

Bass_Chaz

#9
Thank you for the direction...

I removed the setting in the modsetting.php file manually as the package wasn't available in my list to un-apply.

Now I'll try to put it back in and see if that works.
BUT the mod is in place and shows up...

Thanks again..

tjhanes

#10
Awesome Mod, didn't have any problems with the install. However, i do have a bug i can't figure out.

I am using SimpePortal, so my main homepage is the "index.php" file, and the actual Forum home uses the "index.php?action=forum".

In the admin, I set both redirect URL's to the homepage (http://www.hotshotsgolf.org/index.php) so they would be taken to the MAIN homepage. However, the redirect ends up taking them to "http://www.hotshotsgolf.org/action=forum", which of course ends up with a 404 page not found.

To test it was working, i changed redirect to "www.yahoo.com" and it works perfectly. Any ideas as to why its disregarding my entry for the .index URL, but working fine for yahoo.com url?

Thanx in advance, tj.

PJLawrence

tjhanes,

Just tested my mod with simpleportal and yes there seems to be a problem if you use
http://www.yoursite.xxx/index.php as the redirection url. I think the reason could be that simpleportal could be modifying this  url on login/logout to send the user to the forum.

When I set the redirection url address as http://www.yoursite.xxx/ this seems to solve the problem. Hence in your case try http://www.hotshotsgolf.org/ which should take you to your home page.

tjhanes


jossanaijr

Is there a way to redirect on login to last post (membergroup permissions of course)?

PJLawrence

Not really, since this is probably the job of a another mod like Force Topic Read on Login
You could try setting the login url as action=recent this will show the most resent posts for the forum.


jossanaijr

Quote from: PJLawrence on November 07, 2008, 01:45:01 PM
Not really, since this is probably the job of a another mod like Force Topic Read on Login
You could try setting the login url as action=recent this will show the most resent posts for the forum.


Ok, I will try.
Force Topic Read on Login not automatically goes to last post.  You need to choose it.

jossanaijr

#16
action=recent

Yes working!  I just will check permissions.

EDIT:  Yes, permissions working too.  Great!

Ricky.

Great mod.. very useful .. I too had problem regarding installation .. I made some changes  manually.. working great as of now.

Thankyou Buddy for nice work!

Ricky.

Can we have random redirects ?
ie. I am using it to show people special post every time they log in. If it can have more than one option to redirect then would be good and members will too find it interesting to read random important information every time they log in.

PJLawrence

Ricky, Thanks for the feedback.
Are you looking for a mod which displays a random post/news article when a person logs in?
Also I noticed that you had problems when installing this mod. Could you please let me know what they were since this information can be useful when is comes to updating this mod.

Advertisement: