// Save plugin configuration object
$this->config = $config;
-
+
if (!$noDatabaseCheck) {
// Check the database - allow installation of tables for a new add-on
update_option('glmMembersDatabasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION);
}
+
+ if (get_option('glm_members_database_first_activation') == true) {
+ //update_option('glm_members_database_first_activation',false);
+ $this->createPages();
+ }
+
}
/*
}
}
-
+
+ /*
+ * Create new pages containing the member DB shortcodes
+ *
+ *
+ * @return void
+ * @access private
+ */
+ private function createPages()
+ {
+ $member_pages = array(
+ 'Members Page' => '[glm-members-list]',
+ 'Member Detail' => '[glm-member-detail]'
+ );
+ foreach($member_pages as $pageName => $shortCode) {
+ $trimmedName = 'glm_members_database_'.str_replace(' ','_',strtolower($pageName));
+ if ( !get_post(get_option($trimmedName))) {
+ $new_page = array(
+ 'post_title' => $pageName,
+ 'post_content' => $shortCode,
+ 'post_status' => 'publish',
+ 'post_type' => 'page',
+ 'post_author' => '1'
+ );
+ $new_id = wp_insert_post($new_page);
+ update_option($trimmedName, $new_id);
+ }
+ }
+ }
}
// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
add_option('glmMembersDatabaseDbVersion', false);
+add_option('glm_members_database_first_activation', true);
/*
*
* Hook in add-ons and integrate their actions