[Release v2.0.3] Give an option to send use to forum after posting and not to thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chen
    Senior Member
    • Jun 2001
    • 8388

    [Release v2.0.3] Give an option to send use to forum after posting and not to thread

    This hack gives the user the option to select whether he wants to be sent to the forum after posting, or to the thread he posted in.
    You can select this option in your profile, and also at the bottom of the new post screen.

    In newreply.php replace
    PHP Code:
    // redirect
          
    if ($prevpost[visible]) { 
    with
    PHP Code:
    // redirect
          
    if ($prevpost[visible] && !$sendtoforum) { 
    and also in the same file replace
    PHP Code:
    // redirect
          
    if ($visible) { 
    with
    PHP Code:
    // redirect
          
    if ($visible && !$sendtoforum) { 
    and still 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";
        } 
    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 also in the same file replace
    PHP Code:
        if ($bbuserinfo[emailnotification]) {
          
    $emailchecked="checked";
        } 
    with
    PHP Code:
        if ($bbuserinfo[emailnotification]) {
          
    $emailchecked="checked";
        }
        if (
    $bbuserinfo[sendtoforumdef]!=0) {
          
    $sendtoforumchecked="checked";
        } 
    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" $sendtoforumchecked> <b>Go back to forum:</b> after posting would you like to return to the forum.
    right after this code
    Code:
    <br><input type="checkbox" name="signature" value="yes" $signaturechecked> <b>Show Signature:</b> include your profile signature.  Only registered users may have signatures.
    In the modifyoptions template add this code
    Code:
    <tr>
    	<td bgcolor="{secon[i][/i]daltcolor}"><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="{secon[i][/i]daltcolor}"><normalfont>
    		<input type="radio" name="sendtoforumdef" value="yes" $sendtoforumdefchecked> yes
    		<input type="radio" name="sendtoforumdef" value="no" $sendtoforumdefnotchecked> no
    	</normalfont></td>
    </tr>
    right after this code
    Code:
    <tr>
    	<td bgcolor="{secon[i][/i]daltcolor}"><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="{secon[i][/i]daltcolor}"><normalfont>
    		<input type="radio" name="emailnotification" value="yes" $emailnotificationchecked> yes
    		<input type="radio" name="emailnotification" value="no" $emailnotificationnotchecked> no
    	</normalfont></td>
    </tr>
    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";
      } 
    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
    (For more info about running SQL queries go here or here)
    Last edited by Chen; Sun 9 Sep '01, 7:50am.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב
  • Cyrus
    Senior Member
    • Apr 2001
    • 413

    #2
    hmm, want this but its a long hack. Is it possible you can make a zip of this please. Itll be appreciated.

    Thank you

    Comment

    • Chen
      Senior Member
      • Jun 2001
      • 8388

      #3
      Umm... there's nothing to zip here.
      Do you want me to attach the instructions as a text file?
      Chen Avinadav
      Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

      Comment

      • BBInsider
        Member
        • Jul 2001
        • 70

        #4
        I cant find that anywhere. In newreply.php replace ?? Where is it and how do I get to it? Also is this been tested? thanks!!

        Comment

        • Chen
          Senior Member
          • Jun 2001
          • 8388

          #5
          This was tested succesfully on v2.0.3.

          I see your question was answered in another thread, so I won't bother.
          Chen Avinadav
          Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

          Comment

          • Christine
            Senior Member
            • Aug 2001
            • 592
            • 3.0.6

            #6
            Hi Firefly - excellent job!

            I loaded this up and am not having any trouble with new topics or polls or the UserCP but the newreply isn't working. I have the box on the screen so I know it isn't in the template but when I check it, the system ignores it. No error message, it just returns to thread.

            What am I missing here?
            L'chaim

            Comment

            • Chen
              Senior Member
              • Jun 2001
              • 8388

              #7
              Thanks Christine.

              Sounds to me as if you didn't make the necessary changes to newreply.php.
              Double check that, and get back to me.
              Chen Avinadav
              Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

              Comment

              • Christine
                Senior Member
                • Aug 2001
                • 592
                • 3.0.6

                #8
                Wow - that was quick.

                That was my concern - newreply.php was the only one I was thinking would affect it from the changes I saw. Blah. I tried a few times last night and didn't see any mistakes. I shall try again now and let you know!
                L'chaim

                Comment

                • Christine
                  Senior Member
                  • Aug 2001
                  • 592
                  • 3.0.6

                  #9
                  Hmmmm - still not working.

                  Here is what I added to newreply.php - I am including the code above and below as well.
                  PHP Code:
                           // redirect
                      
                  if ($prevpost[visible] && !$sendtoforum) {
                          
                  $goto="showthread.php?s=$session[sessionhash]&postid=$postid#post$postid";
                        } else {
                          
                  $goto="forumdisplay.php?s=$session[sessionhash]&forumid=$forumid";
                        }
                        eval(
                  "standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");

                      } else {
                        if (
                  $attachmentid and !$foruminfo[moderateattach]) {
                          
                  $DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
                        } 
                  PHP Code:
                  if ($bbuserinfo[userid]!=and !$previewpost) {
                      if (
                  $bbuserinfo[signature]!="") {
                        
                  $signaturechecked="CHECKED";
                      }
                  if (
                  $bbuserinfo[emailnotification]) {
                        
                  $emailchecked="checked";
                      }
                      if (
                  $bbuserinfo[sendtoforumdef]!=0) {
                        
                  $sendtoforumchecked="checked";
                      }
                    }

                    if (
                  $foruminfo[allowicons]) {
                      
                  $posticons=chooseicons($iconid);
                    }  else {
                      
                  $posticons="";
                    } 
                  I am going blind over here. What am I missing?
                  L'chaim

                  Comment

                  • Chen
                    Senior Member
                    • Jun 2001
                    • 8388

                    #10
                    Weird, everything's in place.

                    Umm, check in your newreply template that the name of the checkbox is sendtoforum. That's really the only thing I can think of...
                    Chen Avinadav
                    Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

                    Comment

                    • Christine
                      Senior Member
                      • Aug 2001
                      • 592
                      • 3.0.6

                      #11
                      Hmmm - from New reply template...
                      PHP Code:
                      <br><input type="checkbox" name="signature" value="yes" $signaturechecked> <b>Show Signature:</b> include your profile signature.  Only registered users may have signatures.
                                       <
                      br><input type="checkbox" name="sendtoforum" value="yes" $sendtoforumchecked> <b>Go back to forum:</bafter posting would you like to return to the forum.
                          </
                      smallfont></ 
                      L'chaim

                      Comment

                      • Chen
                        Senior Member
                        • Jun 2001
                        • 8388

                        #12
                        Bug.

                        Fix:
                        In newreply.php replace this
                        PHP Code:
                              // redirect
                              
                        if ($visible) { 
                        with
                        PHP Code:
                              // redirect
                              
                        if ($visible && !$sendtoforum) { 
                        Thanks for finding that Christine.

                        Updated main post
                        Last edited by Chen; Sun 9 Sep '01, 7:50am.
                        Chen Avinadav
                        Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

                        Comment

                        • Christine
                          Senior Member
                          • Aug 2001
                          • 592
                          • 3.0.6

                          #13
                          We have a winner!!!!

                          This is working with no errors.

                          Great job, Firefly!

                          (I am on 2.0.3 BTW)
                          Last edited by Christine; Sun 9 Sep '01, 8:09am.
                          L'chaim

                          Comment

                          • Chen
                            Senior Member
                            • Jun 2001
                            • 8388

                            #14
                            Who's da winner????

                            Thanks.
                            Chen Avinadav
                            Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

                            Comment

                            • LuBi
                              Senior Member
                              • Jun 2001
                              • 245
                              • 3.7.x

                              #15
                              Used the auto install and I keep getting this erroer

                              Warning: Supplied argument is not a valid File-Handle resource in /www/htdocs/forums/admin/avatar_hack_install.php on line 349
                              http://www.tchracing.com/forums/live...h_live_sig.jpg

                              Comment

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