vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help make after updating profile, redirect to another page, not to usercp.php (https://vborg.vbsupport.ru/showthread.php?t=283625)

basketmen 05-29-2012 10:21 AM

Help make after updating profile, redirect to another page, not to usercp.php
 
Currently, after updating profile, its redirect to usercp.php right? i want to make it redirect to another page, for example to forum home, some other members should need this too


i tried create a simple plugin, using profile_start hook
the page are redirected, but the profile are not saved

Quote:

if ($_POST['do'] == 'updateprofile')
{
$vbulletin->url = 'http://domain.com/forum/index.php';
standard_redirect();


i already tried change the Execution Order to 99999999, but still same
please help make it still redirected, but can saved the profile, what i need to change or use?

Simon Lloyd 05-29-2012 06:25 PM

Are you sure you want that hook? maybe profile_updateprofile :)

basketmen 05-30-2012 06:47 PM

Quote:

Originally Posted by Simon Lloyd (Post 2334396)
Are you sure you want that hook? maybe profile_updateprofile :)

thank you for the answer

- i already tried the hook profile_updateprofile and the code just like this :

Quote:

$vbulletin->url = 'http://domain.com/forum/index.php';
standard_redirect();
the page are still redirected, but the profile still not saved


- i already tried profile_complete hook too, but its not redirected and the profile not saved


- the other alternative maybe using if referrer page condition, like this
Quote:

if ($vbulletin->urlreferrer == 'http://domain.com/forum/profile.php?do=editprofile')
{
if ($_POST['do'] == 'updateprofile')
{
$vbulletin->url = 'http://domain.com/forum/index.php;
standard_redirect();
}
}
only need what is the right code to call referrer url in bold above



please help guys to make this works, its should be easy enough, how is the code need to used actually

basketmen 06-02-2012 02:59 AM

up, please help guys if you have the information

current vbulletin url code are $vbulletin->url
but what is the code for vbulletin url referrer? is this right : $vbulletin->urlreferrer

basketmen 06-06-2012 08:42 AM

Quote:

Originally Posted by basketmen (Post 2335679)
up, please help guys if you have the information


current vbulletin url code are $vbulletin->url
but what is the code for vbulletin url referrer? is this right : $vbulletin->urlreferrer

after searching again, i thik i found it, in includes/database_error_message.html file, there is a variable for the referer page, it is $referer
Referrer : $referer


so i tried this in bold

Quote:

if ($vbulletin->referer == 'http://domain.com/forum/profile.php?do=editprofile')
{
if ($_POST['do'] == 'updateprofile')
{
$vbulletin->url = 'http://domain.com/forum/index.php;
standard_redirect();
}
}
or this

Quote:

if ($referer == 'http://domain.com/forum/profile.php?do=editprofile')
{
if ($_POST['do'] == 'updateprofile')
{
$vbulletin->url = 'http://domain.com/forum/index.php;
standard_redirect();
}
}

the profile are saved, but after the not redirected to http://domain.com/forum/index.php



please help guys if you know to make in the bold works

why this if condition works
if ($vbulletin->url == 'http://domain.com/forum/profile.php?do=editprofile')
{
}

but this one not
if ($vbulletin->referer == 'http://domain.com/forum/profile.php?do=editprofile')
{
}

basketmen 09-29-2012 05:56 PM

Quote:

Originally Posted by basketmen (Post 2334226)
Currently, after updating profile, its redirect to usercp.php right? i want to make it redirect to another page, for example to forum home, some other members should need this too


i tried create a simple plugin, using profile_start hook
the page are redirected, but the profile are not saved





i already tried change the Execution Order to 99999999, but still same
please help make it still redirected, but can saved the profile, what i need to change or use?

up again

anyone if you have suggestion please post it

its looks like easy, but i am still cant get the working code or hook
the question is basic enough in the first post

kh99 09-29-2012 09:05 PM

If you look in profile.php for all the places where $vbulletin->url is set to user.php, you'll see a number of them. If you wanted to change it in that file you'd either need to edit the file and change them all, or else have a number of plugins that set $vbulletin->url and then did everything else the code does before exiting.

But another approach that might work is to use the hooks redirect_generic and header_redirect to try to catch it just before the redirect happens. (Those hooks are both in includes/functions.php so it might help to look in there to see what's going on).

For the redirect_generic plugin you'd need to do some sort of replace on the variables $js_url, $url, and $formfile to replace usercp.php with something else (and if you need parameters in the url, it will be more complicated). For instance you might be able to do something like this:

Code:

if (THIS_SCRIPT == 'private')
{
    $find = "usercp.php";
    $replace = "index.php";

    $url = str_replace($find, $replace, $url);
    $js_url = str_replace($find, $replace, $js_url);
    $formfile = str_replace($find, $replace, $formfile);
}


and in the header_redirect plugin, something like this:

Code:

if (THIS_SCRIPT == 'private')
{
    $find = "usercp.php";
    $replace = "index.php";

    $url = str_replace($find, $replace, $url);
}


Warning: I haven't tried this code at all.

basketmen 09-30-2012 03:04 AM

Many many thanks, the plugin code is works
so basically its using replacement methode, in redirect hook, so this things is exist, awesome

i am really helped, thank you very much
for vb staff, i recommend increase kh99 salary, or promote him :D

kh99 09-30-2012 07:41 AM

There's one thing I forgot - you really should check for THIS_SCRIPT == 'private' so that the str_replace is only done for private.php (unless there *are* other pgaes where you want it done). I've added it to my above post above.


All times are GMT. The time now is 02:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01094 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete