AddCampaignFormFromRequest.php
1 year ago
AddNewBadgeToAdminMenuItem.php
1 year ago
AllowGiveRolesToEditCampaignPages.php
1 month ago
ArchiveCampaignFormsAsDraftStatus.php
1 year ago
ArchiveCampaignPagesAsDraftStatus.php
1 year ago
AssignDuplicatedFormToCampaign.php
1 year ago
AssociateCampaignPageWithCampaign.php
1 year ago
CacheCampaignData.php
7 months ago
ConvertQueryDataToCampaign.php
1 year ago
CreateCampaignPage.php
1 year ago
CreateDefaultCampaignForm.php
4 months ago
CreateDefaultLayoutForCampaignPage.php
1 year ago
DuplicateCampaign.php
7 months ago
EnqueueCampaignPageEditorAssets.php
1 year ago
FormInheritsCampaignGoal.php
1 year ago
LoadCampaignAdminOptions.php
11 months ago
LoadCampaignDetailsAssets.php
1 year ago
LoadCampaignPublicOptions.php
11 months ago
LoadCampaignsListTableAssets.php
11 months ago
PreventDeleteDefaultForm.php
1 year ago
RedirectLegacyCreateFormToCreateCampaign.php
4 months ago
RegisterCampaignBlocks.php
7 months ago
RegisterCampaignIdRestField.php
1 year ago
RegisterCampaignShortcodes.php
10 months ago
RenderDonateButton.php
10 months ago
ReplaceGiveFormsCptLabels.php
1 year ago
UnarchiveCampaignFormAsPublishStatus.php
1 year ago
UnarchiveCampaignFormAsPublishStatus.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Campaigns\Actions; |
| 4 | |
| 5 | use Give\Campaigns\Models\Campaign; |
| 6 | use Give\Framework\Database\DB; |
| 7 | |
| 8 | /** |
| 9 | * @since 4.2.0 |
| 10 | */ |
| 11 | class UnarchiveCampaignFormAsPublishStatus |
| 12 | { |
| 13 | /** |
| 14 | * @since 4.2.0 |
| 15 | */ |
| 16 | public function __invoke(Campaign $campaign) |
| 17 | { |
| 18 | if ($campaign->isDirty('status') && |
| 19 | $campaign->status->isActive() && |
| 20 | $campaign->getOriginal('status')->isArchived()) { |
| 21 | if (!$campaign->defaultFormId) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | DB::table('posts') |
| 26 | ->where('ID', $campaign->defaultFormId) |
| 27 | ->update([ |
| 28 | 'post_status' => 'publish', |
| 29 | ]); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 |