Module Question
Hi Drupalers.
Not sure if Drupal groups is intended to ask drupal related questions, so feel free to put me in my place if I'm breaking the rules.
Just wondering if anyone is aware of a module that would tell a registered user, and/or redirect them, to the last page they accessed the last time they were logged in?
This is for a client using the book module as an online course, so it's intended for those who don't complete the course in one sitting -- so when they come back next time they will know where they left off.
I'm looking to save the time of writing a module for this.
I know I can use the very nice click2bookmark module, but that would require the user manually marking their place.
If the module doesn't exist, I suppose I can use the statistics module in the core and just do a look up when they login, to find the last page they accessed, but this would only be as good until the access table gets cleared. I guess I might just have to write a module that on cron jobs saves every users last page accessed.
If anyone knows of a module that does this, I appreciate your pointing me the right way.
Thanks,
Sam
sam@samcohen.com


RE: Module Question
Sam,
I don't know of a module that does this, but it would not be too hard to write.
I would avoid cron and instead make you own table and just do an insert/update for each user of the last book page they look at.
If they are going to be doing this from home then you might even be able to get away with a cookie and avoid the database overhead completely.
The only real question I have is whether these are registered users or anonymous.
Josh
not sure about a module
Agree with jkopel on this.
Piece of cake to modify the node api (op = view) to insert a record for a specific content type, for registered users.
Anonymous would group all anon into one group, or require an IP, which would not be very reliable.
Unless there was something in the page that would remember who they were. i.e. email address.
Not sure if the cookie solution would work in your situation, but now I'm hungry for some chocolate chip cookies.
peace,
michael
as far as modules go.....
I don't know if you saw the
login destination....i used it for a simple
redirect....but i know you have the ability to modify
it with php...although i am not sure if this would be
flexible enough for you or in the realm at all...i'd
be interested to hear...:)
http://drupal.org/project/login_destination
jamie
update/insert on every view
Thanks for the help.
It's just for registered users and the cookie solution wouldn't work because it needs to be tied to the account not the user's computer.
Unfortunately, I can't "do an insert/update for each user of the last book page they look at," as Josh mentioned, because I won't know it's the last page, so I'll have to do an update/insert on every view of every page.
I originally thought doing an update on each view would be overkill, too cpu expensive, but I suppose the statistics module is doing this anyway, so it's better to turn statistics off and do an insert/update of a new table through node_api on op = view.
Thanks,
Sam
Try LOW_PRIORITY UPDATE?
You may want to try something like MySQL's LOW_PRIORITY Update, see http://dev.mysql.com/doc/refman/5.1/en/update.html
I am not sure if Postgresql has anything like LOW_PRIORITY.
The idea is that you want the information recorded, but whenever the DB can handle it.
SaS
Interesting
Thanks for the tip. Do you know if that command would work using drupal's database abstraction layer or would I need to do a direct MySQl command. -- Sam
(And check out these real time comment previews below! Where'd that come from. Is that a Drupal 6 thing?)