Jump to content

Persist forum view setting for logged in members


Recommended Posts

Members would like the choice to select from one of the available forum views (grid, traditional forum view, simplified listing with filters) and have that value persist across sessions on their member account. After submitting a support request, we were informed that this setting is stored in a cookie. Members clearing cookies, using multiple devices, or browing incognito are not having this value saved.

This should be a user account setting, restored upon login regardless of whether or not cookies are stored.

Link to comment
Share on other sites

I'm not sure support got this right. Looking at 4.5 source, I see that there are explicit attempts to store this value in the database and retrieve it. I think this functionality is not working properly in some instances and there is a possible bug.

getMemberListView() makes an attempt to read this from the database, and setMethod() makes an attempt to store this in the database.

Values are stored in the forums_view_method table. Going out on a limb here, I think the bug is the following:

  1. Member sets value while logged in
  2. Member clears cookies due to incognito browsing
  3. Member returns to site in incognito browsing, cookie is set with default value that does not match member's preference
  4. Member logs in and code in getMemberListView() sees that a cookie is set (the default that was set before logging in)
  5. Member's preference is ignored.

I think the fix is moving line 1935 in applications/forums/sources/Forum/Forum.php where $method is set needs to happen within the catch at 1949 after the value is retrieved from the database. If not found there, use the default forums view.

Right now, if I'm understanding the flow correctly, the logic is "if a cookie is set, use that" instead of looking at the stored user preference first.

Edited by Paul E.
Technical details.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...