Advertisement:

Author Topic: [TUTO] Redirect after login  (Read 7374 times)

volunteer

  • Full Member
  • ***
  • Posts: 241
[TUTO] Redirect after login
« on: June 07, 2014, 03:49:28 pm »
credits for user teseo

in core file oc-includes/osclass/controller/login.php

Locate this block (line 48 on Osclass 3.3.2):

Code: [Select]
$url_redirect = osc_get_http_referer();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

and replace it with the following to redirect to dashboard:

Code: [Select]
$url_redirect = osc_user_dashboard_url();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

or redirect to user profile:

Code: [Select]
$url_redirect = osc_user_profile_url();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

Remember that being a core file, you'll need to redo this modification every time you upgrade Osclass.



FOR FACEBOOK CONNECT PLUGIN

If you are using the facebook plugin for login and want to redirect you need to modify the file user-login.php in your theme folder

locate:
 
Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
and add the following line after:
Code: [Select]
<?php if($_GET["state"]!=''){ header('Location: /index.php?page=user&action=profile' ); } ?>
this is a bit odd solution but it works for me, if someone knows better pls let me know :)

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TUTO] Redirect after login
« Reply #1 on: June 08, 2014, 12:44:18 am »
@volunteer
Could it be done without modifying core files?
I.e. replace this function with new one?
http://www.php.net/manual/en/function.override-function.php

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #2 on: June 23, 2014, 01:40:43 pm »
credits for user teseo

in core file oc-includes/osclass/controller/login.php

Locate this block (line 48 on Osclass 3.3.2):

Code: [Select]
$url_redirect = osc_get_http_referer();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

and replace it with the following to redirect to dashboard:

Code: [Select]
$url_redirect = osc_user_dashboard_url();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

or redirect to user profile:

Code: [Select]
$url_redirect = osc_user_profile_url();
                                        $page_redirect = '';
                                        if(osc_rewrite_enabled()) {

Remember that being a core file, you'll need to redo this modification every time you upgrade Osclass.



FOR FACEBOOK CONNECT PLUGIN

If you are using the facebook plugin for login and want to redirect you need to modify the file user-login.php in your theme folder

locate:
 
Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
and add the following line after:
Code: [Select]
<?php if($_GET["state"]!=''){ header('Location: /index.php?page=user&action=profile' ); } ?>
this is a bit odd solution but it works for me, if someone knows better pls let me know :)

dear volunteer & other gurus

my site has stopped redirecting users to main page after login...  it redirects to site.com/main.php ( a blank page)
due to this ads posting has dropped to zero ( i guess, users login and give up after they reach at a blank page )

in admin area
no redirect after any change made in: users, listings backup

i recently added social media addthis buttons
am using twitter

plz help
already tried/edited  oc-includes/osclass/controller/login.php but no use 
am not using facebook plgin

www.eAdsDubai.com
 
« Last Edit: June 23, 2014, 01:42:19 pm by eAdsDubai »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TUTO] Redirect after login
« Reply #3 on: June 23, 2014, 02:23:20 pm »
Hi,

It still happens when you disable AddThis? ???

Regards

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #4 on: June 23, 2014, 03:27:47 pm »
Hi,

It still happens when you disable AddThis? ???

Regards

dear sir...
yes after i removed addthis code
still its behaving like same

got this link in address bar after i disabled a user in admin area  ( and a blank page, i have to hit back button always to return )

http://eadsdubai.com/oc-admin/index.php?page=users&action=disable&id[]=501&CSRFName=CSRF1410311325_1595003379&CSRFToken=cf86297943dd9db8e8a9762b9a15b9a3381b486009e853ec44c262683f1b28eb33959f63fecf35124f7f3181bf1c76a7e8f9fe054f9fbc649a4ec8b0273237fc

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #5 on: June 23, 2014, 03:31:19 pm »
mak greets

got this ( with a blank page) after marking ads as premium

http://eadsdubai.com/oc-admin/index.php

then again pressed back button to return to OC Admin

regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TUTO] Redirect after login
« Reply #6 on: June 23, 2014, 03:51:00 pm »
Let's see: is your problem related to this "Redirect after login" hack? Did you apply it and then you have all these issues? ???

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #7 on: June 23, 2014, 04:00:01 pm »
Let's see: is your problem related to this "Redirect after login" hack? Did you apply it and then you have all these issues? ???

no dear sir

i applied this to troubleshoot the problem
but it didnt work
then i restored the original code there at line 48 in login.php    $url_redirect = osc_get_http_referer();

i had problem, searched for the resolution
found this, tried this but it didnt work
then i restored the original code
regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TUTO] Redirect after login
« Reply #8 on: June 23, 2014, 04:09:54 pm »
Then this is the wrong place to ask for help, please open a new thread to see if someone might help you.

Regards

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #9 on: June 23, 2014, 04:21:06 pm »
Then this is the wrong place to ask for help, please open a new thread to see if someone might help you.

Regards
@ teseo sir
thanks very much for your time and advice  :)
regards

DHAAds

  • Jr. Member
  • **
  • Posts: 56
Re: [TUTO] Redirect after login
« Reply #10 on: June 24, 2014, 05:12:09 pm »
sorry dear members
i made false statement by mistake
my site is redirecting to "eAdsDubai.com/index.php"  not to "eAdsDubai.com/main.php"
regards

Aficionado

  • Guest
Re: [TUTO] Redirect after login
« Reply #11 on: June 24, 2014, 05:37:07 pm »
sorry dear members
i made false statement by mistake
my site is redirecting to "eAdsDubai.com/index.php"  not to "eAdsDubai.com/main.php"
regards

Why do you highjack a TUTORIAL thread/forum ? Why you ruin others work in here ?