vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [code release] Redirect to forum instead of thread after post (https://vborg.vbsupport.ru/showthread.php?t=26501)

Gutspiller 08-25-2001 10:00 PM

After you post a message it takes you back to the message you just posted. How would I make it so that instead of doing that, take the users back to forum main forum that they posted in?

Any help is appreciated.

Thanks!

Admin 08-26-2001 05:33 PM

.

samtha25 08-27-2001 07:31 PM

Just what I was looking for!

Thanks, Firefly. You're a wonder. :)

Admin 08-27-2001 07:34 PM

Thank you! :)

If you want, I can add this as an option, under the "Show Signature" and its friends, something like "Send to forum".
Are you interested?

samtha25 08-27-2001 07:37 PM

If you mean a user-selectable option in their options, that would be terrific. I was just thinking it would be nice to make it user-selectable.

Admin 08-27-2001 07:58 PM

Alrighty. :)

Undo all changes (from my first post).
In newreply.php replace
PHP Code:

      // redirect
      
if ($prevpost[visible]) { 

with
PHP Code:

      // redirect
      
if ($prevpost[visible] && !$sendtoforum) { 

In newthread.php replace
PHP Code:

      } elseif ($visible) {
        
$goto="showthread.php?s=$session[sessionhash]&threadid=$threadid"

with
PHP Code:

      } elseif ($visible && !$sendtoforum) {
        
$goto="showthread.php?s=$session[sessionhash]&threadid=$threadid"

And in poll.php replace
PHP Code:

    // redirect
    
if ($threadinfo[visible]) { 

with
PHP Code:

    // redirect
    
if ($threadinfo[visible] && !$sendtoforum) { 

Now, in your newreply and newthread templates, add this code
Code:

        <br><input type="checkbox" name="sendtoforum" value="yes"> <b>Go back to forum:</b> after posting would you like to return to the forum.
right after
Code:

        <br><input type="checkbox" name="signature" value="yes" $signaturechecked> <b>Show Signature:</b> include your profile signature.  Only registered users may have signatures.
You can change the text, but don't touch the tags please. :)
That's about it - don't forget the last edit needs to be done on both newreply and newthread templates!

I tested this on my forums, so you shouldn't have any problems. :)

EDIT:
A little tip - if you want the checkbox to be selected by default, add checked right after value="yes" in the code you added to your templates.

EDIT 2:
This could be expanded even more - having an option for the user in their profile options, and making that option decide wheter the box is checked by default, or not.
If you are interested in this, please let me know and I'll work on it tomorrow. :)

Gutspiller 08-27-2001 08:06 PM

Is there a way to make it so the user has control over what the default is?

Some of my users want it one way, and others want it the other way. I don't want to set it to default because then they will have to uncheck it if they don't want it. (I know that's better than not having the checkbox at all) but if it's possible it would be nice to give the users a place in their profile. Is this possible or does this then start to become a hack? :(

Admin 08-27-2001 08:12 PM

[QUOTE]Originally posted by FireFly
EDIT 2:
This could be expanded even more - having an option for the user in their profile options, and making that option decide wheter the box is checked by default, or not.
If you are interested in this, please let me know and I'll work on it tomorrow. :)

samtha25 08-27-2001 11:09 PM

Very nice work, Firefly! You've got two approachs there that forum admins might decide to use.

It would be great to have this in the user profile, but there is something to be said for having it selected from newreply, as in some cases someone might be replying to different posts in a thread as they go and want to return to the thread, while in other cases they might be making only one reply or making their last reply and want to return to the forum.

I can't say I see where someone starting a newthread would want to return to their new post, unless to check it. With Preview, though, it doesn't seem necessary.

So, maybe what would work best is to let the user set a default behavior but then be able to also change it from the posting pages. Heh, not too much to ask, right?

I've seen UBB hacks that let the poster select where to go from the redirect message, but usually it flies by too fast for people to make the selection or pauses in which case it usually becomes annoying to be forced to click.

Admin 08-28-2001 05:55 AM

The user now has full control over this.

1. In the newreply and newthread replace
Code:

<br><input type="checkbox" name="sendtoforum" value="yes"> <b>Go back to forum:</b> after posting would you like to return to the forum.
with
Code:

<br><input type="checkbox" name="sendtoforum" value="yes" $sendtoforumchecked> <b>Go back to forum:</b> after posting would you like to return to the forum.
in both templates!

2. In the modifyoptions add this code
Code:

<tr>
        <td bgcolor="#DFDFDF"><normalfont><b>Use 'Send to forum' by default?</b></normalfont><br>
        <smallfont>Using this option will send you back to the forum after posting a new message.</smallfont></td>
        <td bgcolor="#DFDFDF"><normalfont>
                <input type="radio" name="sendtoforumdef" value="yes" $sendtoforumdefchecked> yes
                <input type="radio" name="sendtoforumdef" value="no" $sendtoforumdefnotchecked> no
        </normalfont></td>
</tr>

right after
Code:

<tr>
        <td bgcolor="#DFDFDF"><normalfont><b>Use 'Email Notification' by default?</b></normalfont><br>
        <smallfont>Using this option emails you whenever someone replies to a thread that you have participated in.</smallfont></td>
        <td bgcolor="#DFDFDF"><normalfont>
                <input type="radio" name="emailnotification" value="yes" $emailnotificationchecked> yes
                <input type="radio" name="emailnotification" value="no" $emailnotificationnotchecked> no
        </normalfont></td>
</tr>

3. In newreply.php replace
PHP Code:

    if ($bbuserinfo[emailnotification]!=0) {
      
$emailchecked="checked";
    } 

with
PHP Code:

    if ($bbuserinfo[emailnotification]) {
      
$emailchecked="checked";
    }
    if (
$bbuserinfo[sendtoforumdef]!=0) {
      
$sendtoforumchecked="checked";
    } 

4. In newthread.php replace
PHP Code:

    if ($bbuserinfo[emailnotification]) {
      
$emailchecked="checked";
    } 

with
PHP Code:

    if ($bbuserinfo[emailnotification]) {
      
$emailchecked="checked";
    }
    if (
$bbuserinfo[sendtoforumdef]!=0) {
      
$sendtoforumchecked="checked";
    } 

5. In member.php replace
PHP Code:

  $emailnotification=iif($emailnotification=="yes",1,0); 

with
PHP Code:

  $emailnotification=iif($emailnotification=="yes",1,0);
  
$sendtoforumdef=iif($sendtoforumdef=="yes",1,0); 

Also replace
PHP Code:

  $DB_site->query("UPDATE user
                   SET "
.$updatestyles."adminemail='$adminemail',
                      showemail='
$showemail',invisible='$invisible',cookieuser='$cookieuser',
                      maxposts='"
.addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
                      timezoneoffset='"
.addslashes($timezoneoffset)."',emailnotification='$emailnotification',
                      startofweek='"
.addslashes($startofweek)."',options='$options',receivepm='$receivepm',
                      emailonpm='
$emailonpm',pmpopup='$pmpopup',usergroupid='$bbuserinfo[usergroupid]',
                      nosessionhash='
$nosessionhash'
                   WHERE userid='
$bbuserinfo[userid]'"); 

with
PHP Code:

  $DB_site->query("UPDATE user
                   SET "
.$updatestyles."adminemail='$adminemail',
                      showemail='
$showemail',invisible='$invisible',cookieuser='$cookieuser',
                      maxposts='"
.addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
                      timezoneoffset='"
.addslashes($timezoneoffset)."',emailnotification='$emailnotification',sendtoforumdef='$sendtoforumdef',
                      startofweek='"
.addslashes($startofweek)."',options='$options',receivepm='$receivepm',
                      emailonpm='
$emailonpm',pmpopup='$pmpopup',usergroupid='$bbuserinfo[usergroupid]',
                      nosessionhash='
$nosessionhash'
                   WHERE userid='
$bbuserinfo[userid]'"); 

and add
PHP Code:

  if ($bbuserinfo[sendtoforumdef]) {
    
$sendtoforumdefchecked="checked";
    
$sendtoforumdefnotchecked="";
  } else {
    
$sendtoforumdefchecked="";
    
$sendtoforumdefnotchecked="checked";
  } 

right after
PHP Code:

  if ($bbuserinfo[emailnotification]) {
    
$emailnotificationchecked="checked";
    
$emailnotificationnotchecked="";
  } else {
    
$emailnotificationchecked="";
    
$emailnotificationnotchecked="checked";
  } 

6. And last but by no means least, run this SQL query:
Code:

ALTER TABLE user ADD sendtoforumdef SMALLINT(6) DEFAULT '0' not null AFTER emailnotification
This is it. I skipped adding this info to the register because it really doesn't matter, there are some option that are not available there as well, so it's not the end of the world.

Hope this is what you want. :)


All times are GMT. The time now is 02:43 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.01295 seconds
  • Memory Usage 1,801KB
  • 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
  • (7)bbcode_code_printable
  • (16)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete