vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Which of these code changes are 'safe'/correct? (https://vborg.vbsupport.ru/showthread.php?t=110293)

Razasharp 03-13-2006 10:36 PM

Which of these code changes are 'safe'/correct?
 
I am trying to change the page a user is sent to after replying to a thread.

With help from members Merk and Andreas I have located the bit of the newreply.php file which I need to change, in particular this bit:

$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]#post$newpost[postid]";

which is half way ish down this bit of code:


PHP Code:

if (strtolower($vbulletin->userinfo['lang_charset']) == 'iso-8859-1')
{
    
$vbulletin->userinfo['lang_charset'] = 'windows-1252';
}

$db->close();
@
header('Content-Type: text/html' iif($vbulletin->userinfo['lang_charset'] != '''; charset=' $vbulletin->userinfo['lang_charset']));
echo 
"<!-- postbit ok --><!-- time " TIMENOW " -->" process_replacement_vars($postbits);
// #############################################################################
// #############################################################################
// #############################################################################
        
}
        else
        {
            if (
$newpost['visible'] OR can_moderate($foruminfo['forumid'], 'canmoderateposts'))
            {
                if (
$threadview $threadinfo['lastpost'])
                {
                    
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]&amp;posted=1#post$newpost[postid]";
                }
                else
                {
                    
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]#post$newpost[postid]";
                }
                
$forceredirect false;
            }
            else
            {
                
$forceredirect true;
                
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
            }

            (
$hook vBulletinHook::fetch_hook('newreply_post_complete')) ? eval($hook) : false;
            eval(
print_standard_redirect('redirect_postthanks'true$forceredirect));
        }

    } 
// end if



As you can see the hook is located towards the bottom and I created a plug-in for that location and simply entered:

$vbulletin->url = 'my own url';

in the php code bit and it works fine.

However I am worried about the other bits of code in the original file above the hook location, so am wondering whether I need to add any of that in my plug-in? Or will what I have done only effect the line I want it to?

Sorry if its obvious!

Paul M 03-13-2006 10:43 PM

The other code is simply building different urls depending on certain conditions - if you always want it to go to your url then you don't need to worry.

Razasharp 03-13-2006 10:53 PM

Thanks Paul.... I'm not so sure now - I thought it just went to the last post regardless? But thinking about it, what happens if someones replying to a thread but in the meantime it gets locked, they hit reply and don't have the permissions so then what? Will it 'break' that bit of code? :-/

merk 03-14-2006 12:07 AM

The code dealing with $vbulletin->url has nothing to do with closed threads.

The logic is as follows:

Is the thread visible (not moderated) or is the user a moderator?

YES! --> Go to that post if its 'after' your last read post in that thread, otherwise go to the newest unread post

NO! --> The thread went into the moderation queue and the user cant see the thread again, so redirect to the forum.

I see no reason modifying your url wont change anything.

Razasharp 03-14-2006 12:37 AM

Quote:

Originally Posted by merk
I see no reason modifying your url wont change anything.


Thanks Merk.. So you give my code change a thumps up ?
Sorry to double check every last detail - I just dont want to break anything :bunny:

merk 03-14-2006 12:57 AM

The only way you'll learn is when you break something. Ive had a few 'oh shit looks like im rolling back to last nights backup' moments :)

Looks fine.

Razasharp 03-14-2006 01:28 AM

lol don't say that you'll give me a heart attack!

Thanks for checking it over :) (Im sure I'll get to the 'oh shit' stage one day too!)


All times are GMT. The time now is 08:49 PM.

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.01308 seconds
  • Memory Usage 1,748KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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