}
+ /*
+ * Create new pages containing the member DB shortcodes
+ * @return void
+ */
+ public function createPages($requiredPages)
+ {
+ foreach($requiredPages as $requiredPage => $requiredPageInfo) {
+ //foreach($requiredPageInfo as $key => $value) {
+ $trimmedName = 'glm_members_database_'.str_replace(' ','_',strtolower($requiredPage)).'_id';
+ if ( !get_post(get_option($trimmedName))) {
+ $new_page = array(
+ 'post_title' => $requiredPage,
+ 'post_content' => $requiredPageInfo['content'],
+ 'post_status' => 'publish',
+ 'post_type' => 'page',
+ 'post_author' => '1',
+ 'page_template' => isset($requiredPageInfo['template']) ? $requiredPageInfo['template'] : 'index.php' ,
+ 'post_parent' => $requiredPageInfo['parent'] !== '0' ? get_option('glm_members_database_glm_associate_id') : '0'
+ );
+ $new_id = wp_insert_post($new_page);
+ update_option($trimmedName, $new_id);
+ }
+ }
+ }
/**
}
}
+ foreach ($this->config['addOns'] as $a) {
+ //
+ if (isset($a['required_pages'])) {
+ $this->createPages($a['required_pages']);
+ }
+ }
+
// Loop till we have a final action
$loopCheck = 0;
$loopTracking = "<p>Menu: $menuItem, Action = $action</p>";
// 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
'dbActiveVersionOption' => GLM_MEMBERS_PLUGIN_ACTIVE_DB_OPTION,
'dbScriptPath' => GLM_MEMBERS_PLUGIN_DB_SCRIPTS,
'dbVersions' => $glmMembersDbVersions
+ ),
+ 'required_pages' => array(
+ // These should be in GLM Associate
+ 'GLM Associate' => array(
+ 'content' => '',
+ 'parent' => '0'
+ ),
+ // These should be in GLM Members
+ 'Members Only' => array(
+ 'content' => 'This page and any child beneath it will automatically be locked to Members Only with the members-only-template.',
+ 'parent' => '0',
+ 'template' => 'glm-members-only-template.php'
+ ),
+ 'Members List' => array(
+ 'content' => '[glm-members-list]',
+ 'parent' => 'GLM Associate'
+ ),
+ 'Member Detail' => array(
+ 'content' => '[glm-member-detail]',
+ 'parent' => 'GLM Associate'
+ )
)
)
);
if (isset($a['config'])) {
$config = array_merge_recursive($config, $a['config']);
}
-
+
// If the add-on has additional config parameters in a plugin.ini file
$iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini';
if (isset($iniFile)) {