diff --git a/classes/admin/class.inbound-analytics.php b/classes/admin/class.inbound-analytics.php index f90f2d4f..d0e246f3 100644 --- a/classes/admin/class.inbound-analytics.php +++ b/classes/admin/class.inbound-analytics.php @@ -78,6 +78,12 @@ public static function load_range() { self::$dates = Inbound_Reporting_Templates::prepare_range(self::$range); + /* set correct datetime formats for db */ + $start_date = new DateTime(self::$dates['start_date']); + $end_date = new DateTime(self::$dates['end_date']); + self::$dates['start_date'] = $start_date->format('Y-m-d G:i:s'); + self::$dates['end_date'] = $end_date->format('Y-m-d G:i:s'); + return array('range' => self::$range, 'dates' => self::$dates); } @@ -296,8 +302,8 @@ public static function prepare_column_data($column, $post_id) { ); $results = Inbound_Events::get_page_views_count_by('page_id', $params); ?> - ID . '&class=Inbound_Impressions_Report&range=' . self::$range . '&tb_hide_nav=true&TB_iframe=true&width=1000&height=600'); ?>' class='thickbox inbound-thickbox' title=""> - + ID . '&class=Inbound_Impressions_Report&range=' . self::$range . '&tb_hide_nav=true&TB_iframe=true&width=1000&height=600'); ?>' class='thickbox inbound-thickbox' title="" "> + posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; + $pieces['join'] .= " RIGHT JOIN {$table_prefix}inbound_page_views ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; $pieces['groupby'] = " {$wpdb->posts}.ID"; - $pieces['orderby'] = "COUNT(ee.page_id) $order "; + $pieces['orderby'] = "COUNT(*) $order "; + + //print_r($pieces);exit; break; case 'inbound_visitors': - $pieces['join'] .= " LEFT JOIN (select lead_id, page_id from {$table_prefix}inbound_page_views group by lead_id) ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; + $pieces['join'] .= " RIGHT JOIN (select lead_id, page_id from {$table_prefix}inbound_page_views group by lead_id) ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; $pieces['groupby'] = " {$wpdb->posts}.ID "; - $pieces['orderby'] = "COUNT(ee.lead_id) $order "; + $pieces['orderby'] = "COUNT(*) $order "; break; case 'inbound_actions': - $pieces['join'] .= " LEFT JOIN {$table_prefix}inbound_events ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; + $pieces['join'] .= " RIGHT JOIN {$table_prefix}inbound_events ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'"; $pieces['groupby'] = " {$wpdb->posts}.ID"; - $pieces['orderby'] = "COUNT(ee.page_id) $order "; + $pieces['orderby'] = "COUNT(*) $order "; break; } @@ -435,4 +443,4 @@ public static function filter_profile_tabs($tabs) { } -new Inbound_Analytics(); \ No newline at end of file +new Inbound_Analytics(); diff --git a/classes/admin/class.settings.php b/classes/admin/class.settings.php index 804bc4a5..5b36b988 100644 --- a/classes/admin/class.settings.php +++ b/classes/admin/class.settings.php @@ -308,6 +308,18 @@ public static function extend_settings() { 'value' => null ) ), + array ( + 'id' => 'page-views-optimize', + 'type' => 'html', + 'label' => __( 'Database Maintenance' , 'inbound-pro' ), + 'description' => __( '' , 'inbound-pro' ), + 'callback' => array( 'Inbound_Pro_Settings' , 'display_page_view_db_options'), + 'hidden' => false, + 'reveal' => array( + 'selector' => null , + 'value' => null + ) + ), array ( 'id' => 'admin-tracking', 'type' => 'radio', @@ -793,6 +805,18 @@ public static function display_search() { + TODO/Wishlist: + + '; } - echo ' '; + + /* advertisements here */ + if ( INBOUND_ACCESS_LEVEL === 0 || INBOUND_ACCESS_LEVEL === 9 ) { + $rand = rand(0,1); + switch ($rand) { + case true: + /* codeable advertisement */ + echo '
+

Sponsored Moment: Want to build on top of Inbound Now? Agents at Codeable are ready to help.

+ + + +
'; + echo ' '; + break; + case false: + /* WPEngine advertisement here */ + echo '
+

Sponsored Moment: Inbound PRO works great on WPEngine.

+ +
'; + echo ' '; + break; + } + } + + echo ''; } diff --git a/core/shared/classes/class.database-routines.php b/core/shared/classes/class.database-routines.php index 0dd0a36b..8e988d2a 100644 --- a/core/shared/classes/class.database-routines.php +++ b/core/shared/classes/class.database-routines.php @@ -180,7 +180,7 @@ public static function alter_page_views_table() { } if(!isset($col_check->cta_id)) { - $wpdb->get_results("ALTER TABLE {$table_name} ADD `cta_id` VARCHAR(20) NOT NULL"); + $wpdb->get_results("ALTER TABLE {$table_name} ADD `cta_id` bigint(20) NOT NULL"); } else { $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `cta_id` VARCHAR(20)" ); } @@ -267,11 +267,11 @@ public static function alter_events_pageviews_107() { /* events table */ $table_name = $wpdb->prefix . "inbound_events"; - $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` VARCHAR(20)" ); + $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` bigint(20)" ); /* pageviews table */ $table_name = $wpdb->prefix . "inbound_page_views"; - $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` VARCHAR(20)" ); + $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` bigint(20)" ); } diff --git a/core/shared/classes/class.events.php b/core/shared/classes/class.events.php index 5b0a92b9..d4221023 100644 --- a/core/shared/classes/class.events.php +++ b/core/shared/classes/class.events.php @@ -109,10 +109,10 @@ public static function create_page_views_table(){ } $sql = "CREATE TABLE IF NOT EXISTS $table_name ( - `id` bigint(9) NOT NULL AUTO_INCREMENT, - `page_id` varchar(20) NOT NULL, - `cta_id` varchar(20) NOT NULL, - `variation_id` bigint(9) NOT NULL, + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `page_id` bigint(20) NOT NULL, + `cta_id` bigint(20) NOT NULL, + `variation_id` bigint(20) NOT NULL, `lead_id` bigint(20) NOT NULL, `lead_uid` varchar(255) NOT NULL, `list_id` bigint(20) NOT NULL, diff --git a/inbound-pro.php b/inbound-pro.php index 38ebcd0c..a3f6c180 100644 --- a/inbound-pro.php +++ b/inbound-pro.php @@ -4,7 +4,7 @@ Plugin URI: http://www.inboundnow.com/ Description: Professional Inbound Marketing Suite for WordPress Author: InboundWP LLC -Version: 1.9.5.1 +Version: 1.9.5.5 Author URI: http://www.inboundnow.com/ Text Domain: inbound-pro */ @@ -95,8 +95,8 @@ public function __construct() { */ private static function define_constants() { - define('INBOUND_PRO_CURRENT_VERSION', '1.9.5.1' ); - define('INBOUND_PRO_STABLE_VERSION', '1.9.4.5' ); + define('INBOUND_PRO_CURRENT_VERSION', '1.9.5.5' ); + define('INBOUND_PRO_STABLE_VERSION', '1.9.5.1' ); define('INBOUND_PRO_TRANSLATIONS_VERSION', '1.30.22' ); define('INBOUND_PRO_URLPATH', plugin_dir_url( __FILE__ )); define('INBOUND_PRO_PATH', plugin_dir_path( __FILE__ ) );