PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 8.2
Jetpack – WP Security, Backup, Speed, & Growth v8.2
12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
← All changes | modules/subscriptions.php +30 -31 8.1.48.2 View file →
@@ -92,11 +92,10 @@
92 92 add_filter( 'jetpack_published_post_flags', array( $this, 'set_post_flags' ), 10, 2 );
93 93
94 94 add_filter( 'post_updated_messages', array( $this, 'update_published_message' ), 18, 1 );
95 95
96 - // Set and delete "social_notifications_subscribe" option during activation / deactivation
96 + // Set "social_notifications_subscribe" option during the first-time activation.
97 97 add_action( 'jetpack_activate_module_subscriptions', array( $this, 'set_social_notifications_subscribe' ) );
98 - add_action( 'jetpack_deactivate_module_subscriptions', array( $this, 'delete_social_notifications_subscribe' ) );
99 98 }
100 99
101 100 /**
102 101 * Jetpack_Subscriptions::xmlrpc_methods()
@@ -524,8 +523,9 @@
524 523 * unknown_post_id : unknown post
525 524 * not_subscribed : strange error. Jetpack servers at WordPress.com could subscribe the email.
526 525 * disabled : Site owner has disabled subscriptions.
527 526 * active : Already subscribed.
527 + * pending : Tried to subscribe before but the confirmation link is never clicked. No confirmation email is sent.
528 528 * unknown : strange error. Jetpack servers at WordPress.com returned something malformed.
529 529 * unknown_status : strange error. Jetpack servers at WordPress.com returned something I didn't understand.
530 530 */
531 531 function subscribe( $email, $post_ids = 0, $async = true, $extra_data = array() ) {
@@ -577,23 +577,26 @@
577 577 continue;
578 578 }
579 579
580 580 switch ( $response[0]['status'] ) {
581 - case 'error' :
582 - $r[] = new Jetpack_Error( 'not_subscribed' );
583 - continue 2;
584 - case 'disabled' :
585 - $r[] = new Jetpack_Error( 'disabled' );
586 - continue 2;
587 - case 'active' :
588 - $r[] = new Jetpack_Error( 'active' );
589 - continue 2;
590 - case 'pending' :
591 - $r[] = true;
592 - continue 2;
593 - default :
594 - $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] );
595 - continue 2;
581 + case 'error':
582 + $r[] = new Jetpack_Error( 'not_subscribed' );
583 + continue 2;
584 + case 'disabled':
585 + $r[] = new Jetpack_Error( 'disabled' );
586 + continue 2;
587 + case 'active':
588 + $r[] = new Jetpack_Error( 'active' );
589 + continue 2;
590 + case 'confirming':
591 + $r[] = true;
592 + continue 2;
593 + case 'pending':
594 + $r[] = new Jetpack_Error( 'pending' );
595 + continue 2;
596 + default:
597 + $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] );
598 + continue 2;
596 599 }
597 600 }
598 601
599 602 return $r;
@@ -655,10 +658,15 @@
655 658 case 'blocked_email':
656 659 $result = 'opted_out';
657 660 break;
658 661 case 'active':
662 + $result = 'already';
663 + break;
664 + case 'flooded_email':
665 + $result = 'many_pending_subs';
666 + break;
659 667 case 'pending':
660 - $result = 'already';
668 + $result = 'pending';
661 669 break;
662 670 default:
663 671 $result = 'error';
664 672 break;
@@ -864,9 +872,9 @@
864 872 }
865 873 }
866 874
867 875 /**
868 - * Set the social_notifications_subscribe option to `off` when the Subscriptions module is activated.
876 + * Set the social_notifications_subscribe option to `off` when the Subscriptions module is activated in the first time.
869 877 *
870 878 * @since 8.1
871 879 *
872 880 * @return null
@@ -871,20 +879,11 @@
871 879 *
872 880 * @return null
873 881 */
874 882 function set_social_notifications_subscribe() {
875 - update_option( 'social_notifications_subscribe', 'off' );
876 - }
877 -
878 - /**
879 - * Delete the social_notifications_subscribe option that was set to `off` on the module activation.
880 - *
881 - * @since 8.1
882 - *
883 - * @return null
884 - */
885 - function delete_social_notifications_subscribe() {
886 - delete_option( 'social_notifications_subscribe' );
883 + if ( false === get_option( 'social_notifications_subscribe' ) ) {
884 + add_option( 'social_notifications_subscribe', 'off' );
885 + }
887 886 }
888 887
889 888 }
890 889