I have a plugin here that registers a user for my wordPress site but now I want to update the ID of the user that just registered after they submit a form.
I am trying to edit a plugin on WordPress that after it submits a form I should get the last inserted ID and update the records that were just added.
<?php do_action( 'user_registration_form_registration_end', $form_id ); ?>
<?php
// Add refer
global $wpdb;
$table_name = $wpdb->prefix."users";
$current_user = wp_get_current_user();
// $lastid = $wpdb->insert_id;
if(isset($_GET['ID'])){
$where = array('ID' => $current_user);
$subs = array('refID'=> $_GET['ref_id']);
$wpdb->update($table_name, $subs, $where);
}
?>
</form>
<div style="clear:both"></div>
</div>
I want it to get a value from the url and then update the user record in the database.