Announcement

Collapse
No announcement yet.

[code release] Redirect to forum instead of thread after post

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [code release] Redirect to forum instead of thread after post

    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!

  • #2
    .
    Last edited by Chen; Tue 28 Aug '01, 9:52am.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Just what I was looking for!

      Thanks, Firefly. You're a wonder.

      Comment


      • #4
        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?
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment


        • #5
          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.

          Comment


          • #6
            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.
            Last edited by Chen; Mon 27 Aug '01, 1:04pm.
            Chen Avinadav
            Better to remain silent and be thought a fool than to speak out and remove all doubt.

            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

            Comment


            • #7
              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?

              Comment


              • #8
                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.
                So like I said, I will work on it tomorrow morning.
                (And yes, this is starting to look like a mini-hack )
                Chen Avinadav
                Better to remain silent and be thought a fool than to speak out and remove all doubt.

                גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                Comment


                • #9
                  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.

                  Comment


                  • #10
                    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.
                    Last edited by Chen; Tue 28 Aug '01, 10:15am.
                    Chen Avinadav
                    Better to remain silent and be thought a fool than to speak out and remove all doubt.

                    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                    Comment


                    • #11
                      [moved to hack releases forum]

                      Comment


                      • #12
                        Would it be possible to get this into a nice clean release version...zip file, etc,.?
                        Rob

                        Comment


                        • #13
                          how exactly do I run the SQL query?

                          I don't know how to do that.

                          Comment


                          • #14
                            Originally posted by RobAC
                            Would it be possible to get this into a nice clean release version...zip file, etc,.?
                            I will do it later today.

                            Gutspiller - take a look here or here.
                            Chen Avinadav
                            Better to remain silent and be thought a fool than to speak out and remove all doubt.

                            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                            Comment


                            • #15
                              Im sorry but that very first line in the hack you tell me to find in newthread and newreply cannot be found. Uh, are you sure?

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X