Last active
July 14, 2021 14:50
-
-
Save KaineLabs/bc0beea560d1b6a4ecf38deb38213579 to your computer and use it in GitHub Desktop.
Install Reviews Table
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 | |
/** | |
* Install Reviews Table | |
* Ps: Once the reviews table added just remove this snippet. | |
*/ | |
function yzc_install_reviews_table() { | |
global $wpdb; | |
// Set Variables | |
$sql = array(); | |
$reviews_table = $wpdb->prefix . 'youzify_reviews'; | |
$charset_collate = $wpdb->get_charset_collate(); | |
$sql[] = "CREATE TABLE $reviews_table ( | |
id BIGINT(20) NOT NULL AUTO_INCREMENT, | |
reviewer int(11) NOT NULL, | |
reviewed int(11) NOT NULL, | |
rating DECIMAL(2,1) NOT NULL, | |
review LONGTEXT NOT NULL, | |
options LONGTEXT 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( 'init', 'yzc_install_reviews_table' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment