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

What's the bigger sin?

Discussion in 'XenForo Development Discussions' started by Marcus, Aug 20, 2013.

  1. Marcus

    Marcus Well-Known Member

    This is worrying me. Completely overwriting a 50 line ControllerPublic action function or fetching a value from $_GET in the model?

    I can do either way :)
  2. Chris D

    Chris D XenForo Developer Staff Member

    Neither are ideal.

    What specifically do you need to do. There's surely a better way.
  3. Marcus

    Marcus Well-Known Member

    I added a &parameter=x to threads in thread_list. I have to access them on thread_view. It's possible with threads links, but not with threads/unread as this function redirects before I can hook in.
  4. Marcus

    Marcus Well-Known Member

    To solve this problem I could set a cookie value to be MVC compliant but I guess it's even a bigger sin :D
  5. Chris D

    Chris D XenForo Developer Staff Member

    What about using the simple cache or data registry?
  6. Marcus

    Marcus Well-Known Member

    I would have to set ("current_node_id") each time a user visits a node. Do you think it's okay to do that or it's kind of overkill? Or is using a &node_id parameter in the URL which works great now not more common?

    I would have to access the simple cache or data registry also in the model. Is that okay?

    I am completely open for ideas.

    Isn't there already a registry where users are at the moment "Marcus A is visiting the Announcement forum"? I could fetch the node_id value from there. Is that data stored as if the user continues going to different thread pages the former node_id data has to be accessible, too.
  7. JulianD

    JulianD Well-Known Member

    You could try and extend XenForo_ControllerPublic_Thread. Capture the response from actionUnread() and add an additional parameter like (see the array('page') part):

                            return $this->responseRedirect(
                                    XenForo_Link::buildPublicLink('threads', $thread, array('page' => $page)) . $hashTag
    I haven't tested this yet. I just looked through the code and I thought this could be accomplished.

Share This Page