passing arguments to the validation
-
Hi there. Playing around with the free version found some issues.
How can I get in the validation, a $_GET parameter passed originally to the page that renders an update form?Here the scenario
I use a page to update the posts using the filter post_id. I check for the parameter ?_GET[‘art’]. if founded I use it to load the post in the form.add_filter('acfe/form/load/post_id/form=prop_edit', 'mod_origen_prop', 10, 3); function mod_origen_prop($post_id, $form, $action){ if (isset($_GET['art'])) { return $_GET['art']; } }
after that, I use the post_arg filter to catch the original post
add_filter('acfe/form/submit/post_args/form=prop_edit', 'my_form_post_args', 10, 4); function my_form_post_args($args, $type, $form, $action){ if (isset($_GET['art'])) { $args['ID'] = $_GET['art']; } return $args; }
//So far this works like a charm, if any mistakes while copying and simplifying here please ignore them.
But trying to validate the form, the parameter $_GET[‘art’] is no longer available. I want to validate if the user has permission to edit this post, therefore I used:
add_action(‘acfe/form/validation/form=prop_edit’, ‘valida_edicion’, 10, 2);function valida_edicion($form, $post_id){ if (isset($_GET['art'])){ //always is negative. $_GET['art'] is not defined //Validate permission routine to update here } }
So finally my question, how can I get in the validation filter, the $_GET[‘art’] parameter passed originally to the page that renders the update form?
Thank you for your time
- The topic ‘passing arguments to the validation’ is closed to new replies.