Created
March 30, 2020 23:40
-
-
Save KaineLabs/d67617af82ef76c67ce75babde6a95c0 to your computer and use it in GitHub Desktop.
Reinstall Privacy Column
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
<?php | |
/** | |
* Re-install Privacy Column | |
*/ | |
function yzc_reinstall_privacy_column() { | |
if ( ! get_option( 'yz_install_bp_activity_privacy2' ) ) { | |
global $bp, $wpdb; | |
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$bp->activity->table_name}' AND column_name = 'privacy'" ); | |
if ( empty( $row ) ) { | |
$wpdb->query("ALTER TABLE {$bp->activity->table_name} ADD privacy varchar(10) NULL DEFAULT 'public'"); | |
} | |
update_option( 'yz_install_bp_activity_privacy2', 1 ); | |
} | |
} | |
add_action( 'bp_init', 'yzc_reinstall_privacy_column' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment