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
| <?php | |
| /** | |
| * Cleanup script: Remove User Fields Avatar meta after PMPro migration. | |
| * Use the migration script first: https://gist.github.com/kimcoleman/bab980d8eba1c59fc1be966eaa23a5d5 | |
| * | |
| * Run this as a WP-CLI command. | |
| * Save this code to a file cleanup-user-fields-avatars.php. | |
| * Put the file in your WordPress root directory (the same folder where wp-config.php lives). | |
| * | |
| * WP-CLI usage: wp eval-file cleanup-user-fields-avatars.php |
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
| <?php | |
| /** | |
| * Migration script: PMPro User Fields Avatar (wp_user_avatar) → PMPro Avatars | |
| * | |
| * Run this as a WP-CLI command. | |
| * Save this code to a file migrate-user-fields-avatars.php | |
| * Put the file in your WordPress root directory (the same folder where wp-config.php lives). | |
| * | |
| * WP-CLI usage: wp eval-file migrate-user-fields-avatars.php | |
| * |
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
| <?php | |
| /** | |
| * Cleanup script: Remove Basic User Avatars meta + files after PMPro migration. | |
| * Use the migration script first: https://gist.github.com/kimcoleman/f031b36f4a685eff315390ccc19889b1 | |
| * | |
| * Run this as a WP-CLI command. | |
| * Save this code to a file cleanup-bua.php. | |
| * Put the file in your WordPress root directory (the same folder where wp-config.php lives). | |
| * | |
| * WP-CLI usage: wp eval-file cleanup-bua.php |
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
| <?php | |
| /** | |
| * Migration script: Basic User Avatars → PMPro Avatars | |
| * | |
| * Run this as a WP-CLI command. | |
| * Save this code to a file migrate-avatars.php. | |
| * Put the file in your WordPress root directory (the same folder where wp-config.php lives). | |
| * | |
| * WP-CLI usage: wp eval-file migrate-avatars.php | |
| * Update the $dry_run value to "false" to run the actual migration. |
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
| /** | |
| * One-time update: Set user_nicename to a safe "first-name-last-name" format for existing users. | |
| */ | |
| function my_update_existing_user_nicenames() { | |
| // Only run for admins to avoid performance hits or unauthorized access. | |
| if ( ! current_user_can( 'manage_options' ) ) { | |
| return; | |
| } | |
| // Add a transient so we only run this once. |
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
| <?php | |
| /** | |
| * Filter the user nicename to use a sanitized first-name-last-name format. | |
| */ | |
| function my_set_safe_user_nicename( $nicename ) { | |
| if ( ! isset( $_POST['first_name'] ) || ! isset( $_POST['last_name'] ) ) { | |
| return $nicename; | |
| } | |
| $first_name = sanitize_text_field( $_POST['first_name'] ); |
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
| <?php | |
| /** | |
| * Get the next payment date for a user's level inclusive of subscriptions and expiration dates. | |
| * | |
| * If the current user has a subscription for a passed level ID, return the next payment date for that subscription. | |
| * Otherwise, if the user has an expiration date set for the level, return that. | |
| * Otherwise, return null. | |
| * | |
| * @param int $level_id The level ID to check for. | |
| * @return int|null The next payment date/expiration date as a timestamp or null. |
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
| <?php | |
| function my_coa_demo_pmpro_gettext_changes( $translated_text, $text, $domain ) { | |
| if ( $domain == 'pmpro-shipping' ) { | |
| if ( $text == 'Shipping Address' ) { | |
| $translated_text = 'Mailing Address'; | |
| } | |
| } | |
| return $translated_text; | |
| } |
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
| <?php | |
| /** | |
| * Shortcode to display a table of units, owners, and residents. | |
| */ | |
| function condo_units_table_shortcode( $atts ) { | |
| global $wpdb; | |
| // Shortcode attributes with defaults | |
| $atts = shortcode_atts( array( | |
| 'meta_key' => 'unit', // The usermeta key to retrieve unit numbers |
NewerOlder