Is what my posters are asking for even possible? (Return)

Started by gbsothere, March 01, 2009, 10:43:51 AM

Previous topic - Next topic

Xavi-Nena

ok wait a min so what is the exact code to get this working? Sorry I know you attached the post template but i have modifications on mine and dont want to lose those by replacing it with this? thanks in advance.

gbsothere

#41
Forgive me for bumping my old thread, but I keep trying to remember to ask this and then get side-tracked.

(And NenaGb, I didn't realize you had asked about the code.  I'm attaching it here, before I proceed with my question.)

Sources/Post.php

Find:
// Notify any members who have notification turned on for this topic.
if ($newTopic)
notifyMembersBoard();
elseif (empty($_REQUEST['msg']))
sendNotifications($topic, 'reply');


Add after:

        // Custom redirection
        // WE got a quote?
        if (isset($_REQUEST['topic']) && isset($_REQUEST['quote']))
            redirectexit('topic=' . $_REQUEST['topic'] . '.msg' . $_REQUEST['quote'] . '#msg' . $_REQUEST['quote']);
        // No quote? :(
        elseif (isset($_REQUEST['topic']))
            redirectexit('topic=' . $_REQUEST['topic'] . '.' . $_REQUEST['start']);






This code was provided by Dragooon and I can't thank him enough, my posters love it  This is what it does:

If a poster is reading a very long thread, with pages of "catch up" to go and wants to make a reply here and there but continue to read on, then, rather than be sent to the end of the thread along with his reply, the reply goes there (of course) but the poster is redirected back to the page he was reading when he made the reply so that he can continue to catch up.  We love this on my forum! 

Now....   I just have a request to tweak it a bit.  We do get sent back to the actual page we were on when we posted and, if that's as close as we can cut it, then no complaints; we're quite happy with that.  But I was wondering if there is a way to be returned to the actual post where "reply" or "quote" was clicked?  In other words, be sent back to where you stopped to reply, so that you can continue on, rather than having to scroll that page trying to find your place?

This does remind me; we do have the "Reply Button In Every Post" mod installed, although I can't remember if we did when Dragooon helped me with this.  The link for that mod is HERE.  All it does is add these two codes to Display.template.php:

Find:

// Can they reply? Have they turned on quick reply?

Add before:

      // Simple Reply Button
      if ($context['can_reply'] && !empty($options['display_quick_reply']))
      echo '<a href="#quickreply">', $respond_button, '</a>';
      else
      echo '<a href="', $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'], '">', $respond_button, '</a>';
               
               


Find:

$reply_button = create_button('quote.gif', 145, 'smf240', 'align="middle"');

Add before:

   $respond_button = create_button('reply.gif', 146, 146, 'align="middle"');




I only mention this because I wonder if it would have to be incorporated, somehow, in the ability to be returned to a specific post, or if it really has nothing to do with it and only the Post.php is in play, here.



All that to ask this:

Could someone weigh in on whether or not the code Dragooon provided can be tweaked to allow one to be returned to the actual post he replied to, rather than just the general page?



Again, Dragooon, thank you for this.  We absolutely love it.   :)



ETA:  *removing "solved" check just long enough to determine the answer*
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

*hopeful weekend bump in case any coders are out there*
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

One more bump, not quite as hopeful, and then I'll let it go.   :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

The only way I can get it to work is not to use quick reply when the reply button is clicked.

In Display.template.php change the reply button to this:


      // Simple Reply Button
      if ($context['can_reply'])
     echo '<a href="', $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'], ';m=', $message['id'], '">', $respond_button, '</a>';


In Post.php change the Custom reirection code to this:


       // Custom redirection
        // WE got a quote?
        if (isset($_REQUEST['topic']) && isset($_REQUEST['quote']))
            redirectexit('topic=' . $_REQUEST['topic'] . '.msg' . $_REQUEST['quote'] . '#msg' . $_REQUEST['quote']);
        // Just replying
        elseif (isset($_REQUEST['m']))
          redirectexit('topic=' . $_REQUEST['topic'] . '.msg' . $_REQUEST['m'] . '#msg' . $_REQUEST['m']);
        // No quote? :(
        elseif (isset($_REQUEST['topic']))
          redirectexit('topic=' . $_REQUEST['topic'] . '.' . $_REQUEST['start']);


