Skip to content

Commit 8aa5816

Browse files
committed
fix cronjob that checks update details reminder on spam check
1 parent 1e0881c commit 8aa5816

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

plugins/cc-global-network/cc-global-network.php

+13
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,19 @@ function ccgn_sanitize_user_not_strict($user, $raw_user, $strict)
381381
'ccgn_schedule_remove_email_update_details_reminders'
382382
);
383383

384+
add_action(
385+
'ccgn_check_accounts_to_be_removed',
386+
'ccgn_check_accounts_to_be_removed'
387+
);
388+
register_activation_hook(
389+
__FILE__,
390+
'ccgn_schedule_add_retention_data'
391+
);
392+
register_deactivation_hook(
393+
__FILE__,
394+
'ccgn_schedule_remove_retention_data'
395+
);
396+
384397
////////////////////////////////////////////////////////////////////////////////
385398
// Admin script && styles
386399
////////////////////////////////////////////////////////////////////////////////

plugins/cc-global-network/cron/email-update-details-reminders.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
// Also beware any knock-on effect on CCGN_CLOSE_UPDATE_VOUCHERS_AFTER_DAYS
2121
define('CCGN_FIRST_REMINDER_UPDATE_DETAILS_AFTER_DAYS', 7);
2222
define('CCGN_SECOND_REMINDER_UPDATE_DETAILS_AFTER_DAYS', CCGN_FIRST_REMINDER_UPDATE_DETAILS_AFTER_DAYS + 7);
23-
//define('CCGN_SEND_SECOND_REMINDER_UPDATE_DETAILS_AFTER_DAYS', CCGN_SEND_REMINDER_UPDATE_DETAILS_AFTER_DAYS + 3 );
2423
define( 'CCGN_CLOSE_UPDATE_DETAILS_AFTER_DAYS', CCGN_SECOND_REMINDER_UPDATE_DETAILS_AFTER_DAYS + 10 );
2524

2625
////////////////////////////////////////////////////////////////////////////////
@@ -61,7 +60,7 @@ function ccgn_update_details_set_second_reminder( $applicant_id ) {
6160
update_user_meta($applicant_id, 'ccgn_applicant_update_details_state', $update_details_meta);
6261
}
6362

64-
// Send reminders to those that need them
63+
// Send reminders to those who need them
6564

6665
function ccgn_email_update_details_reminders()
6766
{
@@ -70,6 +69,7 @@ function ccgn_email_update_details_reminders()
7069
CCGN_APPLICATION_STATE_UPDATE_DETAILS
7170
);
7271
foreach ($applicants as $applicant_id) {
72+
$now = new DateTime( 'now' );
7373
$status = get_user_meta($applicant_id, 'ccgn_applicant_update_details_state', true);
7474
$state_date = new DateTime($status['date']);
7575
$days_in_state = $state_date->diff($now)->days;
@@ -90,12 +90,12 @@ function ccgn_email_update_details_reminders()
9090
}
9191
} elseif ( ($days_in_state > CCGN_FIRST_REMINDER_UPDATE_DETAILS_AFTER_DAYS) && ($days_in_state <= CCGN_SECOND_REMINDER_UPDATE_DETAILS_AFTER_DAYS) ) {
9292
// Send first reminder
93-
if (empty($status['state'])) {
93+
if (empty($status['state']) || ($status['state'] == 'none') ) {
9494
ccgn_update_details_set_first_reminder($applicant_id);
9595
}
9696
} elseif ( ($days_in_state > CCGN_SECOND_REMINDER_UPDATE_DETAILS_AFTER_DAYS) && ($days_in_state <= CCGN_CLOSE_UPDATE_DETAILS_AFTER_DAYS) ) {
9797
// Send second reminder
98-
if (($status['state'] == 'first-reminer') && ($status['done'])) {
98+
if (($status['state'] == 'first-reminder') && ($status['done'])) {
9999
ccgn_update_details_set_second_reminder($applicant_id);
100100
}
101101
}

plugins/cc-global-network/includes/application-state.php

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ function ccgn_applicant_type_desc ( $user_id ) {
106106
);
107107
// This application state happens when a member reject the applicant who asked for vouch, voting 'NO'
108108
define( 'CCGN_APPLICATION_STATE_REVIEW', 'to-be-reviewed' );
109+
// This state applies to the new data retention policy, which should retain the data for no more than 30 days
110+
define('CCGN_APPLICATION_STATE_DELETE', 'to-be-deleted' );
111+
109112
define(
110113
'CCGN_APPLICATION_STATE_CAN_BE_PRE_APPROVED',
111114
[

plugins/cc-global-network/includes/buddypress-integration.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -772,12 +772,11 @@ function _ccgn_user_level_set_autouvouched_interim_membership_council (
772772
/* Rejected account should be deleted. There's no need to keep this data on the website **/
773773
function ccgn_user_level_set_rejected ( $user_id ) {
774774

775-
_ccgn_application_delete_entries_created_by($user_id);
776-
delete_user_meta($user_id, CCGN_APPLICATION_TYPE);
777-
delete_user_meta($user_id, CCGN_APPLICATION_STATE);
778-
delete_user_meta($user_id, CCGN_USER_IS_AUTOVOUCHED);
779-
780-
$delete = wp_delete_user($user_id);
775+
//regarding to the new rejection policy and the data retencion period this is changed to this state which should be deleted after 30 days
776+
ccgn_registration_user_set_stage(
777+
$user_id,
778+
CCGN_APPLICATION_STATE_DELETE
779+
);
781780
}
782781

783782
function ccgn_user_level_set_didnt_update_vouchers ( $user_id ) {

0 commit comments

Comments
 (0)