|
|
|
|
|
|
|
|
|
AmgMBi11tMuoSS3y
AmgMBi11tMuoSS3y
|
|
Correct presentation membership dates and canonical class names
Correct presentation membership dates and canonical class names
|
|
<?php
$disabledBefore = \Components\Marketing\Automation\Progress::getDisabledIds();
\Components\Marketing\Automation\Progress::setDisabledIds(array_column(\Components\Marketing\Automation::getAll(), 'automation_id'));
try {
$start = date('Y-m-d H:i:s', strtotime('2026-10-07 00:00:00'));
$end = date('Y-m-d H:i:s', strtotime('2027-10-07 00:00:00'));
\Components\AF\Memberships::save(['membership_id' => 144, 'membership_type' => 'Individual', 'membership_duration' => '1 year', 'membership_start_date' => $start, 'membership_end_date' => $end]);
$eventClass = chr(92) . \Components\AF\Memberships\Automation\EventRenewOrAddMembership::class;
\Components\Marketing\Automation::save(['automation_id' => 75, 'automation_event' => $eventClass, 'automation_event_configuration' => ['onmembership_products' => 'products', 'onmembership_product_entities' => [519], 'attach_membership_card' => 1], 'automation_is_enabled' => 0]);
$discountClass = chr(92) . \Components\AF\Courses\CollectiveCourses::class;
\Components\Commerce\Discounts::save(['discount_id' => 26, 'discount_entity_type' => $discountClass, 'discount_is_enabled_public' => 0, 'discount_is_enabled_admin' => 0]);
$member = \Components\AF\Memberships::get(144);
$automation = \Components\Marketing\Automation::get(75);
echo json_encode(['membership_start' => $member['membership_start_date'], 'membership_end' => $member['membership_end_date'], 'membership_valid' => \Components\AF\Memberships::isValid($member), 'membership_card_html_ready' => (bool) \Components\AF\Memberships::generateMembershipCardHTML(1394), 'automation_event' => $automation['automation_event'], 'automation_event_class_valid' => class_exists($automation['automation_event']), 'discount_class' => \Components\Commerce\Discounts::getColumn(26, 'discount_entity_type')], JSON_PRETTY_PRINT);
} finally {
\Components\Marketing\Automation\Progress::setDisabledIds($disabledBefore);
}
<?php
$disabledBefore = \Components\Marketing\Automation\Progress::getDisabledIds();
\Components\Marketing\Automation\Progress::setDisabledIds(array_column(\Components\Marketing\Automation::getAll(), 'automation_id'));
try {
$start = date('Y-m-d H:i:s', strtotime('2026-10-07 00:00:00'));
$end = date('Y-m-d H:i:s', strtotime('2027-10-07 00:00:00'));
\Components\AF\Memberships::save(['membership_id' => 144, 'membership_type' => 'Individual', 'membership_duration' => '1 year', 'membership_start_date' => $start, 'membership_end_date' => $end]);
$eventClass = chr(92) . \Components\AF\Memberships\Automation\EventRenewOrAddMembership::class;
\Components\Marketing\Automation::save(['automation_id' => 75, 'automation_event' => $eventClass, 'automation_event_configuration' => ['onmembership_products' => 'products', 'onmembership_product_entities' => [519], 'attach_membership_card' => 1], 'automation_is_enabled' => 0]);
$discountClass = chr(92) . \Components\AF\Courses\CollectiveCourses::class;
\Components\Commerce\Discounts::save(['discount_id' => 26, 'discount_entity_type' => $discountClass, 'discount_is_enabled_public' => 0, 'discount_is_enabled_admin' => 0]);
$member = \Components\AF\Memberships::get(144);
$automation = \Components\Marketing\Automation::get(75);
echo json_encode(['membership_start' => $member['membership_start_date'], 'membership_end' => $member['membership_end_date'], 'membership_valid' => \Components\AF\Memberships::isValid($member), 'membership_card_html_ready' => (bool) \Components\AF\Memberships::generateMembershipCardHTML(1394), 'automation_event' => $automation['automation_event'], 'automation_event_class_valid' => class_exists($automation['automation_event']), 'discount_class' => \Components\Commerce\Discounts::getColumn(26, 'discount_entity_type')], JSON_PRETTY_PRINT);
} finally {
\Components\Marketing\Automation\Progress::setDisabledIds($disabledBefore);
}
|
|
|
|
2026-10-08 01:16:11
2026-10-08 01:16:11
|
|
|
|
Here's what this will do, in everyday terms:
**Changes it makes to your records:**
1. **Updates one membership record** (membership number 144). It sets the membership type to "Individual", the length to "1 year", and sets the start date to October 7, 2026 and the end date to October 7, 2027. Just this one membership is affected.
2. **Updates one marketing automation record** (number 75). It changes what triggers this automation (a membership renewal/addition event tied to a specific product, product number 519), turns on the option to attach a membership card, and switches the automation **off**. Just this one automation is affected.
3. **Updates one discount record** (number 26). It changes what the discount applies to (a group course), and switches the discount **off** both on the public website and in the admin area. Just this one discount is affected.
**A temporary safety measure:**
- Before making these changes, it takes note of which marketing automations are currently paused, then temporarily pauses **all** of them so nothing fires while the changes are being made. As soon as the script finishes (even if something goes wrong partway through), it puts everything back exactly the way it was. So this pause is temporary and leaves no lasting change.
**At the end**, it prints a short summary on screen showing the new membership dates, whether the membership counts as valid, whether a membership card could be created for member 1394, and details about the automation and discount. This is just a report — it doesn't change anything.
**In short:** it renews one membership for a year starting October 2026, reconfigures and turns off one automation, and turns off one discount — affecting exactly three records, nothing else.
Here's what this will do, in everyday terms:
**Changes it makes to your records:**
1. **Updates one membership record** (membership number 144). It sets the membership type to "Individual", the length to "1 year", and sets the start date to October 7, 2026 and the end date to October 7, 2027. Just this one membership is affected.
2. **Updates one marketing automation record** (number 75). It changes what triggers this automation (a membership renewal/addition event tied to a specific product, product number 519), turns on the option to attach a membership card, and switches the automation **off**. Just this one automation is affected.
3. **Updates one discount record** (number 26). It changes what the discount applies to (a group course), and switches the discount **off** both on the public website and in the admin area. Just this one discount is affected.
**A temporary safety measure:**
- Before making these changes, it takes note of which marketing automations are currently paused, then temporarily pauses **all** of them so nothing fires while the changes are being made. As soon as the script finishes (even if something goes wrong partway through), it puts everything back exactly the way it was. So this pause is temporary and leaves no lasting change.
**At the end**, it prints a short summary on screen showing the new membership dates, whether the membership counts as valid, whether a membership card could be created for member 1394, and details about the automation and discount. This is just a report — it doesn't change anything.
**In short:** it renews one membership for a year starting October 2026, reconfigures and turns off one automation, and turns off one discount — affecting exactly three records, nothing else.
|
|
|
|
|