Now in Post.template.php. Default theme unless there's one in the theme you are using.

Find:

// Assuming this isn't a new topic pass across the number of replies when the topic was created.


and above it add:

if (isset($_REQUEST['m']))
echo '
<input type="hidden" name="m" value="', $_REQUEST['m'], '" />';

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

#45
Hi, Kays, and thanks! 

I'm going to go try this on my test site, but I wanted to ask, first:

Does this coding either take into account or work around the Reply Button In Every Post mod that we have installed?   (LINK TO MOD)

The forum is SMF 1.1.10/Default. 




EDIT:   Sorry, I should have studied your code a little closer; of course it does.    :)  I was distracted by a PM from a poster with a whole new set of problems and missed that the mod is accommodated. 

Trying it now on my test site. 
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

The reply button remains, it just doesn't take the user to quick reply. I couldn't see a way to carry the message id into quick reply.

A little bonus, this will add a link to the topic being replied to. It's not language freindly so translare it if you need to.

In Post.templte.php look for:


// Finally the most important bit - the actual text box to write in!


And above it add:


if(isset($_REQUEST['m']))
$message = 'Reply to message # [url=?topic=' . $_REQUEST['topic'] . '.msg' . $_REQUEST['m'] . '#msg' . $_REQUEST['m'] . ']' . $_REQUEST['m'] . '[/url][hr]' . "\n";

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

#47
Kays, beautiful!   It does exactly what I want it to.   

Much thanks to Dragooon for getting me to the right page and to you for getting me precisely where I need to land on it.   :)

Brilliant, and I'm, once again, marking this topic solved.   





EDIT:   The added link is very nice.  Amazing work, thanks again, so much.
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

I'm glad it works the way you want it to.

QuoteThe added link is very nice.  Amazing work, thanks again, so much.

I thought that it was a bit silly replying without a quote since there is no referance to what the user is posting about or replying to

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

Especially on a very large thread, that just makes perfect sense.   :)

My posters are loving you right now.  *grin*


Thanks, again!
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

#50
Kays, if you don't mind my asking....

is this only meant to work with a simple reply but not when quoting? 


I'm not being returned to my place on the thread when quoting, only when replying, so I thought I'd ask?  (I'm sorry for waiting until now to ask, but I hadn't thought to try quoting until now.)




EDIT:  It all comes back to my posters' desire to keep reading the long thread and, if they quote, it appears that they may end up at the end of the thread, instead of where they were.
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

I don't know what happened there since I didn't touch that. But I agree, it's not working now and it used to.

I'll look into it.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

Quote from: Kays on August 02, 2009, 08:49:36 PM
I don't know what happened there since I didn't touch that. But I agree, it's not working now and it used to.

I'll look into it.



Thank you for checking into it and I really do appreciate your help.   :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

I can't even get it to work if I reverted back to what you first posted. Plus the thing is, I can't see why it worked place. Unless Dragoon made some changes elsewhere.

Can you attach your Display.template.php and Post.php to a post so I can have a look at them.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

Yes, Kays; would you like the files as they were before we made the edits this evening?
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

#56
Here they are, Kays and, also, I was just scrolling back over this thread from the beginning and, unless I'm reading this wrong, I may have found an extra bit of code on this link.  (It's been a long time since we first did this, but glancing at this post suggests that there were two edits on Post.php, not just the one)  Reply #33:

http://www.simplemachines.org/community/index.php?topic=296378.20





EDIT:  (I'm always editing.)   *grin*    No, I read that wrong.   I thought it was something but it was nothing. 
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

One thought though in looking at it. If you're not hungup on using the quick reply for quotes.

If the quotes also used the regular post screen like for replies then it should be possible to redirect the poster back to the post he was quoting. Since the post id is available there.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

gbsothere

Honestly, Kays, I don't think any of my posters have ever used the quick reply.  I think the default on the forum is to not show it.
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Kays

Well if that's the case, we should be able to redirect your users back to the post they were quoting also. :D

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: