Fix unit tests + enable signup confirmation by default
- minor cleanup
This commit is contained in:
@ -72,6 +72,11 @@ class Populator {
|
|||||||
'name' => $user_name,
|
'name' => $user_name,
|
||||||
'address' => $current_user->user_email
|
'address' => $current_user->user_email
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// enable signup confirmation by default
|
||||||
|
Setting::setValue('signup_confirmation', array(
|
||||||
|
'enabled' => true
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createDefaultSegments() {
|
private function createDefaultSegments() {
|
||||||
|
@ -31,11 +31,7 @@ class Comment {
|
|||||||
|
|
||||||
if(
|
if(
|
||||||
isset($_POST['mailpoet']['subscribe_on_comment'])
|
isset($_POST['mailpoet']['subscribe_on_comment'])
|
||||||
&&
|
&& $_POST['mailpoet']['subscribe_on_comment']
|
||||||
filter_var(
|
|
||||||
$_POST['mailpoet']['subscribe_on_comment'],
|
|
||||||
FILTER_VALIDATE_BOOLEAN
|
|
||||||
) === true
|
|
||||||
) {
|
) {
|
||||||
if($comment_status === Comment::PENDING_APPROVAL) {
|
if($comment_status === Comment::PENDING_APPROVAL) {
|
||||||
// add a comment meta to remember to subscribe the user
|
// add a comment meta to remember to subscribe the user
|
||||||
|
@ -47,18 +47,24 @@ class Registration {
|
|||||||
isset($_POST['mailpoet']['subscribe_on_register'])
|
isset($_POST['mailpoet']['subscribe_on_register'])
|
||||||
&& $_POST['mailpoet']['subscribe_on_register']
|
&& $_POST['mailpoet']['subscribe_on_register']
|
||||||
) {
|
) {
|
||||||
static::subscribeNewUser($user_login, $user_email);
|
static::subscribeNewUser(
|
||||||
|
$user_login,
|
||||||
|
$user_email
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function subscribeNewUser($login, $email) {
|
private static function subscribeNewUser($name, $email) {
|
||||||
$segment_ids = Setting::getValue('subscribe.on_comment.segments', array());
|
$segment_ids = Setting::getValue(
|
||||||
|
'subscribe.on_comment.segments',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
|
||||||
if(!empty($segment_ids)) {
|
if(!empty($segment_ids)) {
|
||||||
Subscriber::subscribe(
|
Subscriber::subscribe(
|
||||||
array(
|
array(
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'first_name' => $login
|
'first_name' => $name
|
||||||
),
|
),
|
||||||
$segment_ids
|
$segment_ids
|
||||||
);
|
);
|
||||||
|
@ -336,7 +336,7 @@ class SubscriberCest {
|
|||||||
expect($subscriber->email)->equals($this->data['email']);
|
expect($subscriber->email)->equals($this->data['email']);
|
||||||
expect($subscriber->first_name)->equals($this->data['first_name']);
|
expect($subscriber->first_name)->equals($this->data['first_name']);
|
||||||
expect($subscriber->last_name)->equals($this->data['last_name']);
|
expect($subscriber->last_name)->equals($this->data['last_name']);
|
||||||
expect($subscriber->status)->equals('unconfirmed');
|
expect($subscriber->status)->equals('subscribed');
|
||||||
expect($subscriber->deleted_at)->equals(null);
|
expect($subscriber->deleted_at)->equals(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user