Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Last active September 6, 2021 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/792382225e929a1b04e0cf1eec53353d to your computer and use it in GitHub Desktop.
Save KaineLabs/792382225e929a1b04e0cf1eec53353d to your computer and use it in GitHub Desktop.
Re-install Media Table
<?php
/**
* Re-install Media Table.
*/
function yzc_reinstall_media_table() {
global $wpdb;
$sql = array();
$media_table = $wpdb->prefix . 'youzify_media';
$charset_collate = $wpdb->get_charset_collate();
$sql[] = "CREATE TABLE $media_table (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
media_id BIGINT(20) NULL,
user_id int(11) DEFAULT '0' NOT NULL,
src LONGTEXT NULL,
data LONGTEXT NULL,
item_id int(11) DEFAULT '0' NULL,
privacy varchar(10) NOT NULL,
source varchar(50) NULL,
type varchar(10) DEFAULT 'none' NOT NULL,
component varchar(10) DEFAULT 'activity' NOT NULL,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
// Include Files.
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
// Build Tables.
dbDelta( $sql );
}
add_action( 'bp_init', 'yzc_reinstall_media_table' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment