Store Community Support Documentation
metro

Is there an option to redirect users to their profile when the login? 4.7.9

Be the first person to like this.
YouNetCo
#1

Hi Metro, 

phpFox has not supported this function yet. You can redirrect user to a specific URL only https://prnt.sc/qiqfuv

YouNetCo

Be the first person to like this.
JohnJr
#2

Ok, if you want a hack for the code which you would have to refix on any upgrades or stuff.  Always write down what you did and write down what the code was before your change and make a backup copy of the code indicating the original.

File:

PF.Base/module/module/user/include/component/controller/login.class.php

Line: 114

on line 113 the code checks to see if there is something in the redirect field in the admincp.  So first you want to put something in there even though you are not using what you put in that so I put the word test.

Then on line 114 you want to remove or comment out:$sReturn = Phpfox::getParam('user.redirect_after_login');

and replace it with this line $sReturn = Phpfox::getLib('phpfox.url')->makeUrl($aUser['user_name']);

Not held respondable for goofing up your site so if you don't know what your doing don't do it.  In this example I would make three files.

The first file would be the original file with no changes and I would rename the ending with _ORG

PF.Base/module/module/user/include/component/controller/login.class_ORG.php

The second file would consist of the change or new code and would be used by phpfox

PF.Base/module/module/user/include/component/controller/login.class.php

The third file would be a copy of the second file which has the new code but is a backup copy so after you do an upgrade and download the new file you old code will be erased so you can open this copy to help you see what you wrote down in your notes of what you did in the first place.  I would call this file:

PF.Base/module/module/user/include/component/controller/login.class_CODE.php

 

Be the first person to like this.
metro
#3

Is it just me or does the second part of your response to the link does not make sense at all? I got the first part no not being supported.

Hi Metro, 

phpFox has not supported this function yet. You can redirrect user to a specific URL only https://prnt.sc/qiqfuv

YouNetCo

Be the first person to like this.
metro
#4

Thanks JohnJr will try it tonight.

Ok, if you want a hack for the code which you would have to refix on any upgrades or stuff.  Always write down what you did and write down what the code was before your change and make a backup copy of the code indicating the original.

File:

PF.Base/module/module/user/include/component/controller/login.class.php

Line: 114

on line 113 the code checks to see if there is something in the redirect field in the admincp.  So first you want to put something in there even though you are not using what you put in that so I put the word test.

Then on line 114 you want to remove or comment out:$sReturn = Phpfox::getParam('user.redirect_after_login');

and replace it with this line $sReturn = Phpfox::getLib('phpfox.url')->makeUrl($aUser['user_name']);

Not held respondable for goofing up your site so if you don't know what your doing don't do it.  In this example I would make three files.

The first file would be the original file with no changes and I would rename the ending with _ORG

PF.Base/module/module/user/include/component/controller/login.class_ORG.php

The second file would consist of the change or new code and would be used by phpfox

PF.Base/module/module/user/include/component/controller/login.class.php

The third file would be a copy of the second file which has the new code but is a backup copy so after you do an upgrade and download the new file you old code will be erased so you can open this copy to help you see what you wrote down in your notes of what you did in the first place.  I would call this file:

PF.Base/module/module/user/include/component/controller/login.class_CODE.php

 

Be the first person to like this.
JohnJr
#5

Metro, the second part YouNetCo showed you an image where you could put a static URL like event which would redirect the user to the home page of events.  Since what you ask is different...a dynamic URL that each person has a different profile URL (user_name if User Name is used in the URL or user_id if the User Id is used in the URL).  Since you are hacking the code...just enter some word in the admincp URL direct after login as it doesn't matter what text you put...but there has to be something because there is some code somewhere that checks whether there is something in that field or not before it runs the code we change.  I just entered the word test.  Hope this helps.

Be the first person to like this.
metro
#6

Thanks for helping dicipher their response.

Be the first person to like this.