Created
May 31, 2022 19:35
-
-
Save rickalday/ffb27e660cd4b1c7b1d9cf92ef696264 to your computer and use it in GitHub Desktop.
Switch Give Donation history to Legacy View for Admins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_init', static function () { | |
if (isset($_GET['givewp_set_legacy_lists']) && current_user_can('manage_options')) { | |
$userIds = get_users(['role' => 'Administrator', 'fields' => 'ID']); | |
foreach ($userIds as $userId) { | |
update_user_meta($userId, '_give_donations_archive_show_legacy', 1); | |
update_user_meta($userId, '_give_donors_archive_show_legacy', 1); | |
update_user_meta($userId, '_give_donation_forms_archive_show_legacy', 1); | |
} | |
wp_redirect(remove_query_arg('givewp_set_legacy_lists')); | |
exit; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment