diff --git a/classes/admin/class.settings.php b/classes/admin/class.settings.php
index 242f1d68..00b60dd3 100644
--- a/classes/admin/class.settings.php
+++ b/classes/admin/class.settings.php
@@ -880,8 +880,8 @@ public static function render_fields( $page ) {
case false:
/* WPEngine advertisement here */
echo '
-
Sponsored Moment: Inbound PRO works great on WPEngine.
-
+
Sponsored Moment: Inbound PRO works great on WPEngine. Get 4 months free on annual Startup, Growth, and Scale plans when you use our coupon code WPE20OFF.
+
';
echo ' ';
break;
diff --git a/core/automation/classes/class.post-type.automation.php b/core/automation/classes/class.post-type.automation.php
index d571ae6a..427b0a99 100644
--- a/core/automation/classes/class.post-type.automation.php
+++ b/core/automation/classes/class.post-type.automation.php
@@ -19,6 +19,7 @@ private function load_hooks() {
/* Load Admin Only Hooks */
if (is_admin()) {
+ add_action( 'admin_init' , array( __CLASS__ , 'register_role_capabilities' ) ,999);
/* Register Columns */
add_filter( 'manage_automation_posts_columns' , array( __CLASS__ , 'register_columns') );
@@ -50,6 +51,9 @@ private function load_hooks() {
/* process bulk actions */
add_action('load-edit.php', array(__CLASS__, 'process_bulk_actions'));
+
+ add_action('admin_notices', array( __CLASS__ , 'prompt_rebuild_database' ) );
+
}
}
@@ -78,7 +82,7 @@ public static function register_post_type() {
'menu_icon' => '',
'show_in_menu' => true,
'show_in_nav_menus' => false,
- 'capability_type' => 'post',
+ 'capability_type' => array('rule','rules'),
'hierarchical' => false,
'menu_position' => 35,
'supports' => array('title')
@@ -88,6 +92,35 @@ public static function register_post_type() {
}
+ /**
+ * Register Role Capabilities
+ */
+ public static function register_role_capabilities() {
+ // Add the roles you'd like to administer the custom post types
+ $roles = array('inbound_marketer','administrator');
+
+ // Loop through each role and assign capabilities
+ foreach($roles as $the_role) {
+
+ $role = get_role($the_role);
+ if (!$role) {
+ continue;
+ }
+
+ $role->add_cap( 'read' );
+ $role->add_cap( 'read_rules');
+ $role->add_cap( 'read_private_rules' );
+ $role->add_cap( 'edit_rule' );
+ $role->add_cap( 'edit_rules' );
+ $role->add_cap( 'edit_others_rules' );
+ $role->add_cap( 'edit_published_rules' );
+ $role->add_cap( 'publish_rules' );
+ $role->add_cap( 'delete_others_rules' );
+ $role->add_cap( 'delete_private_rules' );
+ $role->add_cap( 'delete_published_rules' );
+ }
+ }
+
/**
* Get Automation Rules as Array
* @return array
@@ -198,7 +231,7 @@ public static function enqueue_admin_scripts( $hook ) {
}
public static function setup_menus() {
- if ( !current_user_can('manage_options')) {
+ if ( !current_user_can('edit_rules')) {
remove_menu_page( 'edit.php?post_type=automation' );
}
}
@@ -264,7 +297,7 @@ public static function process_bulk_actions() {
return;
}
- if (!current_user_can('manage_options')) {
+ if (!current_user_can('edit_rules')) {
die();
}
@@ -369,6 +402,31 @@ public static function ajax_clear_rule_tasks() {
echo $rule_id;
exit;
}
+
+ /**
+ * Checks to see if email service Key is inputed. If it's not then it throws the notice
+ */
+ public static function prompt_rebuild_database() {
+ global $post , $wpdb;
+
+
+ if (!isset($post)||$post->post_type!='automation'){
+ return false;
+ }
+
+ /* Check if database table exists exists */
+ $table_name = $wpdb->prefix.'inbound_automation_queue';
+ if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
+ return;
+ }
+ ?>
+
+ ';
+ echo '';
foreach (self::$core_settings as $key => $data) {
?>
@@ -170,7 +170,7 @@ public static function display_navigation() {
}
echo "
";
- echo "