prefix . "amen_requests"; $prayers_table = $wpdb->prefix . "amen_prayers"; $sql = " CREATE TABLE $request_table ( id mediumint(11) NOT NULL AUTO_INCREMENT, prayer_item longtext NOT NULL, prayer_updated longtext NOT NULL, urgency TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, active TINYINT(1) UNSIGNED DEFAULT 1 NOT NULL, privacy TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, approved TINYINT(1) UNSIGNED DEFAULT 1 NOT NULL, created_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, created_by varchar(255) NOT NULL, twitter_handle varchar(255) NOT NULL, email varchar(255) NOT NULL, praying_tag varchar(255) NOT NULL, updated_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, PRIMARY KEY id (id) ) CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE TABLE $prayers_table ( id mediumint(11) NOT NULL AUTO_INCREMENT, session_id varchar(255) NOT NULL, request_id mediumint(11) NOT NULL, prayer_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, PRIMARY KEY id (id) ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta($sql); $wpdb->query("ALTER TABLE {$wpdb->prefix}amen_requests CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"); $wpdb->query("ALTER TABLE {$wpdb->prefix}amen_prayers CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"); // set options update_option( 'amen_version', AMEN_VERSION ); if ( ! $amen_options ) { $amen_settings = array( // privacy & moderation 'allow_public_requests' => FALSE, 'privatize_prayers' => TRUE, 'moderate_public_requests' => TRUE, 'moderate_all_requests' => FALSE, 'email_approval_notification_to' => '', 'disable_approval_notification' => FALSE, // submission & management form 'submission_title' => 'Submit New Prayer Request', 'submission_note' => 'Please note: Public requests require approval.', 'submission_button_text' => 'Submit Request', 'management_title' => 'Manage Prayer Requests', 'author_display' => 'displayname', 'public_user' => 'Public User', // counter 'enable_submit_count' => TRUE, 'submit_text' => 'Pray Now.', 'submitted_state_one' => '{count} praying.', 'submitted_state_two' => 'Amen. You are praying.', 'submitted_state_three' => 'Amen. You and {count-1} other{s} are praying.', // twitter 'tweet_public_requests' => TRUE, 'tweet_via' => '', 'custom_hashtag' => 'Amen', 'tweet_type' => 'hashtag', 'hashtag_in_button' => TRUE, 'prepend_name_to_tweet' => FALSE, 'custom_id_name' => 'AmenID', // email digest 'enable_digest' => FALSE, //'digest_interval' => 'weekly', 'notif_from_name' => get_option( 'blogname' ), 'notif_from_email' => get_option( 'admin_email' ), 'notif_subject' => 'Amen: Weekly Prayer Digest', 'notif_message' => 'Hello, {{DISPLAY-NAME}}! We are together in prayer. ------- {{LOOP}} To the only God, our Savior, through Jesus Christ our Lord, be glory, majesty, dominion, and authority, before all time and now and forever. Amen. - Jude 25', 'notif_request_loop' => 'At least {{NEW}} other(s) have prayed with you this past week. {{TOTAL}} prayers since first posting. PRAYER: {{POST}} UPDATE: {{UPDATE}} MANAGE: {{MANAGE-URL}} ------- ', 'management_url' => '', 'keep_db_tables' => FALSE, 'keep_db_options' => FALSE, 'custom_db_prefix' => '', 'allowed_users' => '', 'allowed_pages' => array(), ); update_option( 'amen_settings', $amen_settings ); } else { amen_updater(); } } } register_activation_hook( __FILE__, 'amen_install' ); /************************************** * CHECKS FOR INSTALL OF UPDATE **************************************/ function amen_update_check() { $amen_version = get_option( 'amen_version', '' ); if( $amen_version != AMEN_VERSION ) { amen_install(); } } add_action( 'plugins_loaded', 'amen_update_check' ); /************************************** * CHECKS FOR INSTALL OF UPDATE **************************************/ function amen_updater() { global $amen_options, $wpdb; // write new settings for 3.0.1 if ( '3.0.1' == AMEN_VERSION || '3.0.2' == AMEN_VERSION ) { ! isset( $amen_options['custom_id_name'] ) ? $amen_options['custom_id_name'] = 'AmenID' : FALSE; ! isset( $amen_options['notif_from_name'] ) ? $amen_options['notif_from_name'] = get_option( 'blogname' ) : FALSE; ! isset( $amen_options['notif_from_email'] ) ? $amen_options['notif_from_email'] = get_option( 'admin_email' ) : FALSE; ! isset( $amen_options['notif_subject'] ) ? $amen_options['notif_subject'] = 'Amen: Weekly Prayer Digest' : FALSE; ! isset( $amen_options['notif_message'] ) ? $amen_options['notif_message'] = 'Hello, {{DISPLAY-NAME}}! We are together in prayer. ------- {{LOOP}} To the only God, our Savior, through Jesus Christ our Lord, be glory, majesty, dominion, and authority, before all time and now and forever. Amen. - Jude 25' : FALSE; ! isset( $amen_options['notif_request_loop'] ) ? $amen_options['notif_request_loop'] = 'At least {{NEW}} other(s) have prayed with you this past week. {{TOTAL}} prayers since first posting. PRAYER: {{POST}} UPDATE: {{UPDATE}} MANAGE: {{MANAGE-URL}} ------- ' : FALSE; ! isset( $amen_options['management_url'] ) ? $amen_options['management_url'] = 'none' : FALSE; } update_option( 'amen_settings', $amen_options ); } ?>