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!
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: