How to pass username into form that sends data to database

If you want to output the $id, you need to echo. Also be sure to use esc_attr() as a good security practice. <input type=”hidden” name=”id” value=”[insert_php]echo esc_attr( $id );[/insert_php]”> In addition, as was noted in another answer, you’re calling it an ‘id’, but you’re actually using the login (username). If all you need is the … Read more

Shortcode not passing variable to included file

Ok, so somehow I got it working by changing it to this: It looks like it didn’t like ‘the_clientId’. Maybe it just doesn’t like capital letters???? [insert-form form_location=”form.php” identification_number=”12345″] function insert_the_form($atts){ $form_base = plugin_dir_path(__DIR__); // Shortcode attributes & options $atts = shortcode_atts( array( ‘form_location’ => ‘NULL’, ‘identification_number’ => ‘NULL’ //Variable for client ID ), $atts, … Read more

How to check if a value exists in one of two database tables

You had not very good architecture for your application. Best way is in save user information in one table and use separated fields or linked table for save extra information. In your case you case use UNION and check tables in one query. And correct way is use SELECT COUNT(*) and check result instead SELECT … Read more

ajax form function error

This error is telling you that there was a 500 error in the PHP of your AJAX callback: jquery.js:8625 POST /admin-ajax.php 500 () This would be caused by a syntax error or other coding mistake. In looking at your code one obvious major problem is here: // use \Aws\Polly\PollyClient; // this was moved to before … Read more

How do I call comments_template(); from a plugin file?

from the wordpress codex: comments_template(); //Loads the comment template. For use in single Post and Page displays. //Will not work outside of single displays unless $withcomments is set to “1”. my bet is that you need that ->$withcomments thingy <?php global $withcomments; $withcomments = true; comments_template(); ?>