Created
June 25, 2018 23:26
-
-
Save ideadude/7d64cf847ef243419e407585343695d2 to your computer and use it in GitHub Desktop.
Force run the pmpro_cleanup_memberships_users_table() function in PMPro.
This file contains hidden or 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
/** | |
* This gist will force run the pmpro_cleanup_memberships_users_table() | |
* function in PMPro. This function sets entries in the pmpro_memberships_users | |
* table to 'incative' if either (a) the level has been deleted or (b) there is a | |
* more recent active entry for the same level. | |
* | |
* IMPORTANT: Back up your database first. | |
* NOTE: This script may not fix all issues with the memberships_users table due to bad imports/etc. | |
* Add this code to a custom plugin, then visit /?cleanup_memberships_users_table=1 | |
* to kick off the script. Then remove the code from the custom plugin. | |
*/ | |
function init_pmpro_cleanup_memberships_users_table() { | |
if( !empty( $_REQUEST['pmpro_cleanup_memberships_users_table'] ) ) { | |
echo 'Running pmpro_cleanup_memberships_users_table() ... '; | |
pmpro_cleanup_memberships_users_table(); | |
echo 'Done.'; | |
exit; | |
} | |
} | |
add_action ('init', 'init_pmpro_cleanup_memberships_users_table'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment