Redirecting previous page using Socialengine SocialDNA plugin

Socialengine SocialDNA plugin is a wonderful plugin that allows your community to connect with multiple social networking sites like facebook, linkedin etc. We have been doing socialengine customization for one of our client and used this plugin for the community. The only issue with the plugin is that after validating the facebook credentials, it redirects user to the home page instead of the previous page. Our client wanted to modify this behavior and wanted to have a stream line experience for the users i.e. user should be redirected to the previous visited page rather than home page.

So problem was if a user is visiting some page which user can view only and decides to login in order to do any action on this page. So whenever user clicks on SocialDNA facebook connect button from the socialengine community site, It would open a dialog box in which user can enter facebok credentials. After authenticating the facebook credentials, it redirect user to the home page not the page where user came. This can be very annoying experience for the community user so we decided to change this behaviour. Our socialengine developers dig out the source code of SocialDNA plugin and found a way to customize the plugin. Our developers found that its pretty easy to change the behavior as only need to get the previous page referrer and that can be retrieved from Server’s Parameter. So we made changes in controlls AuthController.php and QuickSignupController.php  as below:
Change

return $this->_helper->_redirector->gotoRoute(array('action' => 'home'), 'user_general', true);

to

return $this->_helper->redirector->gotoUrl( $_SERVER['HTTP_REFERER']);

With the above changes, plugin should able to work as desired behavior i.e. user should be redirected to the previous page on the socialengine.
We offer end-to-end SocialEngine expertise, including consultancy, implementation, customization, migration from older versions of SocialEngine and performance tuning. Feel free to contact us if you have any query related to socialengine development.

Resources:

Leave a Comment

Scroll to Top