Skip to content

Commit

Permalink
fix: update column name about prmpro subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias committed Sep 29, 2024
1 parent c4a1544 commit cd65467
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function bl_cron_exec_sync_subs()

// get all active accounts and membership level
$query = $wpdb->prepare(
"SELECT user_id, wu.user_login AS AccountName, membership_id, status
"SELECT user_id, wu.user_login AS AccountName, membership_level_id, status
FROM " . $wpdb->prefix . "pmpro_subscriptions wpmu
LEFT JOIN " . $wpdb->prefix . "users wu ON wpmu.user_id = wu.ID
WHERE wpmu.status=\"active\";"
Expand Down Expand Up @@ -70,8 +70,8 @@ function bl_cron_exec_sync_subs()
if ($current_subscriptions_in_game_rows != null) {
foreach ($current_subscriptions_in_game_rows as $row) {
if (array_key_exists($row->account_name, $all_active_accounts_obj)) {
if ($all_active_accounts_obj[$row->account_name]->membership_id != $row->membership_level) {
$query_update_membership_level = "UPDATE `acore_cms_subscriptions` SET `membership_level`= " . $all_active_accounts_obj[$row->account_name]->membership_id . " WHERE `account_name`=\"" . $row->account_name . "\";\n";
if ($all_active_accounts_obj[$row->account_name]->membership_level_id != $row->membership_level) {
$query_update_membership_level = "UPDATE `acore_cms_subscriptions` SET `membership_level`= " . $all_active_accounts_obj[$row->account_name]->membership_level_id . " WHERE `account_name`=\"" . $row->account_name . "\";\n";
$query = $acore_auth_db->prepare($query_update_membership_level);
$acore_auth_db->get_results($query);
}
Expand All @@ -83,7 +83,7 @@ function bl_cron_exec_sync_subs()
// INSERT new accounts with membership if any
$query_insert_membership_new = '';
foreach ($all_active_accounts_obj as $row) {
$query_insert_membership_new .= "('" . $row->AccountName . "', " . $row->membership_id . "),\n";
$query_insert_membership_new .= "('" . $row->AccountName . "', " . $row->membership_level_id . "),\n";
}

if ($query_insert_membership_new != '') {
Expand Down

0 comments on commit cd65467

Please sign in to comment.