What approach should I take to create a list of previously viewed entries? Including the ability display the list, remove an entry from the list or delete the whole list.

The previously viewed entries list would only exist for the duration of a visit.


Craft doesn't have anything like an onViewEntry event, which you could listen for.

One way to do it would be to have a plugin that listens for onEndRequest. That plugin would determine if the current URI matches an entry and if so saves it to the database along with the userId.

Then you could build a management page off of that info where you could remove from the history or delete it all-together.

| improve this answer | |
  • just as a side note: an onViewEntry with access to the $context e.t.c would be super awesome for a future version :) This would help a lot with moving some of the logic currently done in templates to a controller – Sidney Widmer Feb 18 '15 at 10:15

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.