The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Hook for modifying output of field in dashboard?
I've got some important data we're collecting/storing via Formidable and using 'frm_add_entry_meta', the data is encrypted before being stored into the database. Next step is handling decryption, so that admins are able to view that data in the dashboard. Specifically when they click into an entry and can see all of the fields.
So what I need is a hook to modify the field's data before it's displayed anywhere in the dashboard. Does something like this exist? Because I've been googling for the better part of an hour and I so tired of typing "formidable hook" it's not even funny 😉
May 13, 2017 at 1:02 am
Hi Jeremy,
You've probably already solved this by now but you might want to consider creating a View for Admins instead.. If you use a View, you can use a hook like:
https://formidableforms.com/knowledgebase/frm_display_entry_content/
This would probably allow you to decrypt the content before display. So instead of going through the WP Dashboard - Formidable Entries, create a Formidable View that pulls the content & restrict access to the Page containing the View, to Administrators only... for that you might need the WP User Manager By Alessandro Tesoro or the Hide This plugin or something similar.
Hope that helps.
Kristy
May 14, 2017 at 1:22 pm
Kristy's suggestion looks to me like it would work - or the way that I would likely approach it is to use frm_setup_edit_fields_vars with a check for whether it's being accessed in the backend. Something like this:
(**fully untested** - this was modified from https://formidableforms.com/knowledgebase/frm_setup_edit_fields_vars/#kb-set-fields-to-read-only-when-editing )
add_filter('frm_setup_edit_fields_vars', 'frm_unencrypt_for_admin', 20, 3);
function frm_unencrypt_for_admin($values, $field, $entry_id){
if ( in_array( $field->id, array( 1558,554,555,556 ) ) ) { // put in your field ids that need to be de-encrypted
// If on the back-end, unencrypt
if ( FrmAppHelper::is_admin() ) {
// PUT DE-ENCRYPTION CODE HERE
}
}
return $values;
}
Discussion closed.