Up to 50 percent off

Lock form fields during post edit

This topic contains 3 reply and 2 voices, and was last updated by Mahi 10 years, 8 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
March 1, 2014 at 12:30 am 15957
Mahi Hi, Is it possible to lock specific form fields during post editing (via a frontend form)? If so, how? So, when the edit button is clicked and the user is taken to the WP Frontend form, certain form fields can't be changed. Thanks!
March 1, 2014 at 1:41 am 15958
ProUser ProUser

I’m thinking I can edit the appropriate plugin file (whichever one is building the form to be edited). I can use an if statement to determine if the logged in user is the post author and, if not, make certain fields readonly.

But which file and where in that file should I place the code?

March 1, 2014 at 3:49 am 15964
ProUser ProUser

Great! I think this may help me with a hack I’m needing. But where does the code posted by Tareq go, exactly…. from http://wedevs.com/support/topic/hide-fields-in-edit-form/#post-6918

function wpufe_assign_new_form( $post_id, $form_id ) {
if ( $form_id == ‘5’ ) {
update_post_meta( $post_id, ‘_wpuf_form_id’, 6 );
}
}
add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_assign_new_form’, 10, 2 );

This solution will allow me to create a second form with all the fields hidden as needed, leaving only the editable field displayed. But where do I put it?

Thanks!

March 1, 2014 at 10:43 am 15980
Mahi Mahi

it goes to your theme’s function.php file

Viewing 3 Posts - 1 through 3 (of 3 total)