User Edit Their Last Inserted Record

hominid4

Member
Sorry, I've searched and didn't find an answer. I have a list that different registered users submit to, and a user can submit multiple records. Is it possible to link directly to the Fabrik form and it is the logged in user's last submitted record?

The table has a "user_id" user element, and a Yes/No "active" element - among other elements. I run a nightly cron script that changes the active Yes to No for all records that are +30 days old. At that time a user can submit a new record.

All that works fine but I'm needing a way for the user to edit their last submitted active record within that 30 days. I have a "View Record" Fabrik form menu item that links to the form for that list, with "Row id: -1" and "Key name: user_id" under the Fabrik Form Options tab and that works as needed however it brings up the logged in user's first record, I'm needing for it to pull up their last record. I've tried "Row id: -2" and "Key name: user_id" but that of course pulls up the last inserted record but can be a different user.

A workaround I've been doing is I have a "active_user_id" element which is populated with the user's ID, and when the nightly cron script runs if a record is 30+ days old I'll change the active element to No and set the "active_user_id" to "0", and I have the menu item options as "Row id: -1" and "Key name: active_user_id". Was hoping however there was a more straightforward way. I've also used a list menu item where I filter out the non-active records but for other reasons I'm not able to go that route, and would prefer a direct link to the form.

Thanks!
 
Last edited:
Cannot think of any easy way to do it at the moment. Some hacky ideas:

You could override Joomla's mod_menu and generate the menu item there with PHP and mysql query to get the max rowid for a logged in user.

Or generate the menu item in Joomla module with Sourcerer and display the module next to your menu.
 
I'd think you should be able to do this with the help of the PHP form plugin and the onBeforeLoad hook.
 
Thank you both, your suggestions give me some ideas to play around with, and ensures me that I wasn't overlooking a built-in feature. Thanks again!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top