mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 21:23:39 +09:00
!!! IMPORTANT 2.0 version before upgrade please run full backup of your site !!!
- new code structure, optimized for next development; - created spl_autoloader for remove includes; - UM classes with namespaces; - deprecated global $ultimatemember; variable (use UM() instead); - new UM/WP roles logic; - new settings class and logic (deprecated Redux framework, deprecated some old options, added some new options); - new dependencies class for extensions; - WP native styles for backend fields; - new upgrades and license activations for extensions; - new logic form backend forms and fields; - created uninstall.php file for delete permanently all UM settings; - optimized registration/upgrade profile process; Deprecated Hooks: um_new_user_registration_plain um_user_registration_extra_hook um_add_user_frontend um_post_registration_global_hook um_admin_extend_directory_options_general (was action...will be filter)
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Common' ) ) {
|
||||
|
||||
class Common {
|
||||
/**
|
||||
* Common constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
add_action( 'init', array( &$this, 'create_post_types' ), 1 );
|
||||
|
||||
add_filter( 'posts_request', array( &$this, 'um_query_pages' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create taxonomies for use for UM
|
||||
*/
|
||||
function create_post_types() {
|
||||
|
||||
register_post_type( 'um_form', array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Forms' ),
|
||||
'singular_name' => __( 'Form' ),
|
||||
'add_new' => __( 'Add New' ),
|
||||
'add_new_item' => __('Add New Form' ),
|
||||
'edit_item' => __('Edit Form'),
|
||||
'not_found' => __('You did not create any forms yet'),
|
||||
'not_found_in_trash' => __('Nothing found in Trash'),
|
||||
'search_items' => __('Search Forms')
|
||||
),
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'public' => false,
|
||||
'supports' => array('title')
|
||||
) );
|
||||
|
||||
if ( um_get_option( 'members_page' ) || ! get_option( 'um_options' ) ) {
|
||||
|
||||
register_post_type( 'um_directory', array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Member Directories' ),
|
||||
'singular_name' => __( 'Member Directory' ),
|
||||
'add_new' => __( 'Add New' ),
|
||||
'add_new_item' => __('Add New Member Directory' ),
|
||||
'edit_item' => __('Edit Member Directory'),
|
||||
'not_found' => __('You did not create any member directories yet'),
|
||||
'not_found_in_trash' => __('Nothing found in Trash'),
|
||||
'search_items' => __('Search Member Directories')
|
||||
),
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'public' => false,
|
||||
'supports' => array('title')
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check query string on 'posts_request' for our pages
|
||||
*
|
||||
* @param string $q
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function um_query_pages( $q ) {
|
||||
global $wp_query;
|
||||
|
||||
//We need main query
|
||||
if ( $q == $wp_query->request ) {
|
||||
|
||||
if ( ! empty( $wp_query->query_vars['um_page'] ) ) {
|
||||
|
||||
if ( 'api' == $wp_query->query_vars['um_page'] ) {
|
||||
$router = new Router();
|
||||
$router->frontend_requests();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $q;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user