Tag Info

New answers tagged

0

A possible solution, a good one I think, is to use a object with a property to store the validation status so you set the value of this property in the init action hook where you process the form and access to it in the shortcode. For example: class MyForm { private $validate; function __construct() { add_shortcode( 'myform', array($this, ...


0

@Eric Allen's answer worked perfectly. However, I'd gotten in touch with the Ninjaforms folks too, and their answer worked as well, so I'm posting it here too. They referred me to this: http://ninjaforms.com/documentation/developer-api/filters/ninja_forms_field/ So adapting it to my problem, the solution was this: function filter_fetch_jid( $data, ...


1

It looks like you can use the ninja_forms_display_init action to populate a field. To get the job ID from the URL you mentioned above you can use the $_GET array. Adapting the code from that documentation page, something like this should achieve what you're looking for: function wpse_158000_populate_field($form_id) { global $ninja_forms_loading; ...


1

If I am understanding the question correctly, you should be able to do a query for the media by user id. Something like the follow (untested) code: //only do this if there is a user logged in if( is_user_logged_in() ) { //get the currenly logged in user $user_ID = get_current_user_id(); $upload_args = array( 'post_type' => ...


1

First, create a function to process the form. In the shortcode function, first process the form and then return any form/message that you want to display to the user. /** * Plugin Name: NewsletterFormConnector * Description: Newsletter Form to connect to Newsletter Api * Author: emjay * Version: 1.0 */ //Add function file ...


0

add_filter( 'comment_form_defaults', 'bootstrap3_comment_form' ); function bootstrap3_comment_form( $args ) { $args['comment_field'] = '<div class="form-group comment-form-comment"> <textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="' . __( 'Comment', "beautiful" ) . ...


2

In Wordpress Ajax works this way: First, you register the ajax action and the function you want to use to serve that function, of course, you have to write that function. All the request go to the same URL wp-admin/admin-ajax.php, what it changes is the action, and depending on the action, a different function is called. The function you call, returns the ...


0

What you want is to use : $id = get_current_user_id() What the function that you are using does is get an object.


1

Wordpress doesn't work this way. If you want to work with a framework like Wordpress, you should obey its rules! Of course you can add a database record like this, but it is a really bad approach. Try some plugins for creating and saving forms in Wordpress like Ninja Forms or Quform. You can even do it yourself, but its not recommended for Wordpress ...


1

Your validation is not working because the variables with the empty array return true with isset; Go to http://writecodeonline.com/php/ and try this code, and you'll understand: $test = ""; if ( isset($test) ){ echo "true"; } The right function for it, instead of isset is empty. Try it out: $test = ""; if ( empty($test) ){ echo "empty"; } ...


0

If you want to have a reset button you have to include a reset input in the form: <input type="reset" value="Reset!"> This element resets all form values to default values. In your example <input type="button" onclick="" value="Neka bud"> - <input type='submit' value='Godkänn bud' /> <input type="reset" value="Reset!"> ...


0

First off, move that code from the bottom of your functions.php file into a function that hooks into wp_init (still inside functions.php, though). Check for nonces / form submission in that function instead. Its almost the same thing (I think theme functions.php files are loaded in wp_init) but it is definitely the more Wordpressy way to do things and its ...


0

One thing to take into account, NAME is a reserved wordpress word, if you use a field called name, when you submit your form, you will obtain a 404 not found error.


1

If you want to add some custom HTML between the </h3> and the <form> tags, you can try the following: /** * Add custom HTML between the `</h3>` and the `<form>` tags in the comment_form() output. */ add_action( 'comment_form_before', function(){ add_filter( 'pre_option_comment_registration', 'wpse_156112' ); }); function ...


0

It depends upon the requirement how the form submission entries is going to work afterwards. if you want to collect info from front end and log them to database (with listing in admin panel), separate db table could be the way. if you want to display the data submitted in the form to the front end users, you should use custom post type as it will be easier ...



Top 50 recent answers are included