Hi @drskullster!
You are right! In next versions we will include a simple function call to externally manage users: add, activate, deactivate, etc.
For now, the right way to do this, are:
1) Copy the entire function add_user_self() into wherever you want (I suggest the theme functions.php file)
2) Rename all $this-> for $Knews_plugin-> (search and replace will help you)
3) Comment this lines:
/*
$lang = mysql_real_escape_string($this->post_safe('lang_user'));
$lang_locale = mysql_real_escape_string($this->post_safe('lang_locale_user'));
$email = mysql_real_escape_string($this->post_safe('email'));
$date = $this->get_mysql_date();
$confkey = $this->get_unique_id();
$id_list_news = intval($_POST['user_knews_list']);
$stupid_bot = false;
$key = md5(date('dmY') . KNEWS_VERSION . get_bloginfo('version'));
if ($this->post_safe('knewskey') != $key) $stupid_bot = true;
if (date('G') == 0 && $stupid_bot) {
$key = md5(date('dmY', strtotime("-1 day")) . KNEWS_VERSION . get_bloginfo('version'));
if ($this->post_safe('knewskey') == $key) $stupid_bot = false;
}
if ($this->post_safe('knewscomment') != '') $stupid_bot = true;
if (!$this->validEmail($email) || $stupid_bot) {
echo '<div class="response"><p>' . $this->get_custom_text('ajax_wrong_email', $lang_locale) . ' <a href="#" onclick="window.location.reload()">' . $this->get_custom_text('dialogs_close_button', $lang_locale) . '</a></p></div>';
return false;
}
*/
4) Then, add this code in the same place and customize yourself:
$lang = 'en'; //The lang you want
$lang_locale = 'en_US'; //The localised lang
$email = '[email protected]';
$date = $Knews_plugin->get_mysql_date();
$confkey = $Knews_plugin->get_unique_id();
$id_list_news = 1; //An valid ID mailing list
if (!$Knews_plugin->validEmail($email)) {
return false;
}
5) Now, go to the end of your function and find:
if ($submit_mail) {
if ($this->submit_confirmation ($email, $confkey, $lang_locale)) {
echo $this->get_custom_text('ajax_subscription', $lang_locale);
} else {
echo $this->get_custom_text('ajax_subscription_error', $lang_locale);
}
} else {
if (count($subscription_found)==0) {
echo $this->get_custom_text('ajax_subscription_direct', $lang_locale);
} else {
echo $this->get_custom_text('ajax_subscription_oops', $lang_locale);
}
}
echo '</p></div>';
Comment all the echos and add the code you need for every case:
– subscription ok, email confirmated
– error submitting email
– already subscribed to other mailing list, new mailing list added
– already subscribed to this mailing list
Regards,
Carles.