<?php
global $czpf_plugin;

function send_error_die($msg){
	die(json_encode(array('R'=>'ERR','MSG'=>$msg)));
}

if(!is_user_logged_in()){
	send_error_die('You are not logged in.');
}


add_action( 'init', 'create_post_typess' );	

function create_post_typess(){
	$czpf_advancede = get_option('czpf_advancede', array());
	
	$my_post = array(
	  'post_title'    => 'Groups',
	  'post_content'  => '[rhc_groups]',
	  'post_status'   => 'publish',
	  'post_type'     => 'page'
	);
	
	// Insert the post into the database
	$post_ID_groups = wp_insert_post( $my_post );
	
	$czpf_advancede['groupsteams_page'] = $post_ID_groups;	
	
	
	$my_post = array(
	  'post_title'    => 'Members',
	  'post_content'  => '[rhc_members]',
	  'post_status'   => 'publish',
	  'post_type'     => 'page'
	);
	
	// Insert the post into the database
	$post_ID_members = wp_insert_post( $my_post );
	
	$czpf_advancede['members_page'] = $post_ID_members;
	
	
	// Create post object
	$my_post = array(
	  'post_title'    => 'Member Profile',
	  'post_content'  => '[rhc_profile]',
	  'post_status'   => 'publish',
	  'post_type'     => 'page'
	);
	
	// Insert the post into the database
	$post_ID_profil = wp_insert_post( $my_post );
	
	$czpf_advancede['post_type_type'] = $post_ID_profil;
	
	update_option('czpf_advancede', $czpf_advancede);
	update_option('czpf_welcome2hide',true);
	
	die();
}
?>