[ad_1]
I am writing a simple newsletter subscription plug-in. I am trying to implement an email verification system but have a blockage on how to update the subscribers database when they click a verification link ($_GET[]) sent via email and return a message of success or failure.
Below is what I envisage in a jumble of WP php and sql, and English, after the subscriber accesses the url in the format :
$table = $wpdb->prefix."sub";
If (isset ($_GET['code'])) {
$token = $_GET['code'];
wpdb->update($table
SET status = '1'
WHERE status = $token);
If (the update is successful) {
echo 'Your email has been verified. You will begin receiving our newsletters..';
}
else {
echo 'Your verification failed. Please click here to have a new verification link sent to you.';
}
}
The immediate help I need is with correctly forming the wpdb statement. The four db columns are id, name, email, status. The id, email and status are all unique fields so I plan on just using the token in the status column as the key in these queries, which will replace the token stored on registration with numeral 1. I am just not getting the array thing in wpdb statements.
Thanks.