Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2012, 10:21 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 05-29-2012, 06:25 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you sure you want that hook? maybe profile_updateprofile
Reply With Quote
  #3  
Old 05-30-2012, 06:47 PM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Simon Lloyd View Post
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
Reply With Quote
  #4  
Old 06-02-2012, 02:59 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 06-06-2012, 08:42 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by basketmen View Post
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')
{
}
Reply With Quote
  #6  
Old 09-29-2012, 05:56 PM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by basketmen View Post
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
Reply With Quote
  #7  
Old 09-29-2012, 09:05 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 09-30-2012, 03:04 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 09-30-2012, 07:41 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:03 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.04146 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete