1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Swipe to next thread

Discussion in 'Closed Suggestions' started by Alfa1, Nov 20, 2014.

  1. Alfa1

    Alfa1 Well-Known Member

    On most news websites that I visit its possible to swipe to the next article. It has become pretty common functionality. It would be handy if it were possible on xenforo as well.

    Instead of having to go back to new post and then going to the next thread to go straight to the next thread by swiping.
     
    RobinHood likes this.
  2. Daniel Hood

    Daniel Hood Well-Known Member

    I believe next and previous functionality has been suggested before due to not knowing how you would determine the next thread. Would it be the most recently posted in, the most recently created after that one (thread id +1), most recent posted in the same node, etc
     
  3. Alfa1

    Alfa1 Well-Known Member

    Thats where admin settings come in. Just leave that part up to the admin to decide.
    I would not have to think twice about how to set it, but I am sure different admins will have different preferences on this.
     
    Daniel Hood likes this.
  4. Daniel Hood

    Daniel Hood Well-Known Member

    I hear you. Was just letting you know what I recall reading in the past.
     
  5. Amaury

    Amaury Well-Known Member

    Start date would probably make the most sense.

    I forget. How does vBulletin do it?
     
  6. batpool52!

    batpool52! Well-Known Member

    I manged to make something that worked.

    Under XenForo_Model_Thread i added this
    PHP:
    public function getPrevNexLink($threadId$nodeId$previous, array $fetchOptions = array())
        {
            
    /* https://xenforo.com/community/threads/swipe-to-next-thread.87581/ */
            
    $joinOptions $this->prepareThreadFetchOptions($fetchOptions);

            if (
    $previous == false)
            {
                return 
    $this->_getDb()->fetchRow('
                SELECT thread.*
                    ' 
    $joinOptions['selectFields'] . '
                FROM xf_thread AS thread
                ' 
    $joinOptions['joinTables'] . '
                WHERE thread.thread_id = (SELECT MIN(thread.thread_id) FROM xf_thread AS thread WHERE thread.thread_id > ' 
    $threadId ' AND thread.node_id = ' $nodeId')
                AND thread.node_id = ' 
    $nodeId);
            }
            else
            {
                return 
    $this->_getDb()->fetchRow('
                SELECT thread.*
                    ' 
    $joinOptions['selectFields'] . '
                FROM xf_thread AS thread
                ' 
    $joinOptions['joinTables'] . '
                WHERE thread.thread_id = (SELECT MAX(thread.thread_id) FROM xf_thread AS thread WHERE thread.thread_id < ' 
    $threadId ' AND thread.node_id = ' $nodeId .')
                AND thread.node_id = ' 
    $nodeId);
            }
        }


    Under XenForo_ControllerPublic_Thread, inside actionIndex function and under $viewParams i added this code
    PHP:
    'previousLink' => XenForo_Link::buildPublicLink('threads'$threadModel->getPrevNexLink($thread['thread_id'], $thread['node_id'], true)),
                
    'nextLink' => XenForo_Link::buildPublicLink('threads'$threadModel->getPrevNexLink($thread['thread_id'], $thread['node_id'], false)),
    and it works fine if used under templates :)
     
    caliman likes this.
  7. RobinHood

    RobinHood Well-Known Member

    This would be really nice for the new posts link. I feel the default should be the next thread in the same new posts id list as that's how it currently works when you back out of a thread to the new posts page to move onto the next one.

    If your in a thread having navigated to it by node, then the next thread would be the next one in the list however you had the node list ordered before you opened the thread.
     
  8. Sheratan

    Sheratan Well-Known Member

    In IE and Chrome, swipe means back (or forward). I don't know about Firefox.

    This is a great suggestion, but I'm afraid it will become problem.
     
  9. rainmotorsports

    rainmotorsports Well-Known Member

    On what platform? I'm swiping left to right across this whole thread and its doing nothing. A long time ago in chrome that would happen. Especially the tab change gestures. I get nothing on Chrome v39 and Android 5.

    IE on a tablet I'm assuming would be your use case?
     
  10. Sheratan

    Sheratan Well-Known Member

    Yeah. IE on Windows phone and tablet. And also chrome on Windows tablet.
     

Share This Page