4

I don't know if this is possible but, I would like to allow my users to be able to filter out what content they would like to show up in a view so that every time they return to that view, their preferences are saved.

I no how to allow my users to filter content in a view but I'm having trouble saving it. I'm trying to allow my users to control their own news feeds.

I've tried looking around for a module to do this and I've been playing around with views for a while but I can't seem to hack something thing that does what I outlined. Any help would be appreciated. Thanks.

1

If your view is using exposed filters, there is a "Remember search" option in the View configuration. This stores the search parameters in the session, and should give you the expected effect. Admittedly, I'm thinking of Views 2, and I just assume the setting is available in Views 3 as well.

2
  • If this stores it in the session, what if the user logs out? Will this require them to rest their settings?
    – Mike
    Jan 3 '12 at 23:19
  • In my case that is not an issue, so I had never even noticed, but I just tried, and the answer is yes. Logging out removed the Views settings.
    – Letharion
    Jan 4 '12 at 6:32
1

Since my initial answer doesn't persist the search between user-login/logout, here's a solution that will require significantly more work, but is permanent.

Create a module, with a two column table. One for uid, and one for serialized search parameters.

Implement hook_views_query_alter().

In this hook, you can add the SQL needed to both fetch old data, and update with new. You should be aware however that such a solution can quickly become a heavy DB-burden, as you potentially add a lot of writing to the DB.

1
  • This is a little to complicated for me to do
    – Mike
    Jan 4 '12 at 16:47
0

The Views Saved Searches module will save the filters used even if they log out. Here is a quote about it (from the module's project page):

... allows you to save your current configuration of exposed filters for later use. This can be especially useful for Views with a lot of exposed filters.

Whenever a View is changed, all saved searches for that View are deleted, to prevent corruption. If the user has JavaScript enabled, the saving and deleting process happens through AHAH, and the new section is displayed below the exposed filters section. When JavaScript is disabled, the new section is displayed above the exposed filters section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.