mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- made hooks documentation;
- some optimizations and make single functions for some hooks;
This commit is contained in:
@@ -318,7 +318,49 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
|
||||
'post' => $_POST
|
||||
);
|
||||
|
||||
$array = apply_filters("um_admin_pre_save_fields_hook", $array );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_pre_save_fields_hook
|
||||
* @description Filter field data before save
|
||||
* @input_vars
|
||||
* [{"var":"$array","type":"array","desc":"Save Field data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_pre_save_fields_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_pre_save_fields_hook', 'my_admin_pre_save_fields', 10, 1 );
|
||||
* function my_admin_pre_save_fields( $array ) {
|
||||
* // your code here
|
||||
* return $array;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$array = apply_filters( "um_admin_pre_save_fields_hook", $array );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_field_update_error_handling
|
||||
* @description Change error string on save field
|
||||
* @input_vars
|
||||
* [{"var":"$error","type":"string","desc":"Error String"},
|
||||
* {"var":"$array","type":"array","desc":"Save Field data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_field_update_error_handling', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_field_update_error_handling', 'my_admin_field_update_error', 10, 2 );
|
||||
* function my_admin_field_update_error( $error, $array ) {
|
||||
* // your code here
|
||||
* return $error;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
|
||||
|
||||
extract( $array['post'] );
|
||||
@@ -347,10 +389,50 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
|
||||
$field_ID = $_metakey;
|
||||
$field_args = $save[ $_metakey ];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_pre_save_field_to_form
|
||||
* @description Change field options before save to form
|
||||
* @input_vars
|
||||
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_pre_save_field_to_form', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_pre_save_field_to_form', 'my_admin_pre_save_field_to_form', 10, 1 );
|
||||
* function my_admin_pre_save_field_to_form( $field_args ) {
|
||||
* // your code here
|
||||
* return $field_args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$field_args = apply_filters("um_admin_pre_save_field_to_form", $field_args );
|
||||
|
||||
UM()->fields()->update_field( $field_ID, $field_args, $post_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_pre_save_field_to_db
|
||||
* @description Change field options before save to DB
|
||||
* @input_vars
|
||||
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_pre_save_field_to_db', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_pre_save_field_to_db', 'my_admin_pre_save_field_to_db', 10, 1 );
|
||||
* function my_admin_pre_save_field_to_form( $field_args ) {
|
||||
* // your code here
|
||||
* return $field_args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$field_args = apply_filters("um_admin_pre_save_field_to_db", $field_args );
|
||||
|
||||
if ( ! isset( $array['args']['form_only'] ) ) {
|
||||
|
||||
@@ -131,7 +131,7 @@ if ( ! class_exists( 'Admin_Columns' ) ) {
|
||||
public function add_display_post_states( $post_states, $post ) {
|
||||
|
||||
foreach ( UM()->config()->core_pages as $page_key => $page_value ) {
|
||||
$page_id = UM()->options()->get( apply_filters( 'um_core_page_id_filter', 'core_' . $page_key ) );
|
||||
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( $page_key ) );
|
||||
|
||||
if ( $page_id == $post->ID ) {
|
||||
$post_states['um_core_page_' . $page_key] = sprintf( 'UM %s', $page_value['title'] );
|
||||
|
||||
@@ -348,6 +348,26 @@ if ( ! class_exists( 'Admin_Enqueue' ) ) {
|
||||
*/
|
||||
function load_localize_scripts(){
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_enqueue_localize_data
|
||||
* @description Extend localize data at wp-admin side
|
||||
* @input_vars
|
||||
* [{"var":"$localize_data","type":"array","desc":"Localize Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_enqueue_localize_data', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_enqueue_localize_data', 'my_admin_enqueue_localize_data', 10, 1 );
|
||||
* function my_admin_enqueue_localize_data( $localize_data ) {
|
||||
* // your code here
|
||||
* return $localize_data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$localize_data = apply_filters('um_admin_enqueue_localize_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' )
|
||||
)
|
||||
|
||||
@@ -106,7 +106,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -242,6 +242,33 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function render_field_by_hook( $data ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_render_field_type_{$type}
|
||||
* @description Render admin form field by hook
|
||||
* @input_vars
|
||||
* [{"var":"$html","type":"string","desc":"Field's HTML"},
|
||||
* {"var":"$data","type":"array","desc":"Field's data"},
|
||||
* {"var":"$form_data","type":"array","desc":"Form data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_render_field_type_{$type}', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_render_field_type_{$type}', 'my_render_field_type', 10, 3 );
|
||||
* function my_render_field_type( $html, $data, $form_data ) {
|
||||
* // your code here
|
||||
* return $html;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
}
|
||||
|
||||
|
||||
function render_field_label( $data ) {
|
||||
if ( empty( $data['label'] ) )
|
||||
return false;
|
||||
|
||||
@@ -85,6 +85,26 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
$post_types = UM()->options()->get( 'restricted_access_post_metabox' );
|
||||
if ( ! empty( $post_types[ $current_screen->id ] ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_restrict_content_hide_metabox
|
||||
* @description Show/Hide Restrict content metabox
|
||||
* @input_vars
|
||||
* [{"var":"$show","type":"bool","desc":"Show Metabox"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_restrict_content_hide_metabox', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_restrict_content_hide_metabox', 'my_restrict_content_hide_metabox', 10, 1 );
|
||||
* function my_restrict_content_hide_metabox( $show ) {
|
||||
* // your code here
|
||||
* return $show;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
|
||||
|
||||
if ( ! $hide_metabox ) {
|
||||
@@ -195,6 +215,35 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
function um_category_access_fields_create() {
|
||||
$data = array();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_category_access_settings_fields
|
||||
* @description Settings fields for terms
|
||||
* @input_vars
|
||||
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
||||
* {"var":"$data","type":"array","desc":"Settings Data"},
|
||||
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
||||
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
||||
* // your code here
|
||||
* $access_settings_fields[] = array(
|
||||
* 'id' => 'my-field-key',
|
||||
* 'type' => 'my-field-type',
|
||||
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
||||
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
||||
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
||||
* );
|
||||
* return $access_settings_fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
||||
array(
|
||||
'id' => '_um_custom_access_settings',
|
||||
@@ -312,7 +361,35 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_category_access_settings_fields
|
||||
* @description Settings fields for terms
|
||||
* @input_vars
|
||||
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
||||
* {"var":"$data","type":"array","desc":"Settings Data"},
|
||||
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
||||
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
||||
* // your code here
|
||||
* $access_settings_fields[] = array(
|
||||
* 'id' => 'my-field-key',
|
||||
* 'type' => 'my-field-type',
|
||||
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
||||
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
||||
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
||||
* );
|
||||
* return $access_settings_fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
||||
array(
|
||||
'id' => '_um_custom_access_settings',
|
||||
@@ -649,6 +726,35 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
)
|
||||
) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_role_metaboxes
|
||||
* @description Extend metaboxes at Add/Edit User Role
|
||||
* @input_vars
|
||||
* [{"var":"$roles_metaboxes","type":"array","desc":"Metaboxes at Add/Edit UM Role"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_role_metaboxes', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_role_metaboxes', 'my_admin_role_metaboxes', 10, 1 );
|
||||
* function my_admin_role_metaboxes( $roles_metaboxes ) {
|
||||
* // your code here
|
||||
* $roles_metaboxes[] = array(
|
||||
* 'id' => 'um-admin-form-your-custom',
|
||||
* 'title' => __( 'My Roles Metabox', 'ultimate-member' ),
|
||||
* 'callback' => 'my-metabox-callback',
|
||||
* 'screen' => 'um_role_meta',
|
||||
* 'context' => 'side',
|
||||
* 'priority' => 'default'
|
||||
* );
|
||||
*
|
||||
* return $roles_metaboxes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$roles_metaboxes = apply_filters( 'um_admin_role_metaboxes', $roles_metaboxes );
|
||||
|
||||
$wp_caps_metabox = false;
|
||||
@@ -959,8 +1065,31 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
|
||||
<?php foreach( UM()->builtin()->validation_types() as $key => $name ) { ?>
|
||||
<?php
|
||||
$continue = apply_filters("um_builtin_validation_types_continue_loop", true, $key, $form_id, $field_args );
|
||||
if( $continue ){ ?>
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_builtin_validation_types_continue_loop
|
||||
* @description Builtin Validation Types
|
||||
* @input_vars
|
||||
* [{"var":"$continue","type":"bool","desc":"Validate?"},
|
||||
* {"var":"$key","type":"string","desc":"Field Key"},
|
||||
* {"var":"$form_id","type":"int","desc":"Form ID"},
|
||||
* {"var":"$field_args","type":"array","desc":"Field Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_builtin_validation_types_continue_loop', 'function_name', 10, 4 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_builtin_validation_types_continue_loop', 'my_builtin_validation_types', 10, 4 );
|
||||
* function my_builtin_validation_types( $continue, $key, $form_id, $field_args ) {
|
||||
* // your code here
|
||||
* return $continue;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$continue = apply_filters( "um_builtin_validation_types_continue_loop", true, $key, $form_id, $field_args );
|
||||
if ( $continue ) { ?>
|
||||
<option value="<?php echo $key; ?>" <?php selected( $key, $this->edit_mode_value ); ?>><?php echo $name; ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
@@ -73,7 +73,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
|
||||
foreach ( $core_pages as $page_s => $page ) {
|
||||
$have_pages = UM()->query()->wp_pages();
|
||||
$page_id = apply_filters( 'um_core_page_id_filter', 'core_' . $page_s );
|
||||
$page_id = UM()->options()->get_core_page_id( $page_s );
|
||||
|
||||
$page_title = ! empty( $page['title'] ) ? $page['title'] : '';
|
||||
|
||||
@@ -188,6 +188,26 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_settings_structure
|
||||
* @description Extend UM Settings
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"UM Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_settings_structure', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_settings_structure', 'my_settings_structure', 10, 1 );
|
||||
* function my_settings_structure( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->settings_structure = apply_filters( 'um_settings_structure', array(
|
||||
'' => array(
|
||||
'title' => __( 'General', 'ultimate-member' ),
|
||||
@@ -1101,7 +1121,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) );
|
||||
}
|
||||
|
||||
echo '<div id="um-settings-wrap" class="wrap"><h2>Ultimate Member - Settings</h2>';
|
||||
echo '<div id="um-settings-wrap" class="wrap"><h2>' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . '</h2>';
|
||||
|
||||
echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
|
||||
|
||||
@@ -1111,7 +1131,32 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
||||
|
||||
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
||||
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', $this->render_settings_section( $section_fields, $current_tab, $current_subtab ), $section_fields );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
||||
* @description Render settings section
|
||||
* @input_vars
|
||||
* [{"var":"$content","type":"string","desc":"Section content"},
|
||||
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
||||
* function my_settings_section( $content ) {
|
||||
* // your code here
|
||||
* return $content;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
||||
$this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
|
||||
$section_fields
|
||||
);
|
||||
|
||||
} else { ?>
|
||||
|
||||
@@ -1129,7 +1174,32 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
<?php do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
||||
|
||||
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
||||
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', $this->render_settings_section( $section_fields, $current_tab, $current_subtab ), $section_fields );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
||||
* @description Render settings section
|
||||
* @input_vars
|
||||
* [{"var":"$content","type":"string","desc":"Section content"},
|
||||
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
||||
* function my_settings_section( $content ) {
|
||||
* // your code here
|
||||
* return $content;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
||||
$this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
|
||||
$section_fields
|
||||
);
|
||||
?>
|
||||
|
||||
<p class="submit">
|
||||
@@ -1180,6 +1250,26 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_generate_tabs_menu_{$page}
|
||||
* @description Generate tabs menu
|
||||
* @input_vars
|
||||
* [{"var":"$tabs","type":"array","desc":"UM menu tabs"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_generate_tabs_menu_{$page}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_generate_tabs_menu_{$page}', 'my_tabs_menu', 10, 1 );
|
||||
* function my_tabs_menu( $tabs ) {
|
||||
* // your code here
|
||||
* return $tabs;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$tabs = apply_filters( 'um_generate_tabs_menu_' . $page, $tabs );
|
||||
break;
|
||||
}
|
||||
@@ -1222,6 +1312,26 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
|
||||
do_action( "um_settings_before_save" );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_change_settings_before_save
|
||||
* @description Change settings before save
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"UM Settings on save"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_change_settings_before_save', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_change_settings_before_save', 'my_change_settings_before_save', 10, 1 );
|
||||
* function my_change_settings_before_save( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$settings = apply_filters( 'um_change_settings_before_save', $_POST['um_options'] );
|
||||
|
||||
foreach ( $settings as $key => $value ) {
|
||||
@@ -1473,6 +1583,27 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
|
||||
|
||||
$in_theme = UM()->mail()->template_in_theme( $email_key );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_settings_email_section_fields
|
||||
* @description Extend UM Email Settings
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"UM Email Settings"},
|
||||
* {"var":"$email_key","type":"string","desc":"Email Key"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_settings_email_section_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_settings_email_section_fields', 'my_admin_settings_email_section', 10, 2 );
|
||||
* function my_admin_settings_email_section( $settings, $email_key ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$section_fields = apply_filters( 'um_admin_settings_email_section_fields', array(
|
||||
array(
|
||||
'id' => 'um_email_template',
|
||||
|
||||
@@ -56,6 +56,29 @@ if ( ! class_exists( 'Admin_Users' ) ) {
|
||||
*/
|
||||
function get_bulk_admin_actions() {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_bulk_user_actions_hook
|
||||
* @description Admin Users List Table bulk actions
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"User List Table bulk actions"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_bulk_user_actions_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_bulk_user_actions_hook', 'my_admin_bulk_user_actions', 10, 1 );
|
||||
* function my_admin_bulk_user_actions( $actions ) {
|
||||
* // your code here
|
||||
* $actions['my-custom-bulk'] = array(
|
||||
* 'label' => 'My Custom Bulk Action'
|
||||
* );
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters( 'um_admin_bulk_user_actions_hook', array(
|
||||
'um_approve_membership' => array(
|
||||
'label' => __( 'Approve Membership', 'ultimate-member' )
|
||||
@@ -101,6 +124,27 @@ if ( ! class_exists( 'Admin_Users' ) ) {
|
||||
if ( ! empty( $submitted ) )
|
||||
$actions['view_info'] = '<a href="#" data-modal="UM_preview_registration" data-modal-size="smaller" data-dynamic-content="um_admin_review_registration" data-arg1="' . $user_id . '" data-arg2="edit_registration">' . __( 'Info', 'ultimate-member' ) . '</a>';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_user_row_actions
|
||||
* @description Admin views array
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"User List Table actions"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_user_row_actions', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_user_row_actions', 'my_admin_user_row_actions', 10, 2 );
|
||||
* function my_admin_user_row_actions( $actions, $user_id ) {
|
||||
* // your code here
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
|
||||
|
||||
return $actions;
|
||||
@@ -202,6 +246,26 @@ if ( ! class_exists( 'Admin_Users' ) ) {
|
||||
$views[$k] = '<a href="' . admin_url( 'users.php' ) . '?status=' . $k . '" ' . $current . '>'. $v . ' <span class="count">('.UM()->query()->count_users_by_status( $k ).')</span></a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_views_users
|
||||
* @description Admin views array
|
||||
* @input_vars
|
||||
* [{"var":"$views","type":"array","desc":"User Views"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_views_users', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_views_users', 'my_admin_views_users', 10, 1 );
|
||||
* function my_admin_views_users( $views ) {
|
||||
* // your code here
|
||||
* return $views;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$views = apply_filters( 'um_admin_views_users', $views );
|
||||
|
||||
// remove all filters
|
||||
|
||||
@@ -172,6 +172,27 @@ $ListTable = new UM_Emails_List_Table( array(
|
||||
$per_page = 20;
|
||||
$paged = $ListTable->get_pagenum();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_templates_columns
|
||||
* @description Email Notifications List Table columns
|
||||
* @input_vars
|
||||
* [{"var":"$columns","type":"array","desc":"Columns"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_email_templates_columns', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_templates_columns', 'my_email_templates_columns', 10, 1 );
|
||||
* function my_email_templates_columns( $columns ) {
|
||||
* // your code here
|
||||
* $columns['my-custom-column'] = 'My Custom Column';
|
||||
* return $columns;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$columns = apply_filters( 'um_email_templates_columns', array(
|
||||
'email' => __( 'Email', 'ultimate-member' ),
|
||||
'recipients' => __( 'Recipient(s)', 'ultimate-member' ),
|
||||
|
||||
@@ -41,11 +41,36 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
*** @Some fields may require extra fields before saving
|
||||
***/
|
||||
add_filter('um_admin_pre_save_fields_hook', 'um_admin_pre_save_fields_hook', 1 );
|
||||
function um_admin_pre_save_fields_hook( $array ){
|
||||
function um_admin_pre_save_fields_hook( $array ) {
|
||||
extract( $array );
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
$fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_fields_without_metakey
|
||||
* @description Field Types without meta key
|
||||
* @input_vars
|
||||
* [{"var":"$types","type":"array","desc":"Field Types"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
|
||||
* function my_fields_without_metakey( $types ) {
|
||||
* // your code here
|
||||
* return $types;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', array(
|
||||
'block',
|
||||
'shortcode',
|
||||
'spacing',
|
||||
'divider',
|
||||
'group'
|
||||
) );
|
||||
|
||||
$fields = UM()->query()->get_attr('custom_fields', $form_id);
|
||||
$count = 1;
|
||||
|
||||
@@ -18,6 +18,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_access_settings_fields
|
||||
* @description Extend Admin Access Settings Fields
|
||||
* @input_vars
|
||||
* [{"var":"$fields","type":"array","desc":"Access Settings Fields"},
|
||||
* {"var":"$data","type":"array","desc":"Form Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_access_settings_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_access_settings_fields', 'my_admin_access_settings_fields', 10, 2 );
|
||||
* function my_admin_access_settings_fields( $fields, $data ) {
|
||||
* // your code here
|
||||
* return $fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields = apply_filters( 'um_admin_access_settings_fields', array(
|
||||
array(
|
||||
'id' => '_um_custom_access_settings',
|
||||
|
||||
@@ -21,7 +21,39 @@ if ( $show_these_users ) {
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $fields = array(
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_directory_sort_users_select
|
||||
* @description Extend Sort Types for Member Directory
|
||||
* @input_vars
|
||||
* [{"var":"$sort_types","type":"array","desc":"Sort Types"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_directory_sort_users_select', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_directory_sort_users_select', 'my_directory_sort_users_select', 10, 1 );
|
||||
* function my_directory_sort_users_select( $sort_types ) {
|
||||
* // your code here
|
||||
* return $sort_types;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$sort_options = apply_filters( 'um_admin_directory_sort_users_select', array(
|
||||
'user_registered_desc' => __( 'New users first', 'ultimate-member' ),
|
||||
'user_registered_asc' => __( 'Old users first', 'ultimate-member' ),
|
||||
'last_login' => __( 'Last login', 'ultimate-member' ),
|
||||
'display_name' => __( 'Display Name', 'ultimate-member' ),
|
||||
'first_name' => __( 'First Name', 'ultimate-member' ),
|
||||
'last_name' => __( 'Last Name', 'ultimate-member' ),
|
||||
'random' => __( 'Random', 'ultimate-member' ),
|
||||
'other' => __( 'Other (custom field)', 'ultimate-member' ),
|
||||
) );
|
||||
|
||||
$fields = array(
|
||||
array(
|
||||
'id' => '_um_mode',
|
||||
'type' => 'hidden',
|
||||
@@ -54,16 +86,7 @@ if ( $show_these_users ) {
|
||||
'type' => 'select',
|
||||
'label' => __( 'Sort users by', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Sort users by a specific parameter in the directory', 'ultimate-member' ),
|
||||
'options' => apply_filters( 'um_admin_directory_sort_users_select', array(
|
||||
'user_registered_desc' => __( 'New users first', 'ultimate-member' ),
|
||||
'user_registered_asc' => __( 'Old users first', 'ultimate-member' ),
|
||||
'last_login' => __( 'Last login', 'ultimate-member' ),
|
||||
'display_name' => __( 'Display Name', 'ultimate-member' ),
|
||||
'first_name' => __( 'First Name', 'ultimate-member' ),
|
||||
'last_name' => __( 'Last Name', 'ultimate-member' ),
|
||||
'random' => __( 'Random', 'ultimate-member' ),
|
||||
'other' => __( 'Other (custom field)', 'ultimate-member' ),
|
||||
) ),
|
||||
'options' => $sort_options,
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby' ),
|
||||
),
|
||||
array(
|
||||
@@ -82,6 +105,26 @@ if ( $show_these_users ) {
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_extend_directory_options_general
|
||||
* @description Extend Directory options fields
|
||||
* @input_vars
|
||||
* [{"var":"$fields","type":"array","desc":"Directory options fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_directory_sort_users_select', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_directory_sort_users_select', 'my_directory_sort_users_select', 10, 1 );
|
||||
* function my_directory_sort_users_select( $sort_types ) {
|
||||
* // your code here
|
||||
* return $sort_types;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields = apply_filters( 'um_admin_extend_directory_options_general', $fields );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
|
||||
@@ -7,6 +7,27 @@
|
||||
$can_search_array[] = $_um_roles_can_search;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_custom_search_filters
|
||||
* @description Custom Search Filters
|
||||
* @input_vars
|
||||
* [{"var":"$custom_search","type":"array","desc":"Filters"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_admin_custom_search_filters', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_custom_search_filters', 'my_admin_custom_search_filters', 10, 1 );
|
||||
* function my_upload_file_name( $custom_search ) {
|
||||
* // your code here
|
||||
* return $custom_search;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$custom_search = apply_filters( 'um_admin_custom_search_filters', array() );
|
||||
$searchable_fields = UM()->builtin()->all_user_fields('date,time,url');
|
||||
$searchable_fields = $searchable_fields + $custom_search;
|
||||
|
||||
+114
-15
@@ -31,6 +31,29 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'members',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_pages
|
||||
* @description Extend UM core pages
|
||||
* @input_vars
|
||||
* [{"var":"$pages","type":"array","desc":"UM core pages"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_core_pages', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_pages', 'my_core_pages', 10, 1 );
|
||||
* function my_core_pages( $pages ) {
|
||||
* // your code here
|
||||
* $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) );
|
||||
* return $pages;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->core_pages = apply_filters( 'um_core_pages', array(
|
||||
'user' => array( 'title' => __( 'User', 'ultimate-member' ) ),
|
||||
'login' => array( 'title' => __( 'Login', 'ultimate-member' ) ),
|
||||
@@ -84,6 +107,29 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'_um_secondary_color',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_form_meta_all
|
||||
* @description Extend UM forms meta keys
|
||||
* @input_vars
|
||||
* [{"var":"$meta","type":"array","desc":"UM forms meta"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_core_form_meta_all', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_form_meta_all', 'my_core_form_meta', 10, 1 );
|
||||
* function my_core_form_meta( $meta ) {
|
||||
* // your code here
|
||||
* $meta['my_meta_key'] = 'my_meta_value';
|
||||
* return $meta;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', array(
|
||||
'_um_profile_show_name' => 1,
|
||||
'_um_profile_show_social_links' => 0,
|
||||
@@ -152,6 +198,38 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'_um_profile_use_custom_settings' => 0,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_notifications
|
||||
* @description Extend UM email notifications
|
||||
* @input_vars
|
||||
* [{"var":"$emails","type":"array","desc":"UM email notifications"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_notifications', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_notifications', 'my_email_notifications', 10, 1 );
|
||||
* function my_email_notifications( $emails ) {
|
||||
* // your code here
|
||||
* $emails['my_email'] = array(
|
||||
* 'key' => 'my_email',
|
||||
* 'title' => __( 'my_email_title','ultimate-member' ),
|
||||
* 'subject' => 'my_email_subject',
|
||||
* 'body' => 'my_email_body',
|
||||
* 'description' => 'my_email_description',
|
||||
* 'recipient' => 'user', // set 'admin' for make administrator as recipient
|
||||
* 'default_active' => true // can be false for make disabled by default
|
||||
* );
|
||||
*
|
||||
* return $emails;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->email_notifications = apply_filters( 'um_email_notifications', array(
|
||||
'welcome_email' => array(
|
||||
'key' => 'welcome_email',
|
||||
@@ -384,16 +462,37 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
$this->settings_defaults[$key] = $notification['body'];
|
||||
}
|
||||
|
||||
foreach ( $this->core_pages as $page_s => $page ) {
|
||||
$page_id = apply_filters( 'um_core_page_id_filter', 'core_' . $page_s );
|
||||
$this->settings_defaults[$page_id] = '';
|
||||
}
|
||||
foreach ( $this->core_pages as $page_s => $page ) {
|
||||
$page_id = UM()->options()->get_core_page_id( $page_s );
|
||||
$this->settings_defaults[ $page_id ] = '';
|
||||
}
|
||||
|
||||
foreach( $this->core_form_meta_all as $key => $value ) {
|
||||
$this->settings_defaults[ str_replace( '_um_', '', $key ) ] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_default_settings_values
|
||||
* @description Extend UM default settings
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"UM default settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_default_settings_values', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_default_settings_values', 'my_default_settings_values', 10, 1 );
|
||||
* function my_default_settings_values( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->settings_defaults = apply_filters( 'um_default_settings_values', $this->settings_defaults );
|
||||
|
||||
$this->permalinks = $this->get_core_pages();
|
||||
@@ -523,19 +622,19 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function get_core_pages() {
|
||||
$permalink = array();
|
||||
$core_pages = array_keys( $this->core_pages );
|
||||
if ( empty( $core_pages ) )
|
||||
return $permalink;
|
||||
function get_core_pages() {
|
||||
$permalink = array();
|
||||
$core_pages = array_keys( $this->core_pages );
|
||||
if ( empty( $core_pages ) )
|
||||
return $permalink;
|
||||
|
||||
foreach ( $core_pages as $page_key ) {
|
||||
$page_option_key = apply_filters( 'um_core_page_id_filter', 'core_' . $page_key );
|
||||
$permalink[$page_key] = UM()->options()->get( $page_option_key );
|
||||
}
|
||||
foreach ( $core_pages as $page_key ) {
|
||||
$page_option_key = UM()->options()->get_core_page_id( $page_key );
|
||||
$permalink[ $page_key ] = UM()->options()->get( $page_option_key );
|
||||
}
|
||||
|
||||
return $permalink;
|
||||
}
|
||||
return $permalink;
|
||||
}
|
||||
//end class
|
||||
}
|
||||
}
|
||||
@@ -30,13 +30,13 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
'messaging' => '2.0.1',
|
||||
'mycred' => '2.0',
|
||||
'notices' => '2.0.1',
|
||||
'notifications' => '2.0',
|
||||
'notifications' => '2.0.1',
|
||||
'online' => '2.0',
|
||||
'private-content' => '2.0',
|
||||
'profile-completeness' => '2.0.1',
|
||||
'recaptcha' => '2.0',
|
||||
'reviews' => '2.0.1',
|
||||
'social-activity' => '2.0',
|
||||
'social-activity' => '2.0.1',
|
||||
'social-login' => '2.0.1',
|
||||
'terms-conditions' => '2.0',
|
||||
'user-location' => '2.0',
|
||||
|
||||
@@ -142,6 +142,27 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
'post_format',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_excluded_taxonomies
|
||||
* @description Exclude taxonomies for UM
|
||||
* @input_vars
|
||||
* [{"var":"$taxes","type":"array","desc":"Taxonomies keys"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_excluded_taxonomies', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_excluded_taxonomies', 'my_excluded_taxonomies', 10, 1 );
|
||||
* function my_excluded_taxonomies( $taxes ) {
|
||||
* // your code here
|
||||
* return $taxes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_excluded_taxonomies', $taxes );
|
||||
}
|
||||
|
||||
@@ -174,11 +195,81 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_template
|
||||
* @description Change template location
|
||||
* @input_vars
|
||||
* [{"var":"$located","type":"string","desc":"template Located"},
|
||||
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
||||
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
||||
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_get_template', 'function_name', 10, 4 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_template', 'my_get_template', 10, 4 );
|
||||
* function my_get_template( $located, $template_name, $path, $t_args ) {
|
||||
* // your code here
|
||||
* return $located;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$located = apply_filters( 'um_get_template', $located, $template_name, $path, $t_args );
|
||||
|
||||
ob_start();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_before_template_part
|
||||
* @description Make some action before include template file
|
||||
* @input_vars
|
||||
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
||||
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
||||
* {"var":"$located","type":"string","desc":"template Located"},
|
||||
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_before_template_part', 'function_name', 10, 4 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_before_template_part', 'my_before_template_part', 10, 4 );
|
||||
* function my_before_template_part( $template_name, $path, $located, $t_args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_before_template_part', $template_name, $path, $located, $t_args );
|
||||
include( $located );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title my_after_template_part
|
||||
* @description Make some action after include template file
|
||||
* @input_vars
|
||||
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
||||
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
||||
* {"var":"$located","type":"string","desc":"template Located"},
|
||||
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_template_part', 'function_name', 10, 4 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_template_part', 'my_after_template_part', 10, 4 );
|
||||
* function my_after_template_part( $template_name, $path, $located, $t_args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_template_part', $template_name, $path, $located, $t_args );
|
||||
$html = ob_get_clean();
|
||||
|
||||
@@ -213,7 +304,30 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
}
|
||||
$template .= 'templates/' . $template_name;
|
||||
}
|
||||
// Return what we found.
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_locate_template
|
||||
* @description Change template locate
|
||||
* @input_vars
|
||||
* [{"var":"$template","type":"string","desc":"Template locate"},
|
||||
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
||||
* {"var":"$path","type":"string","desc":"Template Path at server"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_locate_template', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_locate_template', 'my_locate_template', 10, 3 );
|
||||
* function my_locate_template( $template, $template_name, $path ) {
|
||||
* // your code here
|
||||
* return $template;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_locate_template', $template, $template_name, $path );
|
||||
}
|
||||
|
||||
|
||||
+87
-3
@@ -89,8 +89,30 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
*/
|
||||
public function __call( $name, array $params ) {
|
||||
|
||||
if ( empty( $this->classes[ $name ] ) )
|
||||
$this->classes[ $name ] = apply_filters( 'um_call_object_' . $name, false );
|
||||
if ( empty( $this->classes[ $name ] ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_call_object_{$class_name}
|
||||
* @description Extend call classes of Extensions for use UM()->class_name()->method|function
|
||||
* @input_vars
|
||||
* [{"var":"$class","type":"object","desc":"Class Instance"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_call_object_{$class_name}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_call_object_{$class_name}', 'my_extension_class', 10, 1 );
|
||||
* function my_extension_class( $class ) {
|
||||
* // your code here
|
||||
* return $class;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->classes[ $name ] = apply_filters( 'um_call_object_' . $name, false );
|
||||
}
|
||||
|
||||
return $this->classes[ $name ];
|
||||
|
||||
@@ -172,13 +194,75 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
'ar' => 'العربية',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_textdomain
|
||||
* @description Change UM textdomain
|
||||
* @input_vars
|
||||
* [{"var":"$domain","type":"string","desc":"UM Textdomain"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_textdomain', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_textdomain', 'my_textdomain', 10, 1 );
|
||||
* function my_textdomain( $domain ) {
|
||||
* // your code here
|
||||
* return $domain;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$language_domain = apply_filters( 'um_language_textdomain', 'ultimate-member' );
|
||||
|
||||
$language_locale = ( get_locale() != '' ) ? get_locale() : 'en_US';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_locale
|
||||
* @description Change UM language locale
|
||||
* @input_vars
|
||||
* [{"var":"$locale","type":"string","desc":"UM language locale"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_locale', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_locale', 'my_language_locale', 10, 1 );
|
||||
* function my_language_locale( $locale ) {
|
||||
* // your code here
|
||||
* return $locale;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$language_locale = apply_filters( 'um_language_locale', $language_locale );
|
||||
|
||||
$language_file = WP_LANG_DIR . '/plugins/' . $language_domain . '-' . $language_locale . '.mo';
|
||||
$language_file = apply_filters( 'um_language_file', $language_file );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_file
|
||||
* @description Change UM language file path
|
||||
* @input_vars
|
||||
* [{"var":"$language_file","type":"string","desc":"UM language file path"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_file', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_file', 'my_language_file', 10, 1 );
|
||||
* function my_language_file( $language_file ) {
|
||||
* // your code here
|
||||
* return $language_file;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$language_file = apply_filters( 'um_language_file', $language_file );
|
||||
|
||||
load_textdomain( $language_domain, $language_file );
|
||||
|
||||
|
||||
@@ -64,6 +64,37 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $restriction
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function um_custom_restriction( $restriction ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_restriction
|
||||
* @description Extend Sort Types for Member Directory
|
||||
* @input_vars
|
||||
* [{"var":"$custom_restriction","type":"bool","desc":"Custom Restriction"},
|
||||
* {"var":"$restriction","type":"array","desc":"Restriction settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_custom_restriction', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_restriction', 'my_custom_restriction', 10, 2 );
|
||||
* function my_directory_sort_users_select( $custom_restriction, $restriction ) {
|
||||
* // your code here
|
||||
* return $custom_restriction;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check individual term Content Restriction settings
|
||||
*/
|
||||
@@ -126,7 +157,7 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
//if post for logged in users and user is not logged in
|
||||
if ( is_user_logged_in() ) {
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
$custom_restrict = $this->um_custom_restriction( $restriction );
|
||||
|
||||
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
@@ -351,8 +382,29 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
*/
|
||||
function set_referer( $url, $referer ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_access_enable_referer
|
||||
* @description Access Referrer Enable/Disable
|
||||
* @input_vars
|
||||
* [{"var":"$referrer","type":"bool","desc":"Access referrer"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_access_enable_referer', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_access_enable_referer', 'my_access_enable_referer', 10, 1 );
|
||||
* function my_access_enable_referer( $referrer ) {
|
||||
* // your code here
|
||||
* return $referrer;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$enable_referer = apply_filters( "um_access_enable_referer", false );
|
||||
if( ! $enable_referer ) return $url;
|
||||
if ( ! $enable_referer )
|
||||
return $url;
|
||||
|
||||
$url = add_query_arg( 'um_ref', $referer, $url );
|
||||
return $url;
|
||||
@@ -560,7 +612,7 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
$custom_restrict = $this->um_custom_restriction( $restriction );
|
||||
|
||||
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
@@ -774,7 +826,7 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
//if post for logged in users and user is not logged in
|
||||
if ( is_user_logged_in() ) {
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
$custom_restrict = $this->um_custom_restriction( $restriction );
|
||||
|
||||
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
|
||||
+199
-15
@@ -94,6 +94,26 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_page_default_tabs_hook
|
||||
* @description Account Page Tabs
|
||||
* @input_vars
|
||||
* [{"var":"$tabs","type":"array","desc":"Account Page Tabs"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_page_default_tabs_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_page_default_tabs_hook', 'my_account_page_default_tabs', 10, 1 );
|
||||
* function my_account_page_default_tabs( $tabs ) {
|
||||
* // your code here
|
||||
* return $tabs;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_account_page_default_tabs_hook', $tabs );
|
||||
}
|
||||
|
||||
@@ -116,6 +136,26 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
);
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_shortcode_args_filter
|
||||
* @description Account Shortcode Arguments
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_shortcode_args_filter', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_shortcode_args_filter', 'my_account_shortcode_args', 10, 1 );
|
||||
* function my_account_shortcode_args( $args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_account_shortcode_args_filter', $args );
|
||||
|
||||
if ( ! empty( $args['tab'] ) ) {
|
||||
@@ -265,8 +305,8 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
function filter_fields_by_attrs( $fields, $shortcode_args ) {
|
||||
|
||||
foreach ( $fields as $k => $field ) {
|
||||
if ( isset( $shortcode_args[$field['metakey']] ) && 0 == $shortcode_args[$field['metakey']] )
|
||||
unset( $fields[$k] );
|
||||
if ( isset( $shortcode_args[ $field['metakey'] ] ) && 0 == $shortcode_args[ $field['metakey'] ] )
|
||||
unset( $fields[ $k ] );
|
||||
}
|
||||
|
||||
return $fields;
|
||||
@@ -274,6 +314,33 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function account_secure_fields( $fields, $id ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_secure_fields
|
||||
* @description Change Account secure fields
|
||||
* @input_vars
|
||||
* [{"var":"$fields","type":"array","desc":"Account Fields"},
|
||||
* {"var":"$id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_secure_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_secure_fields', 'my_account_secure_fields', 10, 2 );
|
||||
* function my_account_secure_fields( $fields, $id ) {
|
||||
* // your code here
|
||||
* return $fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* * Get Tab Output
|
||||
*
|
||||
@@ -296,12 +363,31 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
case 'privacy':
|
||||
|
||||
$args = 'profile_privacy,hide_in_members';
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_tab_privacy_fields
|
||||
* @description Extend Account Tab Privacy
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Account Arguments"},
|
||||
* {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_tab_privacy_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_tab_privacy_fields', 'my_account_tab_privacy_fields', 10, 2 );
|
||||
* function my_account_tab_privacy_fields( $args, $shortcode_args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
|
||||
|
||||
$fields = UM()->builtin()->get_specific_fields( $args );
|
||||
|
||||
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
|
||||
|
||||
$fields = $this->account_secure_fields( $fields, $id );
|
||||
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
||||
|
||||
foreach ( $fields as $key => $data ){
|
||||
@@ -314,12 +400,31 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
|
||||
$args = 'single_user_password';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_tab_delete_fields
|
||||
* @description Extend Account Tab Delete
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Account Arguments"},
|
||||
* {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_tab_delete_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_tab_delete_fields', 'my_account_tab_delete_fields', 10, 2 );
|
||||
* function my_account_tab_delete_fields( $args, $shortcode_args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_account_tab_delete_fields', $args, $shortcode_args );
|
||||
|
||||
$fields = UM()->builtin()->get_specific_fields( $args );
|
||||
|
||||
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
|
||||
|
||||
$fields = $this->account_secure_fields( $fields, $id );
|
||||
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
||||
|
||||
foreach ( $fields as $key => $data ) {
|
||||
@@ -340,12 +445,31 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
$args = str_replace(',user_email','', $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_tab_general_fields
|
||||
* @description Extend Account Tab General
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Account Arguments"},
|
||||
* {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_tab_general_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_tab_general_fields', 'my_account_tab_general_fields', 10, 2 );
|
||||
* function my_account_tab_general_fields( $args, $shortcode_args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_account_tab_general_fields', $args, $shortcode_args );
|
||||
|
||||
$fields = UM()->builtin()->get_specific_fields( $args );
|
||||
|
||||
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
|
||||
|
||||
$fields = $this->account_secure_fields( $fields, $id );
|
||||
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
||||
|
||||
foreach ( $fields as $key => $data ) {
|
||||
@@ -358,12 +482,31 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
|
||||
$args = 'user_password';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_tab_password_fields
|
||||
* @description Extend Account Tab Password
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Account Arguments"},
|
||||
* {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_tab_password_fields', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_tab_password_fields', 'my_account_tab_password_fields', 10, 2 );
|
||||
* function my_account_tab_password_fields( $args, $shortcode_args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_account_tab_password_fields', $args, $shortcode_args );
|
||||
|
||||
$fields = UM()->builtin()->get_specific_fields( $args );
|
||||
|
||||
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
|
||||
|
||||
$fields = $this->account_secure_fields( $fields, $id );
|
||||
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
||||
|
||||
foreach ( $fields as $key => $data ) {
|
||||
@@ -374,6 +517,27 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
|
||||
default :
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_content_hook_{$id}
|
||||
* @description Change not default Account tabs content
|
||||
* @input_vars
|
||||
* [{"var":"$output","type":"string","desc":"Account Tab Output"},
|
||||
* {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_account_content_hook_{$id}', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_content_hook_{$id}', 'my_account_content', 10, 2 );
|
||||
* function my_account_tab_password_fields( $args, $shortcode_args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$output = apply_filters( "um_account_content_hook_{$id}", $output, $shortcode_args );
|
||||
break;
|
||||
|
||||
@@ -448,7 +612,27 @@ if ( ! class_exists( 'Account' ) ) {
|
||||
$classes .= ' um-viewing';
|
||||
}
|
||||
|
||||
$classes = apply_filters('um_form_official_classes__hook', $classes);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_form_official_classes__hook
|
||||
* @description Change not default Account tabs content
|
||||
* @input_vars
|
||||
* [{"var":"$classes","type":"string","desc":"Form Classes"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_form_official_classes__hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_form_official_classes__hook', 'my_form_official_classes', 10, 1 );
|
||||
* function my_form_official_classes( $classes ) {
|
||||
* // your code here
|
||||
* return $classes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$classes = apply_filters( 'um_form_official_classes__hook', $classes );
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
||||
+130
-10
@@ -533,8 +533,27 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
|
||||
);
|
||||
|
||||
$this->core_fields = apply_filters('um_core_fields_hook', $this->core_fields );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_fields_hook
|
||||
* @description UM Core Fields
|
||||
* @input_vars
|
||||
* [{"var":"$core_fields","type":"array","desc":"Core Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_core_fields_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_fields_hook', 'my_core_fields', 10, 1 );
|
||||
* function my_core_fields( $core_fields ) {
|
||||
* // your code here
|
||||
* return $core_fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->core_fields = apply_filters( 'um_core_fields_hook', $this->core_fields );
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -556,7 +575,30 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
|
||||
$um_roles = UM()->roles()->get_roles( false, $exclude_roles );
|
||||
|
||||
$profile_privacy = apply_filters('um_profile_privacy_options', array( __('Everyone','ultimate-member'), __('Only me','ultimate-member') ) );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_privacy_options
|
||||
* @description Profile Privacy Options
|
||||
* @input_vars
|
||||
* [{"var":"$privacy_options","type":"array","desc":"Privacy Options"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_privacy_options', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_privacy_options', 'my_profile_privacy_options', 10, 1 );
|
||||
* function my_profile_privacy_options( $privacy_options ) {
|
||||
* // your code here
|
||||
* return $privacy_options;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$profile_privacy = apply_filters( 'um_profile_privacy_options', array(
|
||||
__( 'Everyone', 'ultimate-member' ),
|
||||
__( 'Only me', 'ultimate-member' )
|
||||
) );
|
||||
|
||||
$this->predefined_fields = array(
|
||||
|
||||
@@ -1050,8 +1092,27 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
|
||||
);
|
||||
|
||||
$this->predefined_fields = apply_filters('um_predefined_fields_hook', $this->predefined_fields );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_predefined_fields_hook
|
||||
* @description Extend Predefined Fields
|
||||
* @input_vars
|
||||
* [{"var":"$predefined_fields","type":"array","desc":"Predefined Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_predefined_fields_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_predefined_fields_hook', 'my_predefined_fields', 10, 1 );
|
||||
* function my_predefined_fields( $predefined_fields ) {
|
||||
* // your code here
|
||||
* return $predefined_fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->predefined_fields = apply_filters( 'um_predefined_fields_hook', $this->predefined_fields );
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -1087,7 +1148,28 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
remove_filter('um_fields_without_metakey', 'um_user_tags_requires_no_metakey');
|
||||
$fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_fields_without_metakey
|
||||
* @description Extend Fields without metakey
|
||||
* @input_vars
|
||||
* [{"var":"$fields","type":"array","desc":"Fields without metakey"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
|
||||
* function my_fields_without_metakey( $fields ) {
|
||||
* // your code here
|
||||
* return $fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
if ( !$show_all ) {
|
||||
$this->fields_dropdown = array('image','file','password','rating');
|
||||
@@ -1169,7 +1251,27 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
$array['youtube_url'] = __('YouTube Profile','ultimate-member');
|
||||
$array['custom'] = __('Custom Validation','ultimate-member');
|
||||
|
||||
$array = apply_filters('um_admin_field_validation_hook', $array );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_field_validation_hook
|
||||
* @description Extend validation types
|
||||
* @input_vars
|
||||
* [{"var":"$types","type":"array","desc":"Validation Types"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_admin_field_validation_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_field_validation_hook', 'my_admin_field_validation', 10, 1 );
|
||||
* function my_admin_field_validation( $types ) {
|
||||
* // your code here
|
||||
* return $types;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$array = apply_filters( 'um_admin_field_validation_hook', $array );
|
||||
return $array;
|
||||
}
|
||||
|
||||
@@ -1622,10 +1724,28 @@ if ( ! class_exists( 'Builtin' ) ) {
|
||||
|
||||
}
|
||||
|
||||
$array = apply_filters("um_{$data}_predefined_field_options", $array);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_{$data}_predefined_field_options
|
||||
* @description Extend Predefined Fields options. Where $data - field key.
|
||||
* @input_vars
|
||||
* [{"var":"$options","type":"array","desc":"Field's Options"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_{$data}_predefined_field_options', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_{$data}_predefined_field_options', 'my_predefined_field', 10, 1 );
|
||||
* function my_predefined_field( $options ) {
|
||||
* // your code here
|
||||
* return $options;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$array = apply_filters( "um_{$data}_predefined_field_options", $array );
|
||||
return $array;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,58 +5,113 @@ namespace um\core;
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Cron' ) ) {
|
||||
class Cron {
|
||||
/**
|
||||
* Class Cron
|
||||
* @package um\core
|
||||
*/
|
||||
class Cron {
|
||||
|
||||
public function __construct() {
|
||||
/**
|
||||
* Cron constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$um_cron = apply_filters('um_cron_disable', false );
|
||||
if( $um_cron ) return;
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_cron_disable
|
||||
* @description Make UM Cron Actions Enabled or Disabled
|
||||
* @input_vars
|
||||
* [{"var":"$cron_disable","type":"bool","desc":"Disable UM Cron?"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_cron_disable', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_cron_disable', 'my_cron_disable', 10, 1 );
|
||||
* function my_predefined_field( $cron_disable ) {
|
||||
* // your code here
|
||||
* return $cron_disable;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_cron = apply_filters( 'um_cron_disable', false );
|
||||
if ( $um_cron ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
|
||||
add_action( 'wp', array( $this, 'schedule_Events' ) );
|
||||
}
|
||||
add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
|
||||
add_action( 'wp', array( $this, 'schedule_Events' ) );
|
||||
}
|
||||
|
||||
public function add_schedules( $schedules = array() ) {
|
||||
|
||||
// Adds once weekly to the existing schedules.
|
||||
$schedules['weekly'] = array(
|
||||
'interval' => 604800,
|
||||
'display' => __( 'Once Weekly', 'ultimate-member' )
|
||||
);
|
||||
/**
|
||||
* @param array $schedules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_schedules( $schedules = array() ) {
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
// Adds once weekly to the existing schedules.
|
||||
$schedules['weekly'] = array(
|
||||
'interval' => 604800,
|
||||
'display' => __( 'Once Weekly', 'ultimate-member' )
|
||||
);
|
||||
|
||||
public function schedule_Events() {
|
||||
$this->weekly_events();
|
||||
$this->daily_events();
|
||||
$this->twicedaily_events();
|
||||
$this->hourly_events();
|
||||
}
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
private function weekly_events() {
|
||||
if ( ! wp_next_scheduled( 'um_weekly_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'um_weekly_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
private function daily_events() {
|
||||
if ( ! wp_next_scheduled( 'um_daily_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'daily', 'um_daily_scheduled_events' );
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function schedule_Events() {
|
||||
$this->weekly_events();
|
||||
$this->daily_events();
|
||||
$this->twicedaily_events();
|
||||
$this->hourly_events();
|
||||
}
|
||||
|
||||
private function twicedaily_events() {
|
||||
if ( ! wp_next_scheduled( 'um_twicedaily_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'um_twicedaily_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
private function hourly_events() {
|
||||
if ( ! wp_next_scheduled( 'um_hourly_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'um_hourly_scheduled_events' );
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function weekly_events() {
|
||||
if ( ! wp_next_scheduled( 'um_weekly_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'um_weekly_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function daily_events() {
|
||||
if ( ! wp_next_scheduled( 'um_daily_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'daily', 'um_daily_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function twicedaily_events() {
|
||||
if ( ! wp_next_scheduled( 'um_twicedaily_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'um_twicedaily_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function hourly_events() {
|
||||
if ( ! wp_next_scheduled( 'um_hourly_scheduled_events' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'um_hourly_scheduled_events' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,121 +5,190 @@ namespace um\core;
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Date_Time' ) ) {
|
||||
class Date_Time {
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Class Date_Time
|
||||
* @package um\core
|
||||
*/
|
||||
class Date_Time {
|
||||
|
||||
/***
|
||||
*** @Display time in specific format
|
||||
***/
|
||||
function get_time( $format ) {
|
||||
return current_time( $format );
|
||||
}
|
||||
/**
|
||||
* Date_Time constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
/***
|
||||
*** @Show a cool time difference between 2 timestamps
|
||||
***/
|
||||
function time_diff( $from, $to = '' ) {
|
||||
if ( empty( $to ) ) {
|
||||
$to = time();
|
||||
}
|
||||
$diff = (int) abs( $to - $from );
|
||||
if ( $diff < 60 ) {
|
||||
}
|
||||
|
||||
$since = __('just now','ultimate-member');
|
||||
|
||||
} elseif ( $diff < HOUR_IN_SECONDS ) {
|
||||
/**
|
||||
* Display time in specific format
|
||||
*
|
||||
* @param $format
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
function get_time( $format ) {
|
||||
return current_time( $format );
|
||||
}
|
||||
|
||||
$mins = round( $diff / MINUTE_IN_SECONDS );
|
||||
if ( $mins <= 1 )
|
||||
$mins = 1;
|
||||
if ( $mins == 1 ) {
|
||||
$since = sprintf( __('%s min','ultimate-member'), $mins );
|
||||
} else {
|
||||
$since = sprintf( __('%s mins','ultimate-member'), $mins );
|
||||
}
|
||||
|
||||
} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
|
||||
/**
|
||||
* Show a cool time difference between 2 timestamps
|
||||
*
|
||||
* @param $from
|
||||
* @param string $to
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
function time_diff( $from, $to = '' ) {
|
||||
$since = '';
|
||||
|
||||
$hours = round( $diff / HOUR_IN_SECONDS );
|
||||
if ( $hours <= 1 )
|
||||
$hours = 1;
|
||||
if ( $hours == 1 ) {
|
||||
$since = sprintf( __('%s hr','ultimate-member'), $hours );
|
||||
} else {
|
||||
$since = sprintf( __('%s hrs','ultimate-member'), $hours );
|
||||
}
|
||||
if ( empty( $to ) ) {
|
||||
$to = time();
|
||||
}
|
||||
|
||||
} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
|
||||
$diff = (int) abs( $to - $from );
|
||||
if ( $diff < 60 ) {
|
||||
|
||||
$days = round( $diff / DAY_IN_SECONDS );
|
||||
if ( $days <= 1 )
|
||||
$days = 1;
|
||||
if ( $days == 1 ) {
|
||||
$since = sprintf( __('Yesterday at %s','ultimate-member'), date('g:ia', $from ) );
|
||||
} else {
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
}
|
||||
$since = __('just now','ultimate-member');
|
||||
|
||||
} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
|
||||
} elseif ( $diff < HOUR_IN_SECONDS ) {
|
||||
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
$mins = round( $diff / MINUTE_IN_SECONDS );
|
||||
if ( $mins <= 1 )
|
||||
$mins = 1;
|
||||
if ( $mins == 1 ) {
|
||||
$since = sprintf( __('%s min','ultimate-member'), $mins );
|
||||
} else {
|
||||
$since = sprintf( __('%s mins','ultimate-member'), $mins );
|
||||
}
|
||||
|
||||
} elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
|
||||
} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
|
||||
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
$hours = round( $diff / HOUR_IN_SECONDS );
|
||||
if ( $hours <= 1 )
|
||||
$hours = 1;
|
||||
if ( $hours == 1 ) {
|
||||
$since = sprintf( __('%s hr','ultimate-member'), $hours );
|
||||
} else {
|
||||
$since = sprintf( __('%s hrs','ultimate-member'), $hours );
|
||||
}
|
||||
|
||||
} elseif ( $diff >= YEAR_IN_SECONDS ) {
|
||||
} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
|
||||
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date( 'F d, Y', $from ), date('g:ia', $from ) );
|
||||
$days = round( $diff / DAY_IN_SECONDS );
|
||||
if ( $days <= 1 )
|
||||
$days = 1;
|
||||
if ( $days == 1 ) {
|
||||
$since = sprintf( __('Yesterday at %s','ultimate-member'), date('g:ia', $from ) );
|
||||
} else {
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
}
|
||||
|
||||
}
|
||||
} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
|
||||
|
||||
return apply_filters( 'um_human_time_diff', $since, $diff, $from, $to );
|
||||
}
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
|
||||
/***
|
||||
*** @Get age
|
||||
***/
|
||||
function get_age($then) {
|
||||
if ( !$then ) return '';
|
||||
$then_ts = strtotime($then);
|
||||
$then_year = date('Y', $then_ts);
|
||||
$age = date('Y') - $then_year;
|
||||
if( strtotime('+' . $age . ' years', $then_ts) > current_time( 'timestamp' ) ) $age--;
|
||||
if ( $age == 1 )
|
||||
return sprintf(__('%s year old','ultimate-member'), $age );
|
||||
if ( $age > 1 )
|
||||
return sprintf(__('%s years old','ultimate-member'), $age );
|
||||
if ( $age == 0 )
|
||||
return __('Less than 1 year old','ultimate-member');
|
||||
}
|
||||
} elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
|
||||
|
||||
/***
|
||||
*** @Reformat dates
|
||||
***/
|
||||
function format($old, $new){
|
||||
$datetime = new \DateTime($old);
|
||||
$output = $datetime->format( $new );
|
||||
return $output;
|
||||
}
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date('F d', $from ), date('g:ia', $from ) );
|
||||
|
||||
/***
|
||||
*** @Get last 30 days as array
|
||||
***/
|
||||
function get_last_days($num = 30, $reverse = true) {
|
||||
$d = array();
|
||||
for($i = 0; $i < $num; $i++) {
|
||||
$d[ date('Y-m-d', strtotime('-'. $i .' days')) ] = date('m/d', strtotime('-'. $i .' days'));
|
||||
}
|
||||
if ($reverse == true){
|
||||
return array_reverse($d);
|
||||
} else {
|
||||
return $d;
|
||||
}
|
||||
}
|
||||
} elseif ( $diff >= YEAR_IN_SECONDS ) {
|
||||
|
||||
}
|
||||
$since = sprintf(__('%s at %s','ultimate-member'), date( 'F d, Y', $from ), date('g:ia', $from ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_human_time_diff
|
||||
* @description Change human time string
|
||||
* @input_vars
|
||||
* [{"var":"$since","type":"string","desc":"Disable UM Cron?"},
|
||||
* {"var":"$diff","type":"int","desc":"Difference in seconds"},
|
||||
* {"var":"$from","type":"int","desc":"From Timestamp"},
|
||||
* {"var":"$to","type":"int","desc":"To Timestamp"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_human_time_diff', 'function_name', 10, 4 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_human_time_diff', 'my_human_time_diff', 10, 4 );
|
||||
* function my_human_time_diff( $since, $diff, $from, $to ) {
|
||||
* // your code here
|
||||
* return $since;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_human_time_diff', $since, $diff, $from, $to );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get age
|
||||
*
|
||||
* @param $then
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_age( $then ) {
|
||||
if ( ! $then ) {
|
||||
return '';
|
||||
}
|
||||
$then_ts = strtotime( $then );
|
||||
$then_year = date( 'Y', $then_ts );
|
||||
$age = date( 'Y' ) - $then_year;
|
||||
if ( strtotime( '+' . $age . ' years', $then_ts ) > current_time( 'timestamp' ) ) {
|
||||
$age--;
|
||||
}
|
||||
if ( $age == 1 ) {
|
||||
return sprintf( __( '%s year old', 'ultimate-member' ), $age );
|
||||
}
|
||||
if ( $age > 1 ) {
|
||||
return sprintf( __( '%s years old', 'ultimate-member' ), $age );
|
||||
}
|
||||
if ( $age == 0 ) {
|
||||
return __( 'Less than 1 year old', 'ultimate-member' );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reformat dates
|
||||
*
|
||||
* @param $old
|
||||
* @param $new
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function format( $old, $new ) {
|
||||
$datetime = new \DateTime( $old );
|
||||
$output = $datetime->format( $new );
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get last 30 days as array
|
||||
*
|
||||
* @param int $num
|
||||
* @param bool $reverse
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_last_days( $num = 30, $reverse = true ) {
|
||||
$d = array();
|
||||
for ( $i = 0; $i < $num; $i++ ) {
|
||||
$d[ date('Y-m-d', strtotime( '-' . $i . ' days' ) ) ] = date( 'm/d', strtotime( '-' . $i . ' days' ) );
|
||||
}
|
||||
|
||||
return ( $reverse ) ? array_reverse( $d ) : $d;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+349
-277
@@ -5,394 +5,466 @@ namespace um\core;
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Enqueue' ) ) {
|
||||
class Enqueue {
|
||||
|
||||
var $suffix = '';
|
||||
|
||||
function __construct() {
|
||||
/**
|
||||
* Class Enqueue
|
||||
* @package um\core
|
||||
*/
|
||||
class Enqueue {
|
||||
|
||||
$priority = apply_filters( 'um_core_enqueue_priority', 100 );
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $suffix = '';
|
||||
|
||||
/**
|
||||
* Enqueue constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_enqueue_priority
|
||||
* @description Change Enqueue scripts priority
|
||||
* @input_vars
|
||||
* [{"var":"$priority","type":"int","desc":"Priority"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_core_enqueue_priority', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_enqueue_priority', 'my_core_enqueue_priority', 10, 1 );
|
||||
* function my_core_enqueue_priority( $priority ) {
|
||||
* // your code here
|
||||
* return $priority;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$priority = apply_filters( 'um_core_enqueue_priority', 100 );
|
||||
add_action( 'wp_enqueue_scripts', array( &$this, 'wp_enqueue_scripts' ), $priority );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Minify css string
|
||||
***/
|
||||
function minify( $css ) {
|
||||
$css = str_replace(array("\r", "\n"), '', $css);
|
||||
$css = str_replace(' {','{', $css );
|
||||
$css = str_replace('{ ','{', $css );
|
||||
$css = str_replace('; ',';', $css );
|
||||
$css = str_replace(';}','}', $css );
|
||||
$css = str_replace(': ',':', $css );
|
||||
return $css;
|
||||
}
|
||||
/**
|
||||
* Minify css string
|
||||
*
|
||||
* @param $css
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function minify( $css ) {
|
||||
$css = str_replace(array("\r", "\n"), '', $css);
|
||||
$css = str_replace(' {','{', $css );
|
||||
$css = str_replace('{ ','{', $css );
|
||||
$css = str_replace('; ',';', $css );
|
||||
$css = str_replace(';}','}', $css );
|
||||
$css = str_replace(': ',':', $css );
|
||||
return $css;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Enqueue scripts and styles
|
||||
***/
|
||||
function wp_enqueue_scripts() {
|
||||
global $post;
|
||||
|
||||
$this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined('UM_SCRIPT_DEBUG') ) ? '' : '.min';
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function wp_enqueue_scripts() {
|
||||
global $post;
|
||||
|
||||
$this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined('UM_SCRIPT_DEBUG') ) ? '' : '.min';
|
||||
|
||||
$exclude = UM()->options()->get('js_css_exclude');
|
||||
if ( is_array( $exclude ) ) {
|
||||
array_filter( $exclude );
|
||||
}
|
||||
if ( $exclude && !is_admin() && is_array( $exclude ) ) {
|
||||
|
||||
$c_url = UM()->permalinks()->get_current_url( get_option('permalink_structure') );
|
||||
|
||||
foreach( $exclude as $match ) {
|
||||
if ( ! empty( $c_url ) && strstr( $c_url, untrailingslashit( $match ) ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$exclude = UM()->options()->get('js_css_exclude');
|
||||
if ( is_array( $exclude ) ) {
|
||||
array_filter( $exclude );
|
||||
}
|
||||
if ( $exclude && !is_admin() && is_array( $exclude ) ) {
|
||||
|
||||
$c_url = UM()->permalinks()->get_current_url( get_option('permalink_structure') );
|
||||
|
||||
foreach( $exclude as $match ) {
|
||||
if ( ! empty( $c_url ) && strstr( $c_url, untrailingslashit( $match ) ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$include = UM()->options()->get('js_css_include');
|
||||
if ( is_array( $include ) ) {
|
||||
array_filter( $include );
|
||||
}
|
||||
if ( $include && !is_admin() && is_array( $include ) ) {
|
||||
|
||||
$c_url = UM()->permalinks()->get_current_url( get_option('permalink_structure') );
|
||||
|
||||
foreach( $include as $match ) {
|
||||
if ( strstr( $c_url, untrailingslashit( $match ) ) ) {
|
||||
$force_load = true;
|
||||
} else {
|
||||
if ( !isset( $force_load ) ) {
|
||||
$force_load = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( isset($force_load) && $force_load == false ) return;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_enqueue_localize_data
|
||||
* @description Extend UM localized data
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Localize Array"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_enqueue_localize_data', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_enqueue_localize_data', 'my_enqueue_localize_data', 10, 1 );
|
||||
* function my_enqueue_localize_data( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'fileupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_file_upload' ),
|
||||
'imageupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_image_upload' ),
|
||||
'remove_file' => UM()->get_ajax_route( 'um\core\Files', 'ajax_remove_file' ),
|
||||
'delete_profile_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_profile_photo' ),
|
||||
'delete_cover_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_cover_photo' ),
|
||||
'resize_image' => UM()->get_ajax_route( 'um\core\Files', 'ajax_resize_image' ),
|
||||
'muted_action' => UM()->get_ajax_route( 'um\core\Form', 'ajax_muted_action' ),
|
||||
'ajax_paginate' => UM()->get_ajax_route( 'um\core\Query', 'ajax_paginate' ),
|
||||
'ajax_select_options' => UM()->get_ajax_route( 'um\core\Form', 'ajax_select_options' ),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
$include = UM()->options()->get('js_css_include');
|
||||
if ( is_array( $include ) ) {
|
||||
array_filter( $include );
|
||||
}
|
||||
if ( $include && !is_admin() && is_array( $include ) ) {
|
||||
$this->load_original();
|
||||
wp_localize_script( 'um_scripts', 'um_scripts', $localize_data );
|
||||
|
||||
$c_url = UM()->permalinks()->get_current_url( get_option('permalink_structure') );
|
||||
// rtl style
|
||||
if ( is_rtl() ) {
|
||||
wp_register_style('um_rtl', um_url . 'assets/css/um.rtl.css', '', ultimatemember_version, 'all' );
|
||||
wp_enqueue_style('um_rtl');
|
||||
}
|
||||
|
||||
foreach( $include as $match ) {
|
||||
if ( strstr( $c_url, untrailingslashit( $match ) ) ) {
|
||||
$force_load = true;
|
||||
} else {
|
||||
if ( !isset( $force_load ) ) {
|
||||
$force_load = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', '', ultimatemember_version, true );
|
||||
wp_enqueue_script('um_datetime_locale');
|
||||
}
|
||||
|
||||
}
|
||||
if(is_object($post) && has_shortcode($post->post_content,'ultimate-member')) {
|
||||
wp_dequeue_script('jquery-form');
|
||||
}
|
||||
|
||||
if ( isset($force_load) && $force_load == false ) return;
|
||||
//old settings before UM 2.0 CSS
|
||||
wp_register_style('um_default_css', um_url . 'assets/css/um-old-default.css', '', ultimatemember_version, 'all' );
|
||||
wp_enqueue_style('um_default_css');
|
||||
|
||||
// enqueue styles
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'fileupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_file_upload' ),
|
||||
'imageupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_image_upload' ),
|
||||
'remove_file' => UM()->get_ajax_route( 'um\core\Files', 'ajax_remove_file' ),
|
||||
'delete_profile_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_profile_photo' ),
|
||||
'delete_cover_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_cover_photo' ),
|
||||
'resize_image' => UM()->get_ajax_route( 'um\core\Files', 'ajax_resize_image' ),
|
||||
'muted_action' => UM()->get_ajax_route( 'um\core\Form', 'ajax_muted_action' ),
|
||||
'ajax_paginate' => UM()->get_ajax_route( 'um\core\Query', 'ajax_paginate' ),
|
||||
'ajax_select_options' => UM()->get_ajax_route( 'um\core\Form', 'ajax_select_options' ),
|
||||
) );
|
||||
$uploads = wp_upload_dir();
|
||||
$upload_dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . 'ultimatemember' . DIRECTORY_SEPARATOR;
|
||||
if ( file_exists( $upload_dir . 'um_old_settings.css' ) ) {
|
||||
//was the issues with HTTPS
|
||||
//wp_register_style('um_old_css', $uploads['baseurl'] . '/ultimatemember/um_old_settings.css' );
|
||||
//fixed using "../../"
|
||||
wp_register_style('um_old_css', um_url . '../../uploads/ultimatemember/um_old_settings.css' );
|
||||
wp_enqueue_style('um_old_css');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->load_original();
|
||||
wp_localize_script( 'um_scripts', 'um_scripts', $localize_data );
|
||||
/**
|
||||
* This will load original files (not minified)
|
||||
*/
|
||||
function load_original() {
|
||||
|
||||
// rtl style
|
||||
if ( is_rtl() ) {
|
||||
wp_register_style('um_rtl', um_url . 'assets/css/um.rtl.css', '', ultimatemember_version, 'all' );
|
||||
wp_enqueue_style('um_rtl');
|
||||
}
|
||||
//maybe deprecated
|
||||
//$this->load_google_charts();
|
||||
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', '', ultimatemember_version, true );
|
||||
wp_enqueue_script('um_datetime_locale');
|
||||
}
|
||||
$this->load_fonticons();
|
||||
|
||||
if(is_object($post) && has_shortcode($post->post_content,'ultimate-member')) {
|
||||
wp_dequeue_script('jquery-form');
|
||||
}
|
||||
$this->load_selectjs();
|
||||
|
||||
//old settings before UM 2.0 CSS
|
||||
wp_register_style('um_default_css', um_url . 'assets/css/um-old-default.css', '', ultimatemember_version, 'all' );
|
||||
wp_enqueue_style('um_default_css');
|
||||
$this->load_modal();
|
||||
|
||||
$uploads = wp_upload_dir();
|
||||
$upload_dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . 'ultimatemember' . DIRECTORY_SEPARATOR;
|
||||
if ( file_exists( $upload_dir . 'um_old_settings.css' ) ) {
|
||||
//was the issues with HTTPS
|
||||
//wp_register_style('um_old_css', $uploads['baseurl'] . '/ultimatemember/um_old_settings.css' );
|
||||
//fixed using "../../"
|
||||
wp_register_style('um_old_css', um_url . '../../uploads/ultimatemember/um_old_settings.css' );
|
||||
wp_enqueue_style('um_old_css');
|
||||
}
|
||||
}
|
||||
$this->load_css();
|
||||
|
||||
/***
|
||||
*** @This will load original files (not minified)
|
||||
***/
|
||||
function load_original() {
|
||||
$this->load_fileupload();
|
||||
|
||||
//maybe deprecated
|
||||
//$this->load_google_charts();
|
||||
$this->load_datetimepicker();
|
||||
|
||||
$this->load_fonticons();
|
||||
$this->load_raty();
|
||||
|
||||
$this->load_selectjs();
|
||||
$this->load_scrollto();
|
||||
|
||||
$this->load_modal();
|
||||
$this->load_scrollbar();
|
||||
|
||||
$this->load_css();
|
||||
$this->load_imagecrop();
|
||||
|
||||
$this->load_fileupload();
|
||||
$this->load_tipsy();
|
||||
|
||||
$this->load_datetimepicker();
|
||||
$this->load_functions();
|
||||
|
||||
$this->load_raty();
|
||||
$this->load_responsive();
|
||||
|
||||
$this->load_scrollto();
|
||||
$this->load_customjs();
|
||||
|
||||
$this->load_scrollbar();
|
||||
}
|
||||
|
||||
$this->load_imagecrop();
|
||||
|
||||
$this->load_tipsy();
|
||||
/**
|
||||
* Include Google charts
|
||||
*/
|
||||
function load_google_charts() {
|
||||
|
||||
$this->load_functions();
|
||||
wp_register_script('um_gchart', 'https://www.google.com/jsapi' );
|
||||
wp_enqueue_script('um_gchart');
|
||||
|
||||
$this->load_responsive();
|
||||
}
|
||||
|
||||
$this->load_customjs();
|
||||
|
||||
}
|
||||
/**
|
||||
* Load plugin css
|
||||
*/
|
||||
function load_css() {
|
||||
|
||||
/***
|
||||
*** @Include Google charts
|
||||
***/
|
||||
function load_google_charts() {
|
||||
wp_register_style('um_styles', um_url . 'assets/css/um-styles.css' );
|
||||
wp_enqueue_style('um_styles');
|
||||
|
||||
wp_register_script('um_gchart', 'https://www.google.com/jsapi' );
|
||||
wp_enqueue_script('um_gchart');
|
||||
wp_register_style('um_members', um_url . 'assets/css/um-members.css' );
|
||||
wp_enqueue_style('um_members');
|
||||
|
||||
}
|
||||
wp_register_style('um_profile', um_url . 'assets/css/um-profile.css' );
|
||||
wp_enqueue_style('um_profile');
|
||||
|
||||
/***
|
||||
*** @Load plugin css
|
||||
***/
|
||||
function load_css() {
|
||||
wp_register_style('um_account', um_url . 'assets/css/um-account.css' );
|
||||
wp_enqueue_style('um_account');
|
||||
|
||||
wp_register_style('um_styles', um_url . 'assets/css/um-styles.css' );
|
||||
wp_enqueue_style('um_styles');
|
||||
wp_register_style('um_misc', um_url . 'assets/css/um-misc.css' );
|
||||
wp_enqueue_style('um_misc');
|
||||
|
||||
wp_register_style('um_members', um_url . 'assets/css/um-members.css' );
|
||||
wp_enqueue_style('um_members');
|
||||
}
|
||||
|
||||
wp_register_style('um_profile', um_url . 'assets/css/um-profile.css' );
|
||||
wp_enqueue_style('um_profile');
|
||||
|
||||
wp_register_style('um_account', um_url . 'assets/css/um-account.css' );
|
||||
wp_enqueue_style('um_account');
|
||||
/**
|
||||
* Load select-dropdowns JS
|
||||
*/
|
||||
function load_selectjs() {
|
||||
|
||||
wp_register_style('um_misc', um_url . 'assets/css/um-misc.css' );
|
||||
wp_enqueue_style('um_misc');
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
wp_dequeue_style( 'select2' );
|
||||
wp_deregister_style( 'select2' );
|
||||
|
||||
}
|
||||
wp_dequeue_script( 'select2');
|
||||
wp_deregister_script('select2');
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load select-dropdowns JS
|
||||
***/
|
||||
function load_selectjs() {
|
||||
wp_register_script('select2', um_url . 'assets/js/select2/select2.full.min.js', array('jquery', 'jquery-masonry') );
|
||||
wp_enqueue_script('select2');
|
||||
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
wp_dequeue_style( 'select2' );
|
||||
wp_deregister_style( 'select2' );
|
||||
wp_register_style('select2', um_url . 'assets/css/select2/select2.min.css' );
|
||||
wp_enqueue_style('select2');
|
||||
|
||||
wp_dequeue_script( 'select2');
|
||||
wp_deregister_script('select2');
|
||||
}
|
||||
}
|
||||
|
||||
wp_register_script('select2', um_url . 'assets/js/select2/select2.full.min.js', array('jquery', 'jquery-masonry') );
|
||||
wp_enqueue_script('select2');
|
||||
|
||||
wp_register_style('select2', um_url . 'assets/css/select2/select2.min.css' );
|
||||
wp_enqueue_style('select2');
|
||||
/**
|
||||
* Load Fonticons
|
||||
*/
|
||||
function load_fonticons(){
|
||||
|
||||
}
|
||||
wp_register_style('um_fonticons_ii', um_url . 'assets/css/um-fonticons-ii.css' );
|
||||
wp_enqueue_style('um_fonticons_ii');
|
||||
|
||||
/***
|
||||
*** @Load Fonticons
|
||||
***/
|
||||
function load_fonticons(){
|
||||
wp_register_style('um_fonticons_fa', um_url . 'assets/css/um-fonticons-fa.css' );
|
||||
wp_enqueue_style('um_fonticons_fa');
|
||||
|
||||
wp_register_style('um_fonticons_ii', um_url . 'assets/css/um-fonticons-ii.css' );
|
||||
wp_enqueue_style('um_fonticons_ii');
|
||||
}
|
||||
|
||||
wp_register_style('um_fonticons_fa', um_url . 'assets/css/um-fonticons-fa.css' );
|
||||
wp_enqueue_style('um_fonticons_fa');
|
||||
|
||||
}
|
||||
/**
|
||||
* Load fileupload JS
|
||||
*/
|
||||
function load_fileupload() {
|
||||
|
||||
/***
|
||||
*** @Load fileupload JS
|
||||
***/
|
||||
function load_fileupload() {
|
||||
wp_register_script('um_jquery_form', um_url . 'assets/js/um-jquery-form' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_jquery_form');
|
||||
|
||||
wp_register_script('um_jquery_form', um_url . 'assets/js/um-jquery-form' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_jquery_form');
|
||||
wp_register_script('um_fileupload', um_url . 'assets/js/um-fileupload' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_fileupload');
|
||||
|
||||
wp_register_script('um_fileupload', um_url . 'assets/js/um-fileupload' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_fileupload');
|
||||
wp_register_style('um_fileupload', um_url . 'assets/css/um-fileupload.css' );
|
||||
wp_enqueue_style('um_fileupload');
|
||||
|
||||
wp_register_style('um_fileupload', um_url . 'assets/css/um-fileupload.css' );
|
||||
wp_enqueue_style('um_fileupload');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load JS functions
|
||||
***/
|
||||
function load_functions() {
|
||||
/**
|
||||
* Load JS functions
|
||||
*/
|
||||
function load_functions() {
|
||||
|
||||
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_functions');
|
||||
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_functions');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load custom JS
|
||||
***/
|
||||
function load_customjs() {
|
||||
|
||||
wp_register_script('um_conditional', um_url . 'assets/js/um-conditional' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_conditional');
|
||||
/**
|
||||
* Load custom JS
|
||||
*/
|
||||
function load_customjs() {
|
||||
|
||||
wp_register_script('um_scripts', um_url . 'assets/js/um-scripts' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scripts');
|
||||
wp_register_script('um_conditional', um_url . 'assets/js/um-conditional' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_conditional');
|
||||
|
||||
wp_register_script('um_members', um_url . 'assets/js/um-members' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_members');
|
||||
wp_register_script('um_scripts', um_url . 'assets/js/um-scripts' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scripts');
|
||||
|
||||
wp_register_script('um_profile', um_url . 'assets/js/um-profile' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_profile');
|
||||
wp_register_script('um_members', um_url . 'assets/js/um-members' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_members');
|
||||
|
||||
wp_register_script('um_account', um_url . 'assets/js/um-account' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_account');
|
||||
wp_register_script('um_profile', um_url . 'assets/js/um-profile' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_profile');
|
||||
|
||||
}
|
||||
wp_register_script('um_account', um_url . 'assets/js/um-account' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_account');
|
||||
|
||||
/***
|
||||
*** @Load date & time picker
|
||||
***/
|
||||
function load_datetimepicker() {
|
||||
}
|
||||
|
||||
wp_register_script('um_datetime', um_url . 'assets/js/pickadate/picker.js' );
|
||||
wp_enqueue_script('um_datetime');
|
||||
|
||||
wp_register_script('um_datetime_date', um_url . 'assets/js/pickadate/picker.date.js' );
|
||||
wp_enqueue_script('um_datetime_date');
|
||||
/**
|
||||
* Load date & time picker
|
||||
*/
|
||||
function load_datetimepicker() {
|
||||
|
||||
wp_register_script('um_datetime_time', um_url . 'assets/js/pickadate/picker.time.js' );
|
||||
wp_enqueue_script('um_datetime_time');
|
||||
wp_register_script('um_datetime', um_url . 'assets/js/pickadate/picker.js' );
|
||||
wp_enqueue_script('um_datetime');
|
||||
|
||||
wp_register_script('um_datetime_legacy', um_url . 'assets/js/pickadate/legacy.js' );
|
||||
wp_enqueue_script('um_datetime_legacy');
|
||||
wp_register_script('um_datetime_date', um_url . 'assets/js/pickadate/picker.date.js' );
|
||||
wp_enqueue_script('um_datetime_date');
|
||||
|
||||
wp_register_style('um_datetime', um_url . 'assets/css/pickadate/default.css' );
|
||||
wp_enqueue_style('um_datetime');
|
||||
wp_register_script('um_datetime_time', um_url . 'assets/js/pickadate/picker.time.js' );
|
||||
wp_enqueue_script('um_datetime_time');
|
||||
|
||||
wp_register_style('um_datetime_date', um_url . 'assets/css/pickadate/default.date.css' );
|
||||
wp_enqueue_style('um_datetime_date');
|
||||
wp_register_script('um_datetime_legacy', um_url . 'assets/js/pickadate/legacy.js' );
|
||||
wp_enqueue_script('um_datetime_legacy');
|
||||
|
||||
wp_register_style('um_datetime_time', um_url . 'assets/css/pickadate/default.time.css' );
|
||||
wp_enqueue_style('um_datetime_time');
|
||||
wp_register_style('um_datetime', um_url . 'assets/css/pickadate/default.css' );
|
||||
wp_enqueue_style('um_datetime');
|
||||
|
||||
}
|
||||
wp_register_style('um_datetime_date', um_url . 'assets/css/pickadate/default.date.css' );
|
||||
wp_enqueue_style('um_datetime_date');
|
||||
|
||||
/***
|
||||
*** @Load scrollto
|
||||
***/
|
||||
function load_scrollto(){
|
||||
wp_register_style('um_datetime_time', um_url . 'assets/css/pickadate/default.time.css' );
|
||||
wp_enqueue_style('um_datetime_time');
|
||||
|
||||
wp_register_script('um_scrollto', um_url . 'assets/js/um-scrollto' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scrollto');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load scrollbar
|
||||
***/
|
||||
function load_scrollbar(){
|
||||
/**
|
||||
* Load scrollto
|
||||
*/
|
||||
function load_scrollto(){
|
||||
|
||||
wp_register_script('um_scrollbar', um_url . 'assets/js/um-scrollbar' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scrollbar');
|
||||
wp_register_script('um_scrollto', um_url . 'assets/js/um-scrollto' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scrollto');
|
||||
|
||||
wp_register_style('um_scrollbar', um_url . 'assets/css/um-scrollbar.css' );
|
||||
wp_enqueue_style('um_scrollbar');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load rating
|
||||
***/
|
||||
function load_raty(){
|
||||
/**
|
||||
* Load scrollbar
|
||||
*/
|
||||
function load_scrollbar(){
|
||||
|
||||
wp_register_script('um_raty', um_url . 'assets/js/um-raty' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_raty');
|
||||
wp_register_script('um_scrollbar', um_url . 'assets/js/um-scrollbar' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_scrollbar');
|
||||
|
||||
wp_register_style('um_raty', um_url . 'assets/css/um-raty.css' );
|
||||
wp_enqueue_style('um_raty');
|
||||
wp_register_style('um_scrollbar', um_url . 'assets/css/um-scrollbar.css' );
|
||||
wp_enqueue_style('um_scrollbar');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load crop script
|
||||
***/
|
||||
function load_imagecrop(){
|
||||
|
||||
wp_register_script('um_crop', um_url . 'assets/js/um-crop' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_crop');
|
||||
/**
|
||||
* Load rating
|
||||
*/
|
||||
function load_raty(){
|
||||
|
||||
wp_register_style('um_crop', um_url . 'assets/css/um-crop.css' );
|
||||
wp_enqueue_style('um_crop');
|
||||
wp_register_script('um_raty', um_url . 'assets/js/um-raty' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_raty');
|
||||
|
||||
}
|
||||
wp_register_style('um_raty', um_url . 'assets/css/um-raty.css' );
|
||||
wp_enqueue_style('um_raty');
|
||||
|
||||
/***
|
||||
*** @Load tipsy
|
||||
***/
|
||||
function load_tipsy(){
|
||||
}
|
||||
|
||||
wp_register_script('um_tipsy', um_url . 'assets/js/um-tipsy' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_tipsy');
|
||||
|
||||
wp_register_style('um_tipsy', um_url . 'assets/css/um-tipsy.css' );
|
||||
wp_enqueue_style('um_tipsy');
|
||||
/**
|
||||
* Load crop script
|
||||
*/
|
||||
function load_imagecrop(){
|
||||
|
||||
}
|
||||
wp_register_script('um_crop', um_url . 'assets/js/um-crop' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_crop');
|
||||
|
||||
/***
|
||||
*** @Load modal
|
||||
***/
|
||||
function load_modal(){
|
||||
wp_register_style('um_crop', um_url . 'assets/css/um-crop.css' );
|
||||
wp_enqueue_style('um_crop');
|
||||
|
||||
wp_register_style('um_modal', um_url . 'assets/css/um-modal.css' );
|
||||
wp_enqueue_style('um_modal');
|
||||
}
|
||||
|
||||
wp_register_script('um_modal', um_url . 'assets/js/um-modal' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_modal');
|
||||
|
||||
}
|
||||
/**
|
||||
* Load tipsy
|
||||
*/
|
||||
function load_tipsy(){
|
||||
|
||||
/***
|
||||
*** @Load responsive styles
|
||||
***/
|
||||
function load_responsive(){
|
||||
wp_register_script('um_tipsy', um_url . 'assets/js/um-tipsy' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_tipsy');
|
||||
|
||||
wp_register_script('um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_responsive');
|
||||
wp_register_style('um_tipsy', um_url . 'assets/css/um-tipsy.css' );
|
||||
wp_enqueue_style('um_tipsy');
|
||||
|
||||
wp_register_style('um_responsive', um_url . 'assets/css/um-responsive.css' );
|
||||
wp_enqueue_style('um_responsive');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Load modal
|
||||
*/
|
||||
function load_modal(){
|
||||
|
||||
wp_register_style('um_modal', um_url . 'assets/css/um-modal.css' );
|
||||
wp_enqueue_style('um_modal');
|
||||
|
||||
wp_register_script('um_modal', um_url . 'assets/js/um-modal' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_modal');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load responsive styles
|
||||
*/
|
||||
function load_responsive(){
|
||||
|
||||
wp_register_script('um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_responsive');
|
||||
|
||||
wp_register_style('um_responsive', um_url . 'assets/css/um-responsive.css' );
|
||||
wp_enqueue_style('um_responsive');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+904
-62
File diff suppressed because it is too large
Load Diff
+1155
-785
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,27 @@ if ( ! class_exists( 'Form' ) ) {
|
||||
$form_fields = UM()->fields()->get_fields();
|
||||
$arr_options['fields'] = $form_fields;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_ajax_select_options__debug_mode
|
||||
* @description Activate debug mode for AJAX select options
|
||||
* @input_vars
|
||||
* [{"var":"$debug_mode","type":"bool","desc":"Enable Debug mode"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_ajax_select_options__debug_mode', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_ajax_select_options__debug_mode', 'my_ajax_select_options__debug_mode', 10, 1 );
|
||||
* function my_ajax_select_options__debug_mode( $debug_mode ) {
|
||||
* // your code here
|
||||
* return $debug_mode;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$debug = apply_filters('um_ajax_select_options__debug_mode', false );
|
||||
if( $debug ){
|
||||
$arr_options['debug'] = array(
|
||||
@@ -100,16 +121,36 @@ if ( ! class_exists( 'Form' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Appends field errors
|
||||
* @param string $key
|
||||
* @param string $error
|
||||
*/
|
||||
function add_error( $key, $error ) {
|
||||
if ( ! isset( $this->errors[ $key ] ) ){
|
||||
|
||||
$error = apply_filters('um_submit_form_error', $error , $key );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_submit_form_error
|
||||
* @description Change error text on submit form
|
||||
* @input_vars
|
||||
* [{"var":"$error","type":"string","desc":"Error String"},
|
||||
* {"var":"$key","type":"string","desc":"Error Key"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_submit_form_error', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_submit_form_error', 'my_submit_form_error', 10, 2 );
|
||||
* function my_submit_form_error( $error, $key ) {
|
||||
* // your code here
|
||||
* return $error;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$error = apply_filters( 'um_submit_form_error', $error, $key );
|
||||
$this->errors[ $key ] = $error;
|
||||
}
|
||||
}
|
||||
@@ -158,9 +199,29 @@ if ( ! class_exists( 'Form' ) ) {
|
||||
|
||||
|
||||
if ( $this->form_status == 'publish' ) {
|
||||
|
||||
/* save entire form as global */
|
||||
$this->post_form = apply_filters('um_submit_post_form' ,$_POST );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_submit_post_form
|
||||
* @description Change submitted data on form submit
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Submitted data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_submit_post_form', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_submit_post_form', 'my_submit_post_form', 10, 1 );
|
||||
* function my_submit_post_form( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->post_form = apply_filters( 'um_submit_post_form', $_POST );
|
||||
|
||||
$this->post_form = $this->beautify( $this->post_form );
|
||||
|
||||
@@ -220,6 +281,28 @@ if ( ! class_exists( 'Form' ) ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_submit_form_data
|
||||
* @description Change submitted data on form submit
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Submitted data"},
|
||||
* {"var":"$mode","type":"string","desc":"Form mode"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_submit_form_data', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_submit_form_data', 'my_submit_form_data', 10, 2 );
|
||||
* function my_submit_form_data( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->post_form = apply_filters( 'um_submit_form_data', $this->post_form, $this->post_form['mode'] );
|
||||
|
||||
/* Continue based on form mode - pre-validation */
|
||||
|
||||
@@ -20,6 +20,27 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
|
||||
|
||||
function init_paths() {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_templates_path_by_slug
|
||||
* @description Extend email templates path
|
||||
* @input_vars
|
||||
* [{"var":"$paths","type":"array","desc":"Email slug -> Template Path"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_templates_path_by_slug', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_templates_path_by_slug', 'my_email_templates_path_by_slug', 10, 1 );
|
||||
* function my_email_templates_path_by_slug( $paths ) {
|
||||
* // your code here
|
||||
* return $paths;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->path_by_slug = apply_filters( 'um_email_templates_path_by_slug', $this->path_by_slug );
|
||||
}
|
||||
|
||||
@@ -58,6 +79,28 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
$this->attachments = null;
|
||||
$this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_send_subject
|
||||
* @description Change email notification subject
|
||||
* @input_vars
|
||||
* [{"var":"$subject","type":"string","desc":"Subject"},
|
||||
* {"var":"$key","type":"string","desc":"Template Key"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_send_subject', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_send_subject', 'my_email_send_subject', 10, 2 );
|
||||
* function my_email_send_subject( $subject, $key ) {
|
||||
* // your code here
|
||||
* return $paths;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
|
||||
$this->subject = um_convert_tags( $subject , $args );
|
||||
|
||||
@@ -78,6 +121,29 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
function get_email_template( $slug, $args = array() ) {
|
||||
$located = $this->locate_template( $slug );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_template_path
|
||||
* @description Change email template location
|
||||
* @input_vars
|
||||
* [{"var":"$located","type":"string","desc":"Template Location"},
|
||||
* {"var":"$slug","type":"string","desc":"Template Key"},
|
||||
* {"var":"$args","type":"array","desc":"Template settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_template_path', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_template_path', 'my_email_send_subject', 10, 3 );
|
||||
* function my_email_send_subject( $located, $slug, $args ) {
|
||||
* // your code here
|
||||
* return $located;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$located = apply_filters( 'um_email_template_path', $located, $slug, $args );
|
||||
|
||||
if ( ! file_exists( $located ) ) {
|
||||
@@ -109,13 +175,63 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
|
||||
if ( UM()->options()->get( 'email_html' ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_template_html_formatting
|
||||
* @description Change email notification template header
|
||||
* @input_vars
|
||||
* [{"var":"$header","type":"string","desc":"Email notification header. '<html>' by default"},
|
||||
* {"var":"$slug","type":"string","desc":"Template Key"},
|
||||
* {"var":"$args","type":"array","desc":"Template settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_template_html_formatting', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_template_html_formatting', 'my_email_template_html_formatting', 10, 3 );
|
||||
* function my_email_template_html_formatting( $header, $slug, $args ) {
|
||||
* // your code here
|
||||
* return $header;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
echo apply_filters( 'um_email_template_html_formatting', '<html>', $slug, $args );
|
||||
|
||||
do_action( 'um_before_email_template_body', $slug, $args ); ?>
|
||||
do_action( 'um_before_email_template_body', $slug, $args );
|
||||
|
||||
<body <?php echo apply_filters( 'um_email_template_body_attrs', 'style="background: #f2f2f2;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"', $slug ) ?>>
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_template_body_attrs
|
||||
* @description Change email notification template body additional attributes
|
||||
* @input_vars
|
||||
* [{"var":"$body_atts","type":"string","desc":"Email notification body attributes"},
|
||||
* {"var":"$slug","type":"string","desc":"Template Key"},
|
||||
* {"var":"$args","type":"array","desc":"Template settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_template_body_attrs', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_template_body_attrs', 'my_email_template_body_attrs', 10, 3 );
|
||||
* function my_email_template_body_attrs( $body_atts, $slug, $args ) {
|
||||
* // your code here
|
||||
* return $body_atts;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$body_attrs = apply_filters( 'um_email_template_body_attrs', 'style="background: #f2f2f2;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"', $slug, $args );
|
||||
?>
|
||||
|
||||
<?php echo $this->get_email_template( $slug, $args ); ?>
|
||||
|
||||
<body <?php echo $body_attrs ?>>
|
||||
|
||||
<?php echo $this->get_email_template( $slug, $args ); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -153,10 +269,57 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
}
|
||||
|
||||
// Return what we found.
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_locate_email_template
|
||||
* @description Change email notification template path
|
||||
* @input_vars
|
||||
* [{"var":"$template","type":"string","desc":"Template Path"},
|
||||
* {"var":"$template_name","type":"string","desc":"Template Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_locate_email_template', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_locate_email_template', 'my_locate_email_template', 10, 2 );
|
||||
* function my_email_template_body_attrs( $template, $template_name ) {
|
||||
* // your code here
|
||||
* return $template;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_locate_email_template', $template, $template_name );
|
||||
}
|
||||
|
||||
|
||||
function get_template_filename( $template_name ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_change_email_template_file
|
||||
* @description Change email notification template path
|
||||
* @input_vars
|
||||
* [{"var":"$template_name","type":"string","desc":"Template Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_change_email_template_file', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_change_email_template_file', 'my_change_email_template_file', 10, 1 );
|
||||
* function my_change_email_template_file( $template, $template_name ) {
|
||||
* // your code here
|
||||
* return $template;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_change_email_template_file', $template_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a template and return the path for inclusion.
|
||||
*
|
||||
@@ -166,7 +329,7 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function template_in_theme( $template_name, $html = false ) {
|
||||
$template_name_file = apply_filters( 'um_change_email_template_file', $template_name );
|
||||
$template_name_file = $this->get_template_filename( $template_name );
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
|
||||
// check if there is template at theme folder
|
||||
@@ -190,7 +353,7 @@ if ( ! class_exists( 'Mail' ) ) {
|
||||
*/
|
||||
function get_template_file( $location, $template_name, $html = false ) {
|
||||
$template_path = '';
|
||||
$template_name_file = apply_filters( 'um_change_email_template_file', $template_name );
|
||||
$template_name_file = $this->get_template_filename( $template_name );
|
||||
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
|
||||
|
||||
@@ -73,20 +73,127 @@ if ( ! class_exists( 'Members' ) ) {
|
||||
if ( isset( $fields[ $filter ] ) ) {
|
||||
$attrs = $fields[ $filter ];
|
||||
} else {
|
||||
$attrs = apply_filters("um_custom_search_field_{$filter}", array() );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_search_field_{$filter}
|
||||
* @description Custom search settings by $filter
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"Search Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_custom_search_field_{$filter}', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_search_field_{$filter}', 'my_custom_search_field', 10, 1 );
|
||||
* function my_change_email_template_file( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$attrs = apply_filters( "um_custom_search_field_{$filter}", array() );
|
||||
}
|
||||
|
||||
// additional filter for search field attributes
|
||||
$attrs = apply_filters("um_search_field_{$filter}", $attrs);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_search_field_{$filter}
|
||||
* @description Extend search settings by $filter
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"Search Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_search_field_{$filter}', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_search_field_{$filter}', 'my_search_field', 10, 1 );
|
||||
* function my_change_email_template_file( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$attrs = apply_filters( "um_search_field_{$filter}", $attrs );
|
||||
|
||||
$type = UM()->builtin()->is_dropdown_field( $filter, $attrs ) ? 'select' : 'text';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_search_field_type
|
||||
* @description Change search field type
|
||||
* @input_vars
|
||||
* [{"var":"$type","type":"string","desc":"Search field type"},
|
||||
* {"var":"$settings","type":"array","desc":"Search Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_search_field_type', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_search_field_type', 'my_search_field_type', 10, 2 );
|
||||
* function my_search_field_type( $type, $settings ) {
|
||||
* // your code here
|
||||
* return $type;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$type = apply_filters( 'um_search_field_type', $type, $attrs );
|
||||
|
||||
// filter all search fields
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_search_fields
|
||||
* @description Filter all search fields
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"Search Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_search_fields', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_search_fields', 'my_search_fields', 10, 1 );
|
||||
* function my_search_fields( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$attrs = apply_filters( 'um_search_fields', $attrs );
|
||||
|
||||
if ( $type == 'select' )
|
||||
if ( $type == 'select' ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_search_select_fields
|
||||
* @description Filter all search fields for select field type
|
||||
* @input_vars
|
||||
* [{"var":"$settings","type":"array","desc":"Search Fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_search_select_fields', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_search_select_fields', 'my_search_select_fields', 10, 1 );
|
||||
* function my_search_select_fields( $settings ) {
|
||||
* // your code here
|
||||
* return $settings;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$attrs = apply_filters( 'um_search_select_fields', $attrs );
|
||||
}
|
||||
|
||||
switch ( $type ) {
|
||||
|
||||
@@ -181,10 +288,31 @@ if ( ! class_exists( 'Members' ) ) {
|
||||
* @var $profiles_per_page
|
||||
* @var $profiles_per_page_mobile
|
||||
*/
|
||||
extract($args);
|
||||
extract( $args );
|
||||
|
||||
$query_args = array();
|
||||
$query_args = apply_filters( 'um_prepare_user_query_args', $query_args, $args );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_prepare_user_query_args
|
||||
* @description Extend member directory query arguments
|
||||
* @input_vars
|
||||
* [{"var":"$query_args","type":"array","desc":"Members Query Arguments"},
|
||||
* {"var":"$directory_settings","type":"array","desc":"Member Directory Settings"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_prepare_user_query_args', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_prepare_user_query_args', 'my_prepare_user_query_args', 10, 2 );
|
||||
* function my_prepare_user_query_args( $query_args, $directory_settings ) {
|
||||
* // your code here
|
||||
* return $query_args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$query_args = apply_filters( 'um_prepare_user_query_args', array(), $args );
|
||||
|
||||
// Prepare for BIG SELECT query
|
||||
$wpdb->query('SET SQL_BIG_SELECTS=1');
|
||||
@@ -318,8 +446,28 @@ if ( ! class_exists( 'Members' ) ) {
|
||||
|
||||
}
|
||||
|
||||
return apply_filters('um_prepare_user_results_array', $array );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_prepare_user_results_array
|
||||
* @description Extend member directory query result
|
||||
* @input_vars
|
||||
* [{"var":"$result","type":"array","desc":"Members Query Result"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_prepare_user_results_array', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_prepare_user_results_array', 'my_prepare_user_results', 10, 1 );
|
||||
* function my_prepare_user_results( $result ) {
|
||||
* // your code here
|
||||
* return $result;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_prepare_user_results_array', $array );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +32,30 @@ if ( ! class_exists( 'Options' ) ) {
|
||||
* @return mixed|string|void
|
||||
*/
|
||||
function get( $option_id ) {
|
||||
if ( isset( $this->options[ $option_id ] ) )
|
||||
if ( isset( $this->options[ $option_id ] ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_option_filter__{$option_id}
|
||||
* @description Change UM option on get by $option_id
|
||||
* @input_vars
|
||||
* [{"var":"$option","type":"array","desc":"Option Value"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_get_option_filter__{$option_id}', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_option_filter__{$option_id}', 'my_get_option_filter', 10, 1 );
|
||||
* function my_get_option_filter( $option ) {
|
||||
* // your code here
|
||||
* return $option;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( "um_get_option_filter__{$option_id}", $this->options[ $option_id ] );
|
||||
}
|
||||
|
||||
switch ( $option_id ) {
|
||||
case 'site_name':
|
||||
@@ -90,5 +112,38 @@ if ( ! class_exists( 'Options' ) ) {
|
||||
return $settings_defaults[ $option_id ];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get core page ID
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
function get_core_page_id( $key ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_page_id_filter
|
||||
* @description Change UM page slug
|
||||
* @input_vars
|
||||
* [{"var":"$slug","type":"array","desc":"UM page slug"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_core_page_id_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_page_id_filter', 'my_core_page_id', 10, 1 );
|
||||
* function my_core_page_id( $slug ) {
|
||||
* // your code here
|
||||
* return $slug;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_core_page_id_filter', 'core_' . $key );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,28 @@ if ( ! class_exists( 'Password' ) ) {
|
||||
$classes .= ' um-viewing';
|
||||
}
|
||||
|
||||
$classes = apply_filters('um_form_official_classes__hook', $classes);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_form_official_classes__hook
|
||||
* @description Change form additional classes
|
||||
* @input_vars
|
||||
* [{"var":"$classes","type":"string","desc":"Form additional classes"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_form_official_classes__hook', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_form_official_classes__hook', 'my_form_official_classes', 10, 1 );
|
||||
* function my_form_official_classes( $classes ) {
|
||||
* // your code here
|
||||
* return $classes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$classes = apply_filters( 'um_form_official_classes__hook', $classes );
|
||||
return $classes;
|
||||
}
|
||||
|
||||
@@ -165,7 +186,28 @@ if ( ! class_exists( 'Password' ) ) {
|
||||
$args = array_merge( UM()->shortcodes()->get_css_args( $args ), $args );
|
||||
}
|
||||
|
||||
$args = apply_filters('um_reset_password_shortcode_args_filter', $args);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_reset_password_shortcode_args_filter
|
||||
* @description Extend Reset Password Arguments
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_reset_password_shortcode_args_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_reset_password_shortcode_args_filter', 'my_reset_password_shortcode_args', 10, 1 );
|
||||
* function my_reset_password_shortcode_args( $args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_reset_password_shortcode_args_filter', $args );
|
||||
|
||||
if ( isset( $this->change_password ) ) {
|
||||
|
||||
|
||||
@@ -42,7 +42,28 @@ if ( ! class_exists( 'Permalinks' ) ) {
|
||||
if ( !is_singular() )
|
||||
return;
|
||||
|
||||
$enable_canonical = apply_filters("um_allow_canonical__filter", true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_allow_canonical__filter
|
||||
* @description Allow canonical
|
||||
* @input_vars
|
||||
* [{"var":"$allow_canonical","type":"bool","desc":"Allow?"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_allow_canonical__filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_allow_canonical__filter', 'my_allow_canonical', 10, 1 );
|
||||
* function my_allow_canonical( $allow_canonical ) {
|
||||
* // your code here
|
||||
* return $allow_canonical;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$enable_canonical = apply_filters( "um_allow_canonical__filter", true );
|
||||
|
||||
if( ! $enable_canonical )
|
||||
return;
|
||||
@@ -160,6 +181,27 @@ if ( ! class_exists( 'Permalinks' ) ) {
|
||||
$page_url = strtok( $page_url, '?' );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_current_page_url
|
||||
* @description Change current page URL
|
||||
* @input_vars
|
||||
* [{"var":"$page_url","type":"string","desc":"Page URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_get_current_page_url', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_current_page_url', 'my_get_current_page_url', 10, 1 );
|
||||
* function my_get_current_page_url( $page_url ) {
|
||||
* // your code here
|
||||
* return $page_url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_get_current_page_url', $page_url );
|
||||
}
|
||||
|
||||
@@ -209,9 +251,33 @@ if ( ! class_exists( 'Permalinks' ) ) {
|
||||
/***
|
||||
*** @makes an activate link for any user
|
||||
***/
|
||||
function activate_url(){
|
||||
if ( !um_user('account_secret_hash') ) return false;
|
||||
$url = apply_filters( 'um_activate_url', home_url() );
|
||||
function activate_url() {
|
||||
if ( !um_user('account_secret_hash') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_activate_url
|
||||
* @description Change activate user URL
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Activate URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_activate_url', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_activate_url', 'my_activate_url', 10, 1 );
|
||||
* function my_activate_url( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$url = apply_filters( 'um_activate_url', home_url() );
|
||||
$url = add_query_arg( 'act', 'activate_via_email', $url );
|
||||
$url = add_query_arg( 'hash', um_user('account_secret_hash'), $url );
|
||||
$url = add_query_arg( 'user_id', um_user('ID'), $url );
|
||||
@@ -282,6 +348,28 @@ if ( ! class_exists( 'Permalinks' ) ) {
|
||||
$page_id = UM()->config()->permalinks['user'];
|
||||
$profile_url = get_permalink( $page_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_localize_permalink_filter
|
||||
* @description Change user profile URL
|
||||
* @input_vars
|
||||
* [{"var":"$profile_url","type":"string","desc":"Profile URL"},
|
||||
* {"var":"$page_id","type":"int","desc":"Profile Page ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_localize_permalink_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_localize_permalink_filter', 'my_localize_permalink', 10, 2 );
|
||||
* function my_localize_permalink( $profile_url, $page_id ) {
|
||||
* // your code here
|
||||
* return $profile_url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$profile_url = apply_filters( 'um_localize_permalink_filter', $profile_url, $page_id );
|
||||
|
||||
if ( get_option('permalink_structure') ) {
|
||||
|
||||
@@ -45,6 +45,27 @@ if ( ! class_exists( 'Profile' ) ) {
|
||||
***/
|
||||
function tabs() {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_tabs
|
||||
* @description Extend user profile tabs
|
||||
* @input_vars
|
||||
* [{"var":"$tabs","type":"array","desc":"Profile tabs"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_tabs', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_tabs', 'my_profile_tabs', 10, 1 );
|
||||
* function my_profile_tabs( $tabs ) {
|
||||
* // your code here
|
||||
* return $tabs;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$tabs = apply_filters( 'um_profile_tabs', array(
|
||||
'main' => array(
|
||||
'name' => __( 'About', 'ultimate-member' ),
|
||||
@@ -178,6 +199,27 @@ if ( ! class_exists( 'Profile' ) ) {
|
||||
$this->active_tab = get_query_var('profiletab');
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_active_tab
|
||||
* @description Change active profile tab
|
||||
* @input_vars
|
||||
* [{"var":"$tab","type":"string","desc":"Active Profile tab"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_active_tab', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_active_tab', 'my_profile_active_tab', 10, 1 );
|
||||
* function my_profile_active_tab( $tab ) {
|
||||
* // your code here
|
||||
* return $tab;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->active_tab = apply_filters( 'um_profile_active_tab', $this->active_tab );
|
||||
|
||||
return $this->active_tab;
|
||||
|
||||
@@ -102,6 +102,27 @@ if ( ! class_exists( 'Query' ) ) {
|
||||
|
||||
unset( $args['post_type'] );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_excluded_comment_types
|
||||
* @description Extend excluded comment types
|
||||
* @input_vars
|
||||
* [{"var":"$types","type":"array","desc":"Comment Types"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_excluded_comment_types', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_excluded_comment_types', 'my_excluded_comment_types', 10, 1 );
|
||||
* function my_profile_active_tab( $types ) {
|
||||
* // your code here
|
||||
* return $types;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args['type__not_in'] = apply_filters( 'um_excluded_comment_types', array('') );
|
||||
|
||||
$comments = get_comments($args);
|
||||
|
||||
@@ -18,7 +18,28 @@ if ( ! class_exists( 'Register' ) ) {
|
||||
}
|
||||
|
||||
public function verify_nonce( $args ){
|
||||
$allow_nonce_verification = apply_filters("um_register_allow_nonce_verification", true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_allow_nonce_verification
|
||||
* @description Enable/DIsable nonce verification of registration
|
||||
* @input_vars
|
||||
* [{"var":"$allow_nonce","type":"bool","desc":"Enable nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_allow_nonce_verification', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_allow_nonce_verification', 'my_register_allow_nonce_verification', 10, 1 );
|
||||
* function my_register_allow_nonce_verification( $allow_nonce ) {
|
||||
* // your code here
|
||||
* return $allow_nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$allow_nonce_verification = apply_filters( "um_register_allow_nonce_verification", true );
|
||||
|
||||
if( ! $allow_nonce_verification ){
|
||||
return $args;
|
||||
|
||||
@@ -31,9 +31,28 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
// Determine if JSON_PRETTY_PRINT is available
|
||||
$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
|
||||
|
||||
// Allow API request logging to be turned off
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_api_log_requests
|
||||
* @description Allow API request logging to be turned off
|
||||
* @input_vars
|
||||
* [{"var":"$allow_log","type":"bool","desc":"Enable api logs"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_api_log_requests', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_api_log_requests', 'my_api_log_requests', 10, 1 );
|
||||
* function my_api_log_requests( $allow_log ) {
|
||||
* // your code here
|
||||
* return $allow_log;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->log_requests = apply_filters( 'um_api_log_requests', $this->log_requests );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,6 +203,7 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
}
|
||||
|
||||
// Determine the kind of query
|
||||
$args = array();
|
||||
$query_mode = $this->get_query_mode();
|
||||
foreach( $this->vars as $k ) {
|
||||
$args[ $k ] = isset( $wp_query->query_vars[ $k ] ) ? $wp_query->query_vars[ $k ] : null;
|
||||
@@ -214,12 +234,55 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
break;
|
||||
|
||||
default:
|
||||
$data = apply_filters( 'um_rest_query_mode', $data , $query_mode, $args );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rest_query_mode
|
||||
* @description Change query attributes
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Query Data"},
|
||||
* {"var":"$query_mode","type":"string","desc":"Query Mode"},
|
||||
* {"var":"$args","type":"array","desc":"Query Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rest_query_mode', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rest_query_mode', 'my_rest_query_mode', 10, 3 );
|
||||
* function um_rest_query_mode( $data, $query_mode, $args ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( 'um_rest_query_mode', $data, $query_mode, $args );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Allow extensions to setup their own return data
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_api_output_data
|
||||
* @description Change output data for Rest API call
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Output Data"},
|
||||
* {"var":"$query_mode","type":"string","desc":"Query Mode"},
|
||||
* {"var":"$api_class","type":"REST_API","desc":"REST_API instance"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_api_output_data', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_api_output_data', 'my_api_output_data', 10, 3 );
|
||||
* function my_api_output_data( $data, $query_mode, $api_class ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->data = apply_filters( 'um_api_output_data', $data, $query_mode, $this );
|
||||
|
||||
// Log this API request, if enabled. We log it here because we have access to errors.
|
||||
@@ -245,8 +308,28 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
$pending = UM()->user()->get_pending_users_count();
|
||||
$response['stats']['pending_users'] = absint( $pending );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rest_api_get_stats
|
||||
* @description Change output data for Rest API get stats call
|
||||
* @input_vars
|
||||
* [{"var":"$response","type":"array","desc":"Output Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rest_api_get_stats', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rest_api_get_stats', 'my_rest_api_get_stats', 10, 1 );
|
||||
* function my_rest_api_get_stats( $response ) {
|
||||
* // your code here
|
||||
* return $response;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$response = apply_filters( 'um_rest_api_get_stats', $response );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -347,6 +430,29 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
$val->profile_pic_normal = $this->getsrc( um_user('profile_photo', 200) );
|
||||
$val->profile_pic_small = $this->getsrc( um_user('profile_photo', 40) );
|
||||
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rest_userdata
|
||||
* @description Change output data for Rest API userdata call
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"array","desc":"Output Data"},
|
||||
* {"var":"$user_id","type":"string","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rest_userdata', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rest_userdata', 'my_rest_userdata', 10, 2 );
|
||||
* function my_rest_userdata( $value, $user_id ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$val = apply_filters( 'um_rest_userdata', $val, $user->ID );
|
||||
}
|
||||
$response[ $user->ID ] = $val;
|
||||
@@ -420,10 +526,32 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
switch( $field ) {
|
||||
|
||||
default:
|
||||
$response[$field] = ( um_profile( $field ) ) ? um_profile( $field ) : '';
|
||||
$response[ $field ] = ( um_profile( $field ) ) ? um_profile( $field ) : '';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rest_get_auser
|
||||
* @description Change output data for Rest API user authentification call
|
||||
* @input_vars
|
||||
* [{"var":"$response","type":"array","desc":"Output Data"},
|
||||
* {"var":"$field","type":"string","desc":"Field Key"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rest_get_auser', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rest_get_auser', 'my_rest_get_auser', 10, 3 );
|
||||
* function my_rest_get_auser( $response, $field, $user_id ) {
|
||||
* // your code here
|
||||
* return $response;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$response = apply_filters( 'um_rest_get_auser', $response, $field, $user->ID );
|
||||
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
@@ -467,6 +595,29 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
$val->profile_pic_normal = $this->getsrc( um_user('profile_photo', 200) );
|
||||
$val->profile_pic_small = $this->getsrc( um_user('profile_photo', 40) );
|
||||
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rest_userdata
|
||||
* @description Change output data for Rest API userdata call
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"array","desc":"Output Data"},
|
||||
* {"var":"$user_id","type":"string","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rest_userdata', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rest_userdata', 'my_rest_userdata', 10, 2 );
|
||||
* function my_rest_userdata( $value, $user_id ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$val = apply_filters( 'um_rest_userdata', $val, $user->ID );
|
||||
}
|
||||
$response = $val;
|
||||
@@ -493,7 +644,27 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
public function get_query_mode() {
|
||||
global $wp_query;
|
||||
|
||||
// Whitelist our query options
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_api_valid_query_modes
|
||||
* @description Whitelist UM query options
|
||||
* @input_vars
|
||||
* [{"var":"$list","type":"array","desc":"Whitelist"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_api_valid_query_modes', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_api_valid_query_modes', 'my_api_valid_query_modes', 10, 1 );
|
||||
* function my_api_valid_query_modes( $list ) {
|
||||
* // your code here
|
||||
* return $list;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$accepted = apply_filters( 'um_api_valid_query_modes', array(
|
||||
'get.users',
|
||||
'get.user',
|
||||
@@ -534,6 +705,27 @@ if ( ! class_exists( 'REST_API' ) ) {
|
||||
|
||||
$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_api_output_format
|
||||
* @description UM Rest API output format
|
||||
* @input_vars
|
||||
* [{"var":"$format","type":"string","desc":"Format"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_api_output_format', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_api_output_format', 'my_api_output_format', 10, 1 );
|
||||
* function my_api_output_format( $format ) {
|
||||
* // your code here
|
||||
* return $format;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_api_output_format', $format );
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,28 @@ if ( ! class_exists( 'Rewrite' ) ) {
|
||||
'top'
|
||||
);
|
||||
|
||||
if( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) )
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_rewrite_flush_rewrite_rules
|
||||
* @description Enable flushing rewrite rules
|
||||
* @input_vars
|
||||
* [{"var":"$stop_flush","type":"bool","desc":"Stop flushing rewrite rules"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_rewrite_flush_rewrite_rules', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_rewrite_flush_rewrite_rules', 'my_rewrite_flush_rewrite_rules', 10, 1 );
|
||||
* function my_rewrite_flush_rewrite_rules( $stop_flush ) {
|
||||
* // your code here
|
||||
* return $stop_flush;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
if ( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) )
|
||||
flush_rewrite_rules( true );
|
||||
|
||||
}
|
||||
@@ -200,6 +221,27 @@ if ( ! class_exists( 'Rewrite' ) ) {
|
||||
exit( wp_redirect( $url ) );
|
||||
} else {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_locate_user_profile_not_loggedin__redirect
|
||||
* @description Change redirect URL from user profile for not logged in user
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Redirect URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_locate_user_profile_not_loggedin__redirect', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_locate_user_profile_not_loggedin__redirect', 'my_user_profile_not_loggedin__redirect', 10, 1 );
|
||||
* function my_user_profile_not_loggedin__redirect( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$redirect_to = apply_filters( 'um_locate_user_profile_not_loggedin__redirect', home_url() );
|
||||
if ( ! empty( $redirect_to ) ){
|
||||
exit( wp_redirect( $redirect_to ) );
|
||||
|
||||
@@ -137,6 +137,29 @@ if ( ! class_exists( 'Roles_Capabilities' ) ) {
|
||||
$new_role = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_set_user_role
|
||||
* @description User role was changed
|
||||
* @input_vars
|
||||
* [{"var":"$new_role","type":"string","desc":"New role"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$user","type":"array","desc":"Userdata"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_set_user_role', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_set_user_role', 'my_set_user_role', 10, 1 );
|
||||
* function my_set_user_role( $new_role ) {
|
||||
* // your code here
|
||||
* return $new_role;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_set_user_role', $new_role, $user_id, $user );
|
||||
}
|
||||
|
||||
@@ -472,6 +495,29 @@ if ( ! class_exists( 'Roles_Capabilities' ) ) {
|
||||
$user_id = get_current_user_id();
|
||||
$role = UM()->roles()->get_priority_user_role( $user_id );
|
||||
$permissions = $this->role_data( $role );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_permissions_filter
|
||||
* @description Change User Permissions
|
||||
* @input_vars
|
||||
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
|
||||
* function my_user_permissions( $permissions, $user_id ) {
|
||||
* // your code here
|
||||
* return $permissions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$permissions = apply_filters( 'um_user_permissions_filter', $permissions, $user_id );
|
||||
|
||||
if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
|
||||
|
||||
@@ -188,8 +188,8 @@ if ( ! class_exists( 'Setup' ) ) {
|
||||
}
|
||||
|
||||
foreach ( $core_pages as $slug => $page_id ) {
|
||||
$key = apply_filters( 'um_core_page_id_filter', 'core_' . $slug );
|
||||
$options[$key] = $page_id;
|
||||
$key = UM()->options()->get_core_page_id( $slug );
|
||||
$options[ $key ] = $page_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,27 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
add_filter( 'um_shortcode_args_filter', array( &$this, 'display_logout_form' ), 99 );
|
||||
add_filter( 'um_shortcode_args_filter', array( &$this, 'parse_shortcode_args' ), 99 );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_emoji_base_uri
|
||||
* @description Change Emoji base URL
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Base URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_emoji_base_uri', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_emoji_base_uri', 'my_emoji_base_uri', 10, 1 );
|
||||
* function my_emoji_base_uri( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$base_uri = apply_filters( 'um_emoji_base_uri', 'https://s.w.org/images/core/emoji/' );
|
||||
|
||||
$this->emoji[':)'] = $base_uri . '72x72/1f604.png';
|
||||
@@ -256,7 +277,28 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
$classes .= ' um-' . $args['template'];
|
||||
}
|
||||
|
||||
$classes = apply_filters('um_form_official_classes__hook', $classes);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_form_official_classes__hook
|
||||
* @description Change official form classes
|
||||
* @input_vars
|
||||
* [{"var":"$classes","type":"string","desc":"Classes string"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_form_official_classes__hook', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_form_official_classes__hook', 'my_form_official_classes', 10, 1 );
|
||||
* function my_form_official_classes( $classes ) {
|
||||
* // your code here
|
||||
* return $classes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$classes = apply_filters( 'um_form_official_classes__hook', $classes );
|
||||
return $classes;
|
||||
}
|
||||
|
||||
@@ -343,7 +385,28 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
// get data into one global array
|
||||
$post_data = UM()->query()->post_data($this->form_id);
|
||||
|
||||
$args = apply_filters('um_pre_args_setup', $post_data);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_pre_args_setup
|
||||
* @description Change arguments on load shortcode
|
||||
* @input_vars
|
||||
* [{"var":"$post_data","type":"string","desc":"$_POST data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_pre_args_setup', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_pre_args_setup', 'my_pre_args_setup', 10, 1 );
|
||||
* function my_pre_args_setup( $post_data ) {
|
||||
* // your code here
|
||||
* return $post_data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_pre_args_setup', $post_data );
|
||||
|
||||
if (!isset($args['template'])) {
|
||||
$args['template'] = '';
|
||||
@@ -372,7 +435,29 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
}
|
||||
}
|
||||
// filter for arguments
|
||||
$args = apply_filters('um_shortcode_args_filter', $args);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_shortcode_args_filter
|
||||
* @description Change arguments on load shortcode
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"string","desc":"Shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_shortcode_args_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_shortcode_args_filter', 'my_shortcode_args', 10, 1 );
|
||||
* function my_shortcode_args( $args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_shortcode_args_filter', $args );
|
||||
|
||||
extract($args, EXTR_SKIP);
|
||||
|
||||
@@ -432,8 +517,26 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function dynamic_css( $args = array() ) {
|
||||
/*
|
||||
* for fix the issue #306
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_disable_dynamic_global_css
|
||||
* @description Turn on for disable global dynamic CSS for fix the issue #306
|
||||
* @input_vars
|
||||
* [{"var":"$disable","type":"bool","desc":"Disable global CSS"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_disable_dynamic_global_css', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_disable_dynamic_global_css', 'my_disable_dynamic_global_css', 10, 1 );
|
||||
* function my_disable_dynamic_global_css( $disable ) {
|
||||
* // your code here
|
||||
* return $disable;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$disable_css = apply_filters( 'um_disable_dynamic_global_css', false );
|
||||
if ( $disable_css )
|
||||
@@ -594,6 +697,27 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
'{username}',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_allowed_user_tags_patterns
|
||||
* @description Extend user placeholders patterns
|
||||
* @input_vars
|
||||
* [{"var":"$patterns","type":"array","desc":"Placeholders"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_allowed_user_tags_patterns', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_allowed_user_tags_patterns', 'my_allowed_user_tags', 10, 1 );
|
||||
* function my_allowed_user_tags( $patterns ) {
|
||||
* // your code here
|
||||
* return $patterns;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$pattern_array = apply_filters( 'um_allowed_user_tags_patterns', $pattern_array );
|
||||
|
||||
//$matches = false;
|
||||
@@ -616,6 +740,28 @@ if ( ! class_exists( 'Shortcodes' ) ) {
|
||||
$value = um_user( 'user_login' );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_tag_hook__{$usermeta}
|
||||
* @description Change usermeta field value
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"array","desc":"Meta field value"},
|
||||
* {"var":"$user_id","type":"array","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_tag_hook__{$usermeta}', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_tag_hook__{$usermeta}', 'my_profile_tag', 10, 2 );
|
||||
* function my_profile_tag( $value, $user_id ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_tag_hook__{$usermeta}", $value, um_user( 'ID' ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -4,105 +4,157 @@ namespace um\core;
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'User_posts' ) ) {
|
||||
class User_posts {
|
||||
|
||||
function __construct() {
|
||||
|
||||
add_action('um_profile_content_posts', array(&$this, 'add_posts') );
|
||||
add_action('um_profile_content_comments', array(&$this, 'add_comments') );
|
||||
|
||||
add_action('um_ajax_load_posts__um_load_posts', array(&$this, 'load_posts') );
|
||||
add_action('um_ajax_load_posts__um_load_comments', array(&$this, 'load_comments') );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @dynamic load of posts
|
||||
***/
|
||||
function load_posts( $args ) {
|
||||
$array = explode(',', $args );
|
||||
$post_type = $array[0];
|
||||
$posts_per_page = $array[1];
|
||||
$offset = $array[2];
|
||||
$author = $array[3];
|
||||
|
||||
$offset_n = $posts_per_page + $offset;
|
||||
|
||||
UM()->shortcodes()->modified_args = "$post_type,$posts_per_page,$offset_n,$author";
|
||||
|
||||
UM()->shortcodes()->loop = UM()->query()->make("post_type=$post_type&posts_per_page=$posts_per_page&offset=$offset&author=$author");
|
||||
|
||||
UM()->shortcodes()->load_template('profile/posts-single');
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @dynamic load of comments
|
||||
***/
|
||||
function load_comments( $args ) {
|
||||
$array = explode(',', $args );
|
||||
$post_type = $array[0];
|
||||
$posts_per_page = $array[1];
|
||||
$offset = $array[2];
|
||||
$author = $array[3];
|
||||
|
||||
$offset_n = $posts_per_page + $offset;
|
||||
|
||||
UM()->shortcodes()->modified_args = "$post_type,$posts_per_page,$offset_n,$author";
|
||||
|
||||
UM()->shortcodes()->loop = UM()->query()->make("post_type=$post_type&number=$posts_per_page&offset=$offset&user_id=$author");
|
||||
|
||||
UM()->shortcodes()->load_template('profile/comments-single');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @add posts
|
||||
***/
|
||||
function add_posts() {
|
||||
UM()->shortcodes()->load_template('profile/posts');
|
||||
}
|
||||
/**
|
||||
* Class User_posts
|
||||
* @package um\core
|
||||
*/
|
||||
class User_posts {
|
||||
|
||||
/***
|
||||
*** @add comments
|
||||
***/
|
||||
function add_comments() {
|
||||
UM()->shortcodes()->load_template('profile/comments');
|
||||
}
|
||||
/**
|
||||
* User_posts constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
add_action( 'um_profile_content_posts', array( &$this, 'add_posts' ) );
|
||||
add_action( 'um_profile_content_comments', array( &$this, 'add_comments' ) );
|
||||
|
||||
/***
|
||||
*** @count posts
|
||||
***/
|
||||
function count_user_posts_by_type( $user_id= '', $post_type = 'post' ) {
|
||||
global $wpdb;
|
||||
if ( !$user_id )
|
||||
$user_id = um_user('ID');
|
||||
add_action( 'um_ajax_load_posts__um_load_posts', array( &$this, 'load_posts' ) );
|
||||
add_action( 'um_ajax_load_posts__um_load_comments', array( &$this, 'load_comments' ) );
|
||||
}
|
||||
|
||||
if ( !$user_id ) return 0;
|
||||
|
||||
$where = get_posts_by_author_sql( $post_type, true, $user_id );
|
||||
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
|
||||
/**
|
||||
* Dynamic load of posts
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
function load_posts( $args ) {
|
||||
$array = explode(',', $args );
|
||||
$post_type = $array[0];
|
||||
$posts_per_page = $array[1];
|
||||
$offset = $array[2];
|
||||
$author = $array[3];
|
||||
|
||||
return apply_filters('um_pretty_number_formatting', $count);
|
||||
}
|
||||
$offset_n = $posts_per_page + $offset;
|
||||
|
||||
/***
|
||||
*** @count comments
|
||||
***/
|
||||
function count_user_comments( $user_id = null ) {
|
||||
global $wpdb;
|
||||
if ( !$user_id )
|
||||
$user_id = um_user('ID');
|
||||
UM()->shortcodes()->modified_args = "$post_type,$posts_per_page,$offset_n,$author";
|
||||
|
||||
if ( !$user_id ) return 0;
|
||||
UM()->shortcodes()->loop = UM()->query()->make("post_type=$post_type&posts_per_page=$posts_per_page&offset=$offset&author=$author");
|
||||
|
||||
$count = $wpdb->get_var("SELECT COUNT(comment_ID) FROM " . $wpdb->comments. " WHERE user_id = " . $user_id . " AND comment_approved = '1'");
|
||||
UM()->shortcodes()->load_template('profile/posts-single');
|
||||
}
|
||||
|
||||
return apply_filters('um_pretty_number_formatting', $count);
|
||||
}
|
||||
/**
|
||||
* Dynamic load of comments
|
||||
*
|
||||
* @param $args
|
||||
*/
|
||||
function load_comments( $args ) {
|
||||
$array = explode(',', $args );
|
||||
$post_type = $array[0];
|
||||
$posts_per_page = $array[1];
|
||||
$offset = $array[2];
|
||||
$author = $array[3];
|
||||
|
||||
}
|
||||
$offset_n = $posts_per_page + $offset;
|
||||
|
||||
UM()->shortcodes()->modified_args = "$post_type,$posts_per_page,$offset_n,$author";
|
||||
|
||||
UM()->shortcodes()->loop = UM()->query()->make("post_type=$post_type&number=$posts_per_page&offset=$offset&user_id=$author");
|
||||
|
||||
UM()->shortcodes()->load_template('profile/comments-single');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add posts
|
||||
*/
|
||||
function add_posts() {
|
||||
UM()->shortcodes()->load_template( 'profile/posts' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add comments
|
||||
*/
|
||||
function add_comments() {
|
||||
UM()->shortcodes()->load_template( 'profile/comments' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count posts by type
|
||||
*
|
||||
* @param string $user_id
|
||||
* @param string $post_type
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
function count_user_posts_by_type( $user_id= '', $post_type = 'post' ) {
|
||||
global $wpdb;
|
||||
if ( !$user_id )
|
||||
$user_id = um_user( 'ID' );
|
||||
|
||||
if ( !$user_id ) return 0;
|
||||
|
||||
$where = get_posts_by_author_sql( $post_type, true, $user_id );
|
||||
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
|
||||
|
||||
return $this->pretty_number_formatting( $count );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count comments
|
||||
*
|
||||
* @param int|null $user_id
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
function count_user_comments( $user_id = null ) {
|
||||
global $wpdb;
|
||||
if ( !$user_id )
|
||||
$user_id = um_user('ID');
|
||||
|
||||
if ( !$user_id ) return 0;
|
||||
|
||||
$count = $wpdb->get_var("SELECT COUNT(comment_ID) FROM " . $wpdb->comments. " WHERE user_id = " . $user_id . " AND comment_approved = '1'");
|
||||
|
||||
return $this->pretty_number_formatting( $count );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $count
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function pretty_number_formatting( $count ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_pretty_number_formatting
|
||||
* @description Change User Posts count value
|
||||
* @input_vars
|
||||
* [{"var":"$count","type":"int","desc":"Posts Count"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_pretty_number_formatting', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_pretty_number_formatting', 'my_pretty_number_formatting', 10, 1 );
|
||||
* function my_pretty_number_formatting( $count ) {
|
||||
* // your code here
|
||||
* return $count;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_pretty_number_formatting', $count );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -155,6 +155,28 @@ if ( ! class_exists( 'User' ) ) {
|
||||
'value' => 'awaiting_admin_review',
|
||||
'compare' => '='
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_pending_queue_filter
|
||||
* @description Change user query arguments when get pending users
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"WP_Users query arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_admin_pending_queue_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_pending_queue_filter', 'my_admin_pending_queue', 10, 1 );
|
||||
* function my_admin_pending_queue( $args ) {
|
||||
* // your code here
|
||||
* return $args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_admin_pending_queue_filter', $args );
|
||||
$users = new \WP_User_Query( $args );
|
||||
|
||||
@@ -371,6 +393,28 @@ if ( ! class_exists( 'User' ) ) {
|
||||
*/
|
||||
function profile_form_additional_section( $userdata ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_profile_additional_fields
|
||||
* @description Make additional content section
|
||||
* @input_vars
|
||||
* [{"var":"$content","type":"array","desc":"Additional section content"},
|
||||
* {"var":"$userdata","type":"array","desc":"Userdata"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_profile_additional_fields', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_profile_additional_fields', 'my_admin_pending_queue', 10, 2 );
|
||||
* function my_admin_pending_queue( $content, $userdata ) {
|
||||
* // your code here
|
||||
* return $content;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$section_content = apply_filters( 'um_user_profile_additional_fields', '', $userdata );
|
||||
|
||||
if ( ! empty( $section_content ) && ! ( is_multisite() && is_network_admin() ) ) {
|
||||
@@ -489,7 +533,29 @@ if ( ! class_exists( 'User' ) ) {
|
||||
if ( is_numeric( $user_id ) && $user_id > 0 ) {
|
||||
$find_user = get_option("um_cache_userdata_{$user_id}");
|
||||
if ( $find_user ) {
|
||||
$find_user = apply_filters('um_user_permissions_filter', $find_user, $user_id);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_permissions_filter
|
||||
* @description Change User Permissions
|
||||
* @input_vars
|
||||
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
|
||||
* function my_user_permissions( $permissions, $user_id ) {
|
||||
* // your code here
|
||||
* return $permissions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$find_user = apply_filters( 'um_user_permissions_filter', $find_user, $user_id );
|
||||
return $find_user;
|
||||
}
|
||||
}
|
||||
@@ -627,6 +693,28 @@ if ( ! class_exists( 'User' ) ) {
|
||||
$this->profile['roles'] = UM()->roles()->get_all_user_roles( $this->id );
|
||||
|
||||
$role_meta = UM()->roles()->role_data( $user_role );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_permissions_filter
|
||||
* @description Change User Permissions
|
||||
* @input_vars
|
||||
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
|
||||
* function my_user_permissions( $permissions, $user_id ) {
|
||||
* // your code here
|
||||
* return $permissions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$role_meta = apply_filters( 'um_user_permissions_filter', $role_meta, $this->id );
|
||||
|
||||
/*$role_meta = array_map( function( $key, $item ) {
|
||||
@@ -725,7 +813,28 @@ if ( ! class_exists( 'User' ) ) {
|
||||
unset( $submitted['confirm_user_password'] );
|
||||
}
|
||||
|
||||
$submitted = apply_filters('um_before_save_filter_submitted', $submitted );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_before_save_filter_submitted
|
||||
* @description Change submitted data before save usermeta "submitted" on registration process
|
||||
* @input_vars
|
||||
* [{"var":"$submitted","type":"array","desc":"Submitted data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_before_save_filter_submitted', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_before_save_filter_submitted', 'my_before_save_filter_submitted', 10, 1 );
|
||||
* function my_before_save_filter_submitted( $submitted ) {
|
||||
* // your code here
|
||||
* return $submitted;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$submitted = apply_filters( 'um_before_save_filter_submitted', $submitted );
|
||||
|
||||
do_action('um_before_save_registration_details', $this->id, $submitted );
|
||||
|
||||
@@ -1059,6 +1168,27 @@ if ( ! class_exists( 'User' ) ) {
|
||||
function get_admin_actions() {
|
||||
$items = array();
|
||||
$actions = array();
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_admin_user_actions_hook
|
||||
* @description Extend admin actions for each user
|
||||
* @input_vars
|
||||
* [{"var":"$actions","type":"array","desc":"Actions for user"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_admin_user_actions_hook', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_admin_user_actions_hook', 'my_admin_user_actions', 10, 1 );
|
||||
* function my_admin_user_actions( $actions ) {
|
||||
* // your code here
|
||||
* return $actions;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters('um_admin_user_actions_hook', $actions );
|
||||
if ( !isset( $actions ) || empty( $actions ) ) return false;
|
||||
foreach($actions as $id => $arr ) {
|
||||
@@ -1144,7 +1274,30 @@ if ( ! class_exists( 'User' ) ) {
|
||||
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
||||
|
||||
if ( $privacy == $case ) {
|
||||
$bool = apply_filters('um_is_private_filter_hook', false, $privacy, $user_id );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_is_private_filter_hook
|
||||
* @description Change user privacy
|
||||
* @input_vars
|
||||
* [{"var":"$is_private","type":"bool","desc":"Is user private"},
|
||||
* {"var":"$privacy","type":"bool","desc":"Profile Privacy"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_is_private_filter_hook', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_is_private_filter_hook', 'my_is_private_filter', 10, 3 );
|
||||
* function my_is_private_filter( $is_private ) {
|
||||
* // your code here
|
||||
* return $is_private;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$bool = apply_filters( 'um_is_private_filter_hook', false, $privacy, $user_id );
|
||||
return $bool;
|
||||
}
|
||||
|
||||
@@ -1170,7 +1323,30 @@ if ( ! class_exists( 'User' ) ) {
|
||||
function update_profile( $changes ) {
|
||||
|
||||
$args['ID'] = $this->id;
|
||||
$changes = apply_filters('um_before_update_profile', $changes, $this->id);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_before_update_profile
|
||||
* @description Change update profile changes data
|
||||
* @input_vars
|
||||
* [{"var":"$changes","type":"array","desc":"User Profile Changes"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_before_update_profile', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_before_update_profile', 'my_before_update_profile', 10, 2 );
|
||||
* function my_before_update_profile( $changes, $user_id ) {
|
||||
* // your code here
|
||||
* return $changes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$changes = apply_filters('um_before_update_profile', $changes, $this->id );
|
||||
|
||||
// save or update profile meta
|
||||
foreach ( $changes as $key => $value ) {
|
||||
|
||||
+261
-149
@@ -5,183 +5,295 @@ namespace um\core;
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Validation' ) ) {
|
||||
class Validation {
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->regex_safe = '/\A[\w\-\.]+\z/';
|
||||
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
|
||||
/**
|
||||
* Class Validation
|
||||
* @package um\core
|
||||
*/
|
||||
class Validation {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @removes html from any string
|
||||
***/
|
||||
function remove_html($string) {
|
||||
return wp_strip_all_tags( $string );
|
||||
}
|
||||
/**
|
||||
* Validation constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
$this->regex_safe = '/\A[\w\-\.]+\z/';
|
||||
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @normalize a string
|
||||
***/
|
||||
function normalize($string) {
|
||||
$string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
|
||||
return $string;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @safe name usage ( for url purposes )
|
||||
***/
|
||||
function safe_name_in_url( $name ) {
|
||||
$name = strtolower( $name );
|
||||
$name = preg_replace("/'/","", $name );
|
||||
$name = stripslashes( $name );
|
||||
$name = $this->normalize($name);
|
||||
$name = rawurldecode( $name );
|
||||
return $name;
|
||||
}
|
||||
/**
|
||||
* Removes html from any string
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function remove_html( $string ) {
|
||||
return wp_strip_all_tags( $string );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @password test
|
||||
***/
|
||||
function strong_pass($candidate) {
|
||||
$r1='/[A-Z]/';
|
||||
$r2='/[a-z]/';
|
||||
$r3='/[0-9]/';
|
||||
if(preg_match_all($r1,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r2,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r3,$candidate, $o)<1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @space, dash, underscore
|
||||
***/
|
||||
function safe_username( $string ) {
|
||||
/**
|
||||
* Normalize a string
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function normalize( $string ) {
|
||||
$string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
|
||||
return $string;
|
||||
}
|
||||
|
||||
$regex_safe_username = apply_filters('um_validation_safe_username_regex',$this->regex_safe );
|
||||
|
||||
if ( is_email( $string ) )
|
||||
return true;
|
||||
if ( !is_email( $string) && !preg_match( $regex_safe_username, $string ) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Safe name usage ( for url purposes )
|
||||
*
|
||||
* @param $name
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
function safe_name_in_url( $name ) {
|
||||
$name = strtolower( $name );
|
||||
$name = preg_replace("/'/","", $name );
|
||||
$name = stripslashes( $name );
|
||||
$name = $this->normalize($name);
|
||||
$name = rawurldecode( $name );
|
||||
return $name;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @dash and underscore (metakey)
|
||||
***/
|
||||
function safe_string($string){
|
||||
|
||||
$regex_safe_string = apply_filters('um_validation_safe_string_regex',$this->regex_safe );
|
||||
/**
|
||||
* Password test
|
||||
*
|
||||
* @param $candidate
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function strong_pass( $candidate ) {
|
||||
$r1='/[A-Z]/';
|
||||
$r2='/[a-z]/';
|
||||
$r3='/[0-9]/';
|
||||
if(preg_match_all($r1,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r2,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r3,$candidate, $o)<1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !preg_match( $regex_safe_string, $string) ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @is phone number
|
||||
***/
|
||||
function is_phone_number( $string ){
|
||||
if ( !$string )
|
||||
return true;
|
||||
if ( !preg_match( $this->regex_phone_number, $string) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Space, dash, underscore
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function safe_username( $string ) {
|
||||
|
||||
/***
|
||||
*** @is url
|
||||
***/
|
||||
function is_url( $url, $social = false ){
|
||||
if ( !$url ) return true;
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_validation_safe_username_regex
|
||||
* @description Change validation regex for username
|
||||
* @input_vars
|
||||
* [{"var":"$regex_safe","type":"string","desc":"Regex"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_validation_safe_username_regex', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_validation_safe_username_regex', 'my_validation_safe_username', 10, 1 );
|
||||
* function my_validation_safe_username( $regex_safe ) {
|
||||
* // your code here
|
||||
* return $regex_safe;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$regex_safe_username = apply_filters('um_validation_safe_username_regex',$this->regex_safe );
|
||||
|
||||
if ( $social ) {
|
||||
if ( is_email( $string ) )
|
||||
return true;
|
||||
if ( !is_email( $string) && !preg_match( $regex_safe_username, $string ) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) { // starts with social requested
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if ( filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) {
|
||||
return true;
|
||||
} elseif ( preg_match( $this->regex_safe, $url) ) {
|
||||
/**
|
||||
* Dash and underscore (metakey)
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function safe_string( $string ) {
|
||||
|
||||
if ( strstr( $url, '.com' ) ){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_validation_safe_string_regex
|
||||
* @description Change validation regex for each string
|
||||
* @input_vars
|
||||
* [{"var":"$regex_safe","type":"string","desc":"Regex"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_validation_safe_string_regex', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_validation_safe_string_regex', 'my_validation_safe_string', 10, 1 );
|
||||
* function my_validation_safe_string( $regex_safe ) {
|
||||
* // your code here
|
||||
* return $regex_safe;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$regex_safe_string = apply_filters('um_validation_safe_string_regex',$this->regex_safe );
|
||||
|
||||
}
|
||||
if ( !preg_match( $regex_safe_string, $string) ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
/**
|
||||
* Ss phone number
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_phone_number( $string ) {
|
||||
if ( !$string )
|
||||
return true;
|
||||
if ( !preg_match( $this->regex_phone_number, $string) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( strstr( $url, 'http://') || strstr( $url, 'https://') )
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* Is url
|
||||
*
|
||||
* @param $url
|
||||
* @param bool $social
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_url( $url, $social = false ){
|
||||
if ( !$url ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( $social ) {
|
||||
|
||||
/***
|
||||
*** @get a random string
|
||||
***/
|
||||
function randomize( $length = 10 ) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$result = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$result .= $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
if ( !filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) { // starts with social requested
|
||||
return true;
|
||||
} else {
|
||||
|
||||
/***
|
||||
*** @generate a password, hash, or similar
|
||||
***/
|
||||
function generate( $length = 40 ) {
|
||||
return wp_generate_password( $length, false );
|
||||
}
|
||||
if ( filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) {
|
||||
return true;
|
||||
} elseif ( preg_match( $this->regex_safe, $url) ) {
|
||||
|
||||
/***
|
||||
*** @random numbers only
|
||||
***/
|
||||
function random_number($len = false) {
|
||||
$ints = array();
|
||||
$len = $len ? $len : rand(2,9);
|
||||
if($len > 9)
|
||||
{
|
||||
trigger_error('Maximum length should not exceed 9');
|
||||
return 0;
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
$current = rand(0,9);
|
||||
if(!in_array($current,$ints))
|
||||
{
|
||||
$ints[] = $current;
|
||||
}
|
||||
if(count($ints) == $len)
|
||||
{
|
||||
return implode($ints);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( strstr( $url, '.com' ) ){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @To validate given date input
|
||||
***/
|
||||
function validate_date( $date, $format='YYYY/MM/D' ) {
|
||||
if ( strlen( $date ) < strlen($format) ) return false;
|
||||
if ( $date[4] != '/' ) return false;
|
||||
if ( $date[7] != '/' ) return false;
|
||||
if ( false === strtotime($date) ) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( strstr( $url, 'http://') || strstr( $url, 'https://') )
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a random string
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function randomize( $length = 10 ) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$result = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$result .= $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a password, hash, or similar
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function generate( $length = 40 ) {
|
||||
return wp_generate_password( $length, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Random numbers only
|
||||
*
|
||||
* @param bool $len
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
function random_number( $len = false ) {
|
||||
$ints = array();
|
||||
$len = $len ? $len : rand(2,9);
|
||||
if($len > 9)
|
||||
{
|
||||
trigger_error('Maximum length should not exceed 9');
|
||||
return 0;
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
$current = rand(0,9);
|
||||
if(!in_array($current,$ints))
|
||||
{
|
||||
$ints[] = $current;
|
||||
}
|
||||
if(count($ints) == $len)
|
||||
{
|
||||
return implode($ints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To validate given date input
|
||||
*
|
||||
* @param $date
|
||||
* @param string $format
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function validate_date( $date, $format='YYYY/MM/D' ) {
|
||||
if ( strlen( $date ) < strlen($format) ) return false;
|
||||
if ( $date[4] != '/' ) return false;
|
||||
if ( $date[7] != '/' ) return false;
|
||||
if ( false === strtotime($date) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,30 @@ function um_submit_account_errors_hook( $args ) {
|
||||
|
||||
$arr_fields = array();
|
||||
$account_fields = get_user_meta( um_user('ID'), 'um_account_secure_fields', true );
|
||||
$secure_fields = apply_filters( 'um_secure_account_fields', $account_fields , um_user( 'ID' ) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_secure_account_fields
|
||||
* @description Change secure account fields
|
||||
* @input_vars
|
||||
* [{"var":"$fields","type":"array","desc":"Secure account fields"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_secure_account_fields', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_secure_account_fields', 'my_secure_account_fields', 10, 2 );
|
||||
* function my_secure_account_fields( $fields, $user_id ) {
|
||||
* // your code here
|
||||
* return $fields;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secure_fields = apply_filters( 'um_secure_account_fields', $account_fields, um_user( 'ID' ) );
|
||||
|
||||
if ( is_array( $secure_fields ) ) {
|
||||
foreach ( $secure_fields as $tab_key => $fields ) {
|
||||
@@ -184,6 +207,27 @@ function um_submit_account_errors_hook( $args ) {
|
||||
unset( $changes['hide_in_members'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_pre_updating_profile_array
|
||||
* @description Change update profile data before saving
|
||||
* @input_vars
|
||||
* [{"var":"$changes","type":"array","desc":"Profile changes array"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_account_pre_updating_profile_array', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_pre_updating_profile_array', 'my_account_pre_updating_profile', 10, 1 );
|
||||
* function my_account_pre_updating_profile( $changes ) {
|
||||
* // your code here
|
||||
* return $changes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$changes = apply_filters( 'um_account_pre_updating_profile_array', $changes );
|
||||
|
||||
// fired on account page, just before updating profile
|
||||
|
||||
@@ -2,23 +2,46 @@
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Run check if username exists
|
||||
* @uses action hooks: wp_ajax_nopriv_ultimatemember_check_username_exists, wp_ajax_ultimatemember_check_username_exists
|
||||
* @return boolean
|
||||
*/
|
||||
add_action('wp_ajax_nopriv_ultimatemember_check_username_exists', 'ultimatemember_check_username_exists');
|
||||
add_action('wp_ajax_ultimatemember_check_username_exists', 'ultimatemember_check_username_exists');
|
||||
function ultimatemember_check_username_exists() {
|
||||
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
|
||||
$exists = username_exists( $username );
|
||||
|
||||
/**
|
||||
* Run check if username exists
|
||||
* @uses action hooks: wp_ajax_nopriv_ultimatemember_check_username_exists, wp_ajax_ultimatemember_check_username_exists
|
||||
* @return boolean
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_validate_username_exists
|
||||
* @description Change username exists validation
|
||||
* @input_vars
|
||||
* [{"var":"$exists","type":"bool","desc":"Exists?"},
|
||||
* {"var":"$username","type":"string","desc":"Username"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_validate_username_exists', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_validate_username_exists', 'my_validate_username_exists', 10, 2 );
|
||||
* function my_account_pre_updating_profile( $exists, $username ) {
|
||||
* // your code here
|
||||
* return $exists;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
add_action('wp_ajax_nopriv_ultimatemember_check_username_exists', 'ultimatemember_check_username_exists');
|
||||
add_action('wp_ajax_ultimatemember_check_username_exists', 'ultimatemember_check_username_exists');
|
||||
function ultimatemember_check_username_exists() {
|
||||
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
|
||||
$exists = username_exists( $username );
|
||||
$exists = apply_filters( 'um_validate_username_exists', $exists, $username );
|
||||
$exists = apply_filters( 'um_validate_username_exists', $exists, $username );
|
||||
|
||||
if( $exists ) {
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
if ( $exists ) {
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
die();
|
||||
}
|
||||
@@ -148,6 +148,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_custom_field_array
|
||||
* @description Extend custom field data on submit form error
|
||||
* @input_vars
|
||||
* [{"var":"$array","type":"array","desc":"Field data"},
|
||||
* {"var":"$fields","type":"array","desc":"All fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_get_custom_field_array', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_custom_field_array', 'my_get_custom_field_array', 10, 2 );
|
||||
* function my_get_custom_field_array( $array, $fields ) {
|
||||
* // your code here
|
||||
* return $array;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$array = apply_filters( 'um_get_custom_field_array', $array, $fields );
|
||||
|
||||
if ( ! empty( $array['conditions'] ) ) {
|
||||
|
||||
@@ -65,8 +65,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
UM()->form()->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimate-member') );
|
||||
}
|
||||
|
||||
// add a way for other plugins like wp limit login
|
||||
// to limit the login attempts
|
||||
$user = apply_filters( 'authenticate', null, $user_name, $args['user_password'] );
|
||||
|
||||
$authenticate_user = apply_filters( 'wp_authenticate_user', $user_name, $args['user_password'] );
|
||||
@@ -240,12 +238,78 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( UM()->user()->preview == true && is_admin() ) return;
|
||||
|
||||
$primary_btn_word = $args['primary_btn_word'];
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_login_form_button_one
|
||||
* @description Change Login Form Primary button
|
||||
* @input_vars
|
||||
* [{"var":"$primary_btn_word","type":"string","desc":"Button text"},
|
||||
* {"var":"$args","type":"array","desc":"Login Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_login_form_button_one', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_login_form_button_one', 'my_login_form_button_one', 10, 2 );
|
||||
* function my_login_form_button_one( $primary_btn_word, $args ) {
|
||||
* // your code here
|
||||
* return $primary_btn_word;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_login_form_button_two
|
||||
* @description Change Login Form Secondary button
|
||||
* @input_vars
|
||||
* [{"var":"$secondary_btn_word","type":"string","desc":"Button text"},
|
||||
* {"var":"$args","type":"array","desc":"Login Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_login_form_button_two', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_login_form_button_two', 'my_login_form_button_two', 10, 2 );
|
||||
* function my_login_form_button_two( $secondary_btn_word, $args ) {
|
||||
* // your code here
|
||||
* return $secondary_btn_word;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
|
||||
|
||||
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_login_form_button_two_url
|
||||
* @description Change Login Form Secondary button URL
|
||||
* @input_vars
|
||||
* [{"var":"$secondary_btn_url","type":"string","desc":"Button URL"},
|
||||
* {"var":"$args","type":"array","desc":"Login Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_login_form_button_two_url', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_login_form_button_two_url', 'my_login_form_button_two_url', 10, 2 );
|
||||
* function my_login_form_button_two_url( $secondary_btn_url, $args ) {
|
||||
* // your code here
|
||||
* return $secondary_btn_url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,8 +17,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$search_filters = apply_filters('um_frontend_member_search_filters',$search_filters);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_frontend_member_search_filters
|
||||
* @description Extend Member Directory Search filter
|
||||
* @input_vars
|
||||
* [{"var":"$search_filters","type":"array","desc":"Search Filters"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_frontend_member_search_filters', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_frontend_member_search_filters', 'my_frontend_member_search_filters', 10, 1 );
|
||||
* function my_frontend_member_search_filters( $search_filters ) {
|
||||
* // your code here
|
||||
* return $search_filters;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$search_filters = apply_filters( 'um_frontend_member_search_filters', $search_filters );
|
||||
|
||||
if ( $args['search'] == 1 && is_array( $search_filters ) ) { // search on
|
||||
|
||||
|
||||
@@ -41,9 +41,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$url = apply_filters('um_browser_url_redirect_to__filter', $url );
|
||||
if( ! empty( $url ) ){
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_browser_url_redirect_to__filter
|
||||
* @description Add redirect to field to form and change URL for it
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Redirect to URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_browser_url_redirect_to__filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_browser_url_redirect_to__filter', 'my_browser_url_redirect_to', 10, 1 );
|
||||
* function my_browser_url_redirect_to( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$url = apply_filters( 'um_browser_url_redirect_to__filter', $url );
|
||||
if ( ! empty( $url ) ) {
|
||||
echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_url( $url ) . '" />';
|
||||
}
|
||||
|
||||
@@ -64,7 +84,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
switch( $_REQUEST['updated'] ) {
|
||||
|
||||
default:
|
||||
$success = apply_filters("um_custom_success_message_handler", $success, $_REQUEST['updated']);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_success_message_handler
|
||||
* @description Add custom success message
|
||||
* @input_vars
|
||||
* [{"var":"$success","type":"string","desc":"Message"},
|
||||
* {"var":"$updated","type":"array","desc":"Updated data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_custom_success_message_handler', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_success_message_handler', 'my_custom_success_message', 10, 2 );
|
||||
* function my_custom_success_message( $success, $updated ) {
|
||||
* // your code here
|
||||
* return $success;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$success = apply_filters( "um_custom_success_message_handler", $success, $_REQUEST['updated'] );
|
||||
break;
|
||||
|
||||
case 'account':
|
||||
@@ -86,9 +128,31 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
switch( $_REQUEST['err'] ) {
|
||||
|
||||
default:
|
||||
$err = apply_filters("um_custom_error_message_handler", $err, $_REQUEST['err']);
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_error_message_handler
|
||||
* @description Add custom error message
|
||||
* @input_vars
|
||||
* [{"var":"$error","type":"string","desc":"Error message"},
|
||||
* {"var":"$request_error","type":"array","desc":"Error data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_custom_error_message_handler', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_error_message_handler', 'my_custom_error_message', 10, 2 );
|
||||
* function my_custom_error_message( $error, $request_error ) {
|
||||
* // your code here
|
||||
* return $error;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$err = apply_filters( "um_custom_error_message_handler", $err, $_REQUEST['err'] );
|
||||
if ( !$err )
|
||||
$err = __('An error has been encountered','ultimate-member');
|
||||
$err = __( 'An error has been encountered', 'ultimate-member' );
|
||||
break;
|
||||
|
||||
case 'registration_disabled':
|
||||
|
||||
@@ -13,9 +13,31 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! UM()->options()->get( 'profile_tab_main' ) && ! isset( $_REQUEST['um_action'] ) )
|
||||
return;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_can_view_main
|
||||
* @description Check user can view profile
|
||||
* @input_vars
|
||||
* [{"var":"$view","type":"bool","desc":"Can view?"},
|
||||
* {"var":"$user_id","type":"int","desc":"User profile ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_can_view_main', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_can_view_main', 'my_profile_can_view_main', 10, 2 );
|
||||
* function my_profile_can_view_main( $view, $user_id ) {
|
||||
* // your code here
|
||||
* return $view;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$can_view = apply_filters( 'um_profile_can_view_main', -1, um_profile_id() );
|
||||
|
||||
if ($can_view == -1) {
|
||||
if ( $can_view == -1 ) {
|
||||
|
||||
do_action( "um_before_form", $args );
|
||||
|
||||
@@ -120,6 +142,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
do_action( 'um_user_pre_updating_profile', $to_update );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_pre_updating_profile_array
|
||||
* @description Change submitted data before update profile
|
||||
* @input_vars
|
||||
* [{"var":"$to_update","type":"array","desc":"Profile data upgrade"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_pre_updating_profile_array', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_pre_updating_profile_array', 'my_user_pre_updating_profile', 10, 1 );
|
||||
* function my_user_pre_updating_profile( $to_update ) {
|
||||
* // your code here
|
||||
* return $to_update;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$to_update = apply_filters( 'um_user_pre_updating_profile_array', $to_update );
|
||||
|
||||
|
||||
@@ -128,6 +171,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
do_action( 'um_after_user_updated', um_user( 'ID' ), $args, $to_update );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_pre_updating_files_array
|
||||
* @description Change submitted files before update profile
|
||||
* @input_vars
|
||||
* [{"var":"$files","type":"array","desc":"Profile data files"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_pre_updating_files_array', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_pre_updating_files_array', 'my_user_pre_updating_files', 10, 1 );
|
||||
* function my_user_pre_updating_files( $files ) {
|
||||
* // your code here
|
||||
* return $files;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
|
||||
|
||||
if (is_array( $files )) {
|
||||
@@ -377,6 +441,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
'<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_photo_menu_view
|
||||
* @description Change user photo on menu view
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Photos"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_photo_menu_view', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_photo_menu_view', 'my_user_photo_menu_view', 10, 1 );
|
||||
* function my_user_photo_menu_view( $items ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_user_photo_menu_view', $items );
|
||||
|
||||
echo UM()->menu()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
@@ -389,6 +474,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
'<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_photo_menu_edit
|
||||
* @description Change user photo on menu edit
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Photos"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_photo_menu_edit', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_photo_menu_edit', 'my_user_photo_menu_edit', 10, 1 );
|
||||
* function my_user_photo_menu_edit( $items ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_user_photo_menu_edit', $items );
|
||||
|
||||
echo UM()->menu()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
@@ -574,12 +680,55 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$items = array_merge( $items, $actions );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_edit_menu_items
|
||||
* @description Edit menu items on profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"},
|
||||
* {"var":"$user_id","type":"int","desc":"Profile ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_edit_menu_items', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_edit_menu_items', 'my_profile_edit_menu_items', 10, 2 );
|
||||
* function my_profile_edit_menu_items( $items, $user_id ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
|
||||
|
||||
$items['cancel'] = $cancel;
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_myprofile_edit_menu_items
|
||||
* @description Edit menu items on my profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_myprofile_edit_menu_items', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_myprofile_edit_menu_items', 'my_myprofile_edit_menu_items', 10, 1 );
|
||||
* function my_myprofile_edit_menu_items( $items ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_myprofile_edit_menu_items', $items );
|
||||
|
||||
}
|
||||
@@ -673,6 +822,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
// get active tabs
|
||||
$tabs = UM()->profile()->tabs_active();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_profile_tabs
|
||||
* @description Extend profile tabs
|
||||
* @input_vars
|
||||
* [{"var":"$tabs","type":"array","desc":"Profile Tabs"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_profile_tabs', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_profile_tabs', 'my_user_profile_tabs', 10, 1 );
|
||||
* function my_user_profile_tabs( $tabs ) {
|
||||
* // your code here
|
||||
* return $tabs;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$tabs = apply_filters( 'um_user_profile_tabs', $tabs );
|
||||
|
||||
UM()->user()->tabs = $tabs;
|
||||
@@ -710,6 +880,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$nav_link = remove_query_arg( 'subnav', $nav_link );
|
||||
$nav_link = add_query_arg( 'profiletab', $id, $nav_link );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_menu_link_{$id}
|
||||
* @description Change profile menu link by tab $id
|
||||
* @input_vars
|
||||
* [{"var":"$nav_link","type":"string","desc":"Profile Tab Link"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_menu_link_{$id}', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_menu_link_{$id}', 'my_profile_menu_link', 10, 1 );
|
||||
* function my_profile_menu_link( $nav_link ) {
|
||||
* // your code here
|
||||
* return $nav_link;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$nav_link = apply_filters( "um_profile_menu_link_{$id}", $nav_link );
|
||||
|
||||
?>
|
||||
|
||||
@@ -149,6 +149,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( isset( UM()->form()->errors ) )
|
||||
return false;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_add_user_frontend_submitted
|
||||
* @description Extend user data on registration form submit
|
||||
* @input_vars
|
||||
* [{"var":"$submitted","type":"array","desc":"Registration data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_add_user_frontend_submitted', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_add_user_frontend_submitted', 'my_add_user_frontend_submitted', 10, 1 );
|
||||
* function my_add_user_frontend_submitted( $submitted ) {
|
||||
* // your code here
|
||||
* return $submitted;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$args = apply_filters( 'um_add_user_frontend_submitted', $args );
|
||||
|
||||
extract( $args );
|
||||
@@ -198,6 +219,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! isset( $user_email ) ) {
|
||||
$site_url = @$_SERVER['SERVER_NAME'];
|
||||
$user_email = 'nobody' . $unique_userID . '@' . $site_url;
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_register_submitted__email
|
||||
* @description Change user default email if it's empty on registration
|
||||
* @input_vars
|
||||
* [{"var":"$user_email","type":"string","desc":"Default email"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_register_submitted__email', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_register_submitted__email', 'my_user_register_submitted__email', 10, 1 );
|
||||
* function my_user_register_submitted__email( $user_email ) {
|
||||
* // your code here
|
||||
* return $user_email;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$user_email = apply_filters( 'um_user_register_submitted__email', $user_email );
|
||||
}
|
||||
|
||||
@@ -210,6 +252,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$args['submitted'] = array_merge( $args['submitted'], $credentials );
|
||||
$args = array_merge( $args, $credentials );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_registration_user_role
|
||||
* @description Change user role on registration process
|
||||
* @input_vars
|
||||
* [{"var":"$role","type":"string","desc":"User role"},
|
||||
* {"var":"$submitted","type":"array","desc":"Registration data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_registration_user_role', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_registration_user_role', 'my_registration_user_role', 10, 2 );
|
||||
* function my_user_register_submitted__email( $role, $submitted ) {
|
||||
* // your code here
|
||||
* return $role;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$user_role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
|
||||
|
||||
$userdata = array(
|
||||
@@ -245,6 +309,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if( empty( $role ) ) return;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_hidden_role_field
|
||||
* @description Display hidden role field
|
||||
* @input_vars
|
||||
* [{"var":"$role","type":"string","desc":"Hidden user role"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_hidden_role_field', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_hidden_role_field', 'my_register_hidden_role_field', 10, 1 );
|
||||
* function my_register_hidden_role_field( $role ) {
|
||||
* // your code here
|
||||
* return $role;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$role = apply_filters('um_register_hidden_role_field', $role );
|
||||
if( $role ){
|
||||
echo '<input type="hidden" name="role" id="role" value="' . $role . '" />';
|
||||
@@ -261,12 +346,78 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( isset( UM()->user()->preview ) && UM()->user()->preview == true && is_admin() ) return;
|
||||
|
||||
$primary_btn_word = $args['primary_btn_word'];
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_form_button_one
|
||||
* @description Change Register Form Primary button
|
||||
* @input_vars
|
||||
* [{"var":"$primary_btn_word","type":"string","desc":"Button text"},
|
||||
* {"var":"$args","type":"array","desc":"Registration Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_form_button_one', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_form_button_one', 'my_register_form_button_one', 10, 2 );
|
||||
* function my_register_form_button_one( $primary_btn_word, $args ) {
|
||||
* // your code here
|
||||
* return $primary_btn_word;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word, $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_form_button_two
|
||||
* @description Change Registration Form Secondary button
|
||||
* @input_vars
|
||||
* [{"var":"$secondary_btn_word","type":"string","desc":"Button text"},
|
||||
* {"var":"$args","type":"array","desc":"Registration Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_form_button_two', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_form_button_two', 'my_register_form_button_two', 10, 2 );
|
||||
* function my_register_form_button_two( $secondary_btn_word, $args ) {
|
||||
* // your code here
|
||||
* return $secondary_btn_word;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secondary_btn_word = apply_filters('um_register_form_button_two', $secondary_btn_word, $args );
|
||||
|
||||
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('login');
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_form_button_two_url
|
||||
* @description Change Registration Form Secondary button URL
|
||||
* @input_vars
|
||||
* [{"var":"$secondary_btn_url","type":"string","desc":"Button URL"},
|
||||
* {"var":"$args","type":"array","desc":"Registration Form arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_form_button_two_url', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_form_button_two_url', 'my_register_form_button_two_url', 10, 2 );
|
||||
* function my_register_form_button_two_url( $secondary_btn_url, $args ) {
|
||||
* // your code here
|
||||
* return $secondary_btn_url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secondary_btn_url = apply_filters('um_register_form_button_two_url', $secondary_btn_url, $args );
|
||||
|
||||
?>
|
||||
@@ -332,6 +483,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_pre_updating_files_array
|
||||
* @description Change submitted files before register new user
|
||||
* @input_vars
|
||||
* [{"var":"$files","type":"array","desc":"Profile data files"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_user_pre_updating_files_array', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_pre_updating_files_array', 'my_user_pre_updating_files', 10, 1 );
|
||||
* function my_user_pre_updating_files( $files ) {
|
||||
* // your code here
|
||||
* return $files;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
|
||||
|
||||
if ( !empty( $files ) ) {
|
||||
|
||||
@@ -12,7 +12,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
*/
|
||||
add_filter('um_account_secure_fields','um_account_secure_fields', 10, 2);
|
||||
function um_account_secure_fields( $fields, $tab_key ){
|
||||
$secure = apply_filters('um_account_secure_fields__enabled', true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_account_secure_fields__enabled
|
||||
* @description Active account secure fields
|
||||
* @input_vars
|
||||
* [{"var":"$enabled","type":"string","desc":"Enable secure account fields"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_account_secure_fields__enabled', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_account_secure_fields__enabled', 'my_account_secure_fields', 10, 1 );
|
||||
* function my_account_secure_fields( $enabled ) {
|
||||
* // your code here
|
||||
* return $enabled;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secure = apply_filters( 'um_account_secure_fields__enabled', true );
|
||||
|
||||
if( ! $secure ) return $fields;
|
||||
|
||||
|
||||
@@ -39,7 +39,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
$avatar = um_user('profile_photo', $size);
|
||||
|
||||
$image_alt = apply_filters("um_avatar_image_alternate_text", um_user("display_name") );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_avatar_image_alternate_text
|
||||
* @description Change avatar image alt
|
||||
* @input_vars
|
||||
* [{"var":"$avatar_alt","type":"string","desc":"Image alternate text. Display name by default"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
||||
* function my_avatar_image_alternate_text( $avatar_alt ) {
|
||||
* // your code here
|
||||
* return $avatar_alt;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$image_alt = apply_filters( "um_avatar_image_alternate_text", um_user("display_name") );
|
||||
|
||||
if ( ! $avatar && UM()->options()->get( 'use_gravatars' ) ) {
|
||||
|
||||
|
||||
@@ -206,8 +206,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
/***
|
||||
*** @global
|
||||
***/
|
||||
add_filter('um_profile_field_filter_hook__', 'um_profile_field_filter_hook__', 99, 2);
|
||||
function um_profile_field_filter_hook__( $value, $data ) {
|
||||
add_filter('um_profile_field_filter_hook__', 'um_profile_field_filter_hook__', 99, 3 );
|
||||
function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
|
||||
if ( !$value ) return '';
|
||||
|
||||
if ( ( isset( $data['validate'] ) && $data['validate'] != '' && strstr( $data['validate'], 'url' ) ) || ( isset( $data['type'] ) && $data['type'] == 'url' ) ) {
|
||||
@@ -322,8 +322,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
* @return mixed
|
||||
* @uses hook filter: um_profile_field_filter_hook__
|
||||
*/
|
||||
add_filter('um_profile_field_filter_hook__','um_force_utf8_fields', 10, 2 );
|
||||
function um_force_utf8_fields( $value, $data ) {
|
||||
add_filter('um_profile_field_filter_hook__','um_force_utf8_fields', 9, 3 );
|
||||
function um_force_utf8_fields( $value, $data, $type = '' ) {
|
||||
|
||||
if( ! UM()->options()->get('um_force_utf8_strings') )
|
||||
return $value;
|
||||
@@ -470,7 +470,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
* @return string $value
|
||||
* @uses hook filters: um_profile_field_filter_hook__
|
||||
*/
|
||||
function um_profile_field_filter_xss_validation( $value, $data, $type ) {
|
||||
function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
if ( ! empty( $value ) && is_string( $value ) ) {
|
||||
$value = stripslashes( $value );
|
||||
$data['validate'] = isset( $data['validate'] ) ? $data['validate'] : '';
|
||||
|
||||
@@ -3,23 +3,67 @@
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Support multisite
|
||||
***/
|
||||
add_filter('um_upload_basedir_filter','um_multisite_urls_support', 99 );
|
||||
add_filter('um_upload_baseurl_filter','um_multisite_urls_support', 99 );
|
||||
function um_multisite_urls_support( $dir ) {
|
||||
|
||||
if ( is_multisite() ) { // Need to the work
|
||||
|
||||
if ( get_current_blog_id() == '1' ) return $dir;
|
||||
|
||||
$sites_dir = apply_filters('um_multisite_upload_sites_directory', 'sites/' );
|
||||
$split = explode( $sites_dir, $dir );
|
||||
$um_dir = apply_filters('um_multisite_upload_directory','ultimatemember/');
|
||||
$dir = $split[0] . $um_dir;
|
||||
/***
|
||||
*** @Support multisite
|
||||
***/
|
||||
add_filter('um_upload_basedir_filter','um_multisite_urls_support', 99 );
|
||||
add_filter('um_upload_baseurl_filter','um_multisite_urls_support', 99 );
|
||||
function um_multisite_urls_support( $dir ) {
|
||||
|
||||
if ( is_multisite() ) { // Need to the work
|
||||
|
||||
if ( get_current_blog_id() == '1' ) {
|
||||
return $dir;
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_multisite_upload_sites_directory
|
||||
* @description Change multisite uploads directory
|
||||
* @input_vars
|
||||
* [{"var":"$sites_dir","type":"string","desc":"Upload sites directory"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_multisite_upload_sites_directory', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_multisite_upload_sites_directory', 'my_multisite_upload_sites_directory', 10, 1 );
|
||||
* function my_multisite_upload_sites_directory( $sites_dir ) {
|
||||
* // your code here
|
||||
* return $sites_dir;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$sites_dir = apply_filters('um_multisite_upload_sites_directory', 'sites/' );
|
||||
$split = explode( $sites_dir, $dir );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_multisite_upload_directory
|
||||
* @description Change multisite UM uploads directory
|
||||
* @input_vars
|
||||
* [{"var":"$um_dir","type":"string","desc":"Upload UM directory"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_multisite_upload_directory', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_multisite_upload_directory', 'my_multisite_upload_directory', 10, 1 );
|
||||
* function my_multisite_upload_directory( $um_dir ) {
|
||||
* // your code here
|
||||
* return $um_dir;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_dir = apply_filters('um_multisite_upload_directory','ultimatemember/');
|
||||
$dir = $split[0] . $um_dir;
|
||||
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
@@ -151,6 +151,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
'relation' => 'OR',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_query_args_{$field}__filter
|
||||
* @description Change field's query for search at Members Directory
|
||||
* @input_vars
|
||||
* [{"var":"$field_query","type":"array","desc":"Field query"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_query_args_{$field}__filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_query_args_{$field}__filter', 'my_query_args_filter', 10, 1 );
|
||||
* function my_query_args_filter( $field_query ) {
|
||||
* // your code here
|
||||
* return $field_query;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$field_query = apply_filters( "um_query_args_{$field}__filter", $field_query );
|
||||
$query_args['meta_query'][] = $field_query;
|
||||
}
|
||||
@@ -164,7 +185,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
}
|
||||
|
||||
// allow filtering
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_query_args_filter
|
||||
* @description Change query for search at Members Directory
|
||||
* @input_vars
|
||||
* [{"var":"$query_args","type":"array","desc":"Query Arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_query_args_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_query_args_filter', 'my_query_args_filter', 10, 1 );
|
||||
* function my_query_args_filter( $query_args ) {
|
||||
* // your code here
|
||||
* return $query_args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$query_args = apply_filters( 'um_query_args_filter', $query_args );
|
||||
|
||||
if ( count( $query_args['meta_query'] ) == 1 )
|
||||
@@ -293,6 +334,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$query_args['order'] = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_modify_sortby_parameter
|
||||
* @description Change query sort by attributes for search at Members Directory
|
||||
* @input_vars
|
||||
* [{"var":"$query_args","type":"array","desc":"Query Arguments"},
|
||||
* {"var":"$sortby","type":"string","desc":"Sort by"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_modify_sortby_parameter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_modify_sortby_parameter', 'my_modify_sortby_parameter', 10, 2 );
|
||||
* function my_modify_sortby_parameter( $query_args, $sortby ) {
|
||||
* // your code here
|
||||
* return $query_args;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$query_args = apply_filters('um_modify_sortby_parameter', $query_args, $sortby);
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,28 @@ if ( ! is_admin() ) {
|
||||
|
||||
}
|
||||
|
||||
// add filter to work with plugins that don't use traditional roles
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_nav_menu_roles_item_visibility
|
||||
* @description Add filter to work with plugins that don't use traditional roles
|
||||
* @input_vars
|
||||
* [{"var":"$visible","type":"bool","desc":"Visible?"},
|
||||
* {"var":"$item","type":"object","desc":"Menu Item"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_nav_menu_roles_item_visibility', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_nav_menu_roles_item_visibility', 'my_nav_menu_roles_item_visibility', 10, 2 );
|
||||
* function my_nav_menu_roles_item_visibility( $visible, $item ) {
|
||||
* // your code here
|
||||
* return $visible;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$visible = apply_filters( 'um_nav_menu_roles_item_visibility', $visible, $item );
|
||||
|
||||
// unset non-visible item
|
||||
|
||||
@@ -92,11 +92,31 @@ function um_clean_user_basename_filter( $value, $raw ){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$value = apply_filters("um_permalink_base_before_filter", $value );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_before_filter
|
||||
* @description Base permalink before
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_before_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_before_filter', 'my_permalink_base_before', 10, 1 );
|
||||
* function my_permalink_base_before( $permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_permalink_base_before_filter", $value );
|
||||
$raw_value = $value;
|
||||
|
||||
switch( $permalink_base ){
|
||||
switch( $permalink_base ) {
|
||||
case 'name':
|
||||
|
||||
|
||||
@@ -112,6 +132,28 @@ function um_clean_user_basename_filter( $value, $raw ){
|
||||
$value = str_replace( '.', ' ', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name
|
||||
* @description Base permalink after if permalink is username
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name', 'my_permalink_base_after_filter_name', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name", $value, $raw_value );
|
||||
|
||||
break;
|
||||
@@ -131,6 +173,28 @@ function um_clean_user_basename_filter( $value, $raw ){
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name_dash
|
||||
* @description Base permalink after if permalink is first name - last name
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name_dash', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name_dash', 'my_permalink_base_after_filter_name_dash', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name_dash( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name_dash", $value, $raw_value );
|
||||
|
||||
break;
|
||||
@@ -146,6 +210,28 @@ function um_clean_user_basename_filter( $value, $raw ){
|
||||
$value = str_replace( '_', '+', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name_plus
|
||||
* @description Base permalink after if permalink is first name + last name
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name_plus', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name_plus', 'my_permalink_base_after_filter_name_plus', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name_plus( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name_plus", $value, $raw_value );
|
||||
|
||||
break;
|
||||
@@ -157,6 +243,28 @@ function um_clean_user_basename_filter( $value, $raw ){
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter
|
||||
* @description Base permalink after for default permalink
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter', 'my_permalink_base_after', 10, 2 );
|
||||
* function my_permalink_base_after( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter", $value, $raw_value );
|
||||
|
||||
break;
|
||||
|
||||
@@ -39,7 +39,28 @@ $timestamp = $_POST['timestamp'];
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
$um_file_upload_nonce = apply_filters("um_file_upload_nonce", true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_file_upload_nonce
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_file_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_file_upload_nonce', 'my_file_upload_nonce', 10, 1 );
|
||||
* function my_file_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_file_upload_nonce = apply_filters( "um_file_upload_nonce", true );
|
||||
|
||||
if( $um_file_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in()) {
|
||||
@@ -56,9 +77,33 @@ if(isset($_FILES[$id]['name'])) {
|
||||
if(!is_array($_FILES[$id]['name'])) {
|
||||
|
||||
$temp = $_FILES[$id]["tmp_name"];
|
||||
$file = apply_filters('um_upload_file_name',$id."-".$_FILES[$id]["name"],$id,$_FILES[$id]["name"]);
|
||||
$file = sanitize_file_name($file);
|
||||
$extension = strtolower( pathinfo($file, PATHINFO_EXTENSION) );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_upload_file_name
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$filename","type":"string","desc":"Filename"},
|
||||
* {"var":"$id","type":"int","desc":"ID"},
|
||||
* {"var":"$name","type":"string","desc":"Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_upload_file_name', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_upload_file_name', 'my_upload_file_name', 10, 3 );
|
||||
* function my_upload_file_name( $filename, $id, $name ) {
|
||||
* // your code here
|
||||
* return $filename;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$file = apply_filters( 'um_upload_file_name', $id . "-" . $_FILES[ $id ]["name"], $id, $_FILES[ $id ]["name"] );
|
||||
$file = sanitize_file_name( $file );
|
||||
$extension = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
|
||||
|
||||
$error = UM()->files()->check_file_upload( $temp, $extension, $id );
|
||||
if ( $error ){
|
||||
|
||||
@@ -33,7 +33,28 @@ $nonce = $_POST['_wpnonce'];
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
$um_image_upload_nonce = apply_filters("um_image_upload_nonce", true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_upload_nonce
|
||||
* @description Change Image Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_image_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_upload_nonce', 'my_image_upload_nonce', 10, 1 );
|
||||
* function my_image_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_image_upload_nonce = apply_filters( "um_image_upload_nonce", true );
|
||||
|
||||
if( $um_image_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
|
||||
|
||||
@@ -76,6 +76,27 @@ function um_clean_user_basename( $value ) {
|
||||
$value = str_replace( '-', ' ', $value );
|
||||
$value = str_replace( '+', ' ', $value );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_clean_user_basename_filter
|
||||
* @description Change clean user basename
|
||||
* @input_vars
|
||||
* [{"var":"$basename","type":"string","desc":"User basename"},
|
||||
* {"var":"$raw_basename","type":"string","desc":"RAW user basename"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_clean_user_basename_filter', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_clean_user_basename_filter', 'my_clean_user_basename', 10, 2 );
|
||||
* function my_clean_user_basename( $basename, $raw_basename ) {
|
||||
* // your code here
|
||||
* return $basename;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( 'um_clean_user_basename_filter', $value, $raw_value );
|
||||
|
||||
return $value;
|
||||
@@ -113,6 +134,27 @@ function um_convert_tags( $content, $args = array(), $with_kses = true ) {
|
||||
'{user_avatar_url}',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_template_tags_patterns_hook
|
||||
* @description Extend UM placeholders
|
||||
* @input_vars
|
||||
* [{"var":"$placeholders","type":"array","desc":"UM Placeholders"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_template_tags_patterns_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_template_tags_patterns_hook', 'my_template_tags_patterns', 10, 1 );
|
||||
* function my_template_tags_patterns( $placeholders ) {
|
||||
* // your code here
|
||||
* $placeholders[] = '{my_custom_placeholder}';
|
||||
* return $placeholders;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$search = apply_filters( 'um_template_tags_patterns_hook', $search );
|
||||
|
||||
$replace = array(
|
||||
@@ -136,6 +178,27 @@ function um_convert_tags( $content, $args = array(), $with_kses = true ) {
|
||||
um_get_user_avatar_url(),
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_template_tags_replaces_hook
|
||||
* @description Extend UM replace placeholders
|
||||
* @input_vars
|
||||
* [{"var":"$replace_placeholders","type":"array","desc":"UM Replace Placeholders"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_template_tags_replaces_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_template_tags_replaces_hook', 'my_template_tags_replaces', 10, 1 );
|
||||
* function my_template_tags_replaces( $replace_placeholders ) {
|
||||
* // your code here
|
||||
* $replace_placeholders[] = 'my_replace_value';
|
||||
* return $replace_placeholders;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$replace = apply_filters( 'um_template_tags_replaces_hook', $replace );
|
||||
|
||||
$content = str_replace( $search, $replace, $content );
|
||||
@@ -193,6 +256,26 @@ function um_user_ip() {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_ip
|
||||
* @description Change User IP
|
||||
* @input_vars
|
||||
* [{"var":"$ip","type":"string","desc":"User IP"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_ip', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_ip', 'my_user_ip', 10, 1 );
|
||||
* function my_user_ip( $ip ) {
|
||||
* // your code here
|
||||
* return $ip;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_user_ip', $ip );
|
||||
}
|
||||
|
||||
@@ -430,6 +513,26 @@ function um_user_submitted_registration( $style = false ) {
|
||||
|
||||
if (isset( $data ) && is_array( $data )) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_registration_data
|
||||
* @description Prepare Registration data to email
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Registration Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_email_registration_data', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_registration_data', 'my_email_registration_data', 10, 1 );
|
||||
* function my_email_registration_data( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( 'um_email_registration_data', $data );
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
@@ -510,8 +613,74 @@ function um_filtered_value( $key, $data = false ) {
|
||||
|
||||
$type = ( isset( $data['type'] ) ) ? $data['type'] : '';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_field_filter_hook__
|
||||
* @description Change or filter field value
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"string","desc":"Field Value"},
|
||||
* {"var":"$data","type":"array","desc":"Field Data"},
|
||||
* {"var":"$type","type":"string","desc":"Field Type"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_field_filter_hook__', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_field_filter_hook__', 'my_profile_field', 10, 3 );
|
||||
* function my_profile_field( $value, $data, $type ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_field_filter_hook__", $value, $data, $type );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_field_filter_hook__{$key}
|
||||
* @description Change or filter field value by field key ($key)
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"string","desc":"Field Value"},
|
||||
* {"var":"$data","type":"array","desc":"Field Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_field_filter_hook__{$key}', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_field_filter_hook__{$key}', 'my_profile_field', 10, 2 );
|
||||
* function my_profile_field( $value, $data ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_field_filter_hook__{$key}", $value, $data );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_field_filter_hook__{$type}
|
||||
* @description Change or filter field value by field type ($type)
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"string","desc":"Field Value"},
|
||||
* {"var":"$data","type":"array","desc":"Field Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_field_filter_hook__{$type}', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_field_filter_hook__{$type}', 'my_profile_field', 10, 2 );
|
||||
* function my_profile_field( $value, $data ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_field_filter_hook__{$type}", $value, $data );
|
||||
$value = UM()->shortcodes()->emotize( $value );
|
||||
return $value;
|
||||
@@ -652,6 +821,28 @@ function um_get_core_page( $slug, $updated = false ) {
|
||||
$url = add_query_arg( 'updated', esc_attr( $updated ), $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_core_page_filter
|
||||
* @description Change UM core page URL
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"UM Page URL"},
|
||||
* {"var":"$slug","type":"string","desc":"UM Page slug"},
|
||||
* {"var":"$updated","type":"bool","desc":"Additional parameter"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_get_core_page_filter', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_core_page_filter', 'my_core_page_url', 10, 3 );
|
||||
* function my_core_page_url( $url, $slug, $updated ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_get_core_page_filter', $url, $slug, $updated );
|
||||
}
|
||||
|
||||
@@ -759,6 +950,28 @@ function um_select_if_in_query_params( $filter, $val ) {
|
||||
if (isset( $query[$filter] ) && $val == $query[$filter])
|
||||
$selected = true;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_selected_if_in_query_params
|
||||
* @description Make selected or unselected from query attribute
|
||||
* @input_vars
|
||||
* [{"var":"$selected","type":"bool","desc":"Selected or not"},
|
||||
* {"var":"$filter","type":"string","desc":"Check by this filter in query"},
|
||||
* {"var":"$val","type":"string","desc":"Field Value"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_selected_if_in_query_params', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_selected_if_in_query_params', 'my_selected_if_in_query_params', 10, 3 );
|
||||
* function my_selected_if_in_query_params( $selected, $filter, $val ) {
|
||||
* // your code here
|
||||
* return $selected;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$selected = apply_filters( 'um_selected_if_in_query_params', $selected, $filter, $val );
|
||||
}
|
||||
|
||||
@@ -965,6 +1178,26 @@ function um_edit_my_profile_cancel_uri( $url = '' ) {
|
||||
$url = add_query_arg( 'profiletab', 'main', $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_edit_profile_cancel_uri
|
||||
* @description Change Edit Profile Cancel URL
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Cancel URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_edit_profile_cancel_uri', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_edit_profile_cancel_uri', 'my_edit_profile_cancel_uri', 10, 1 );
|
||||
* function my_edit_profile_cancel_uri( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$url = apply_filters( 'um_edit_profile_cancel_uri', $url );
|
||||
|
||||
return $url;
|
||||
@@ -1228,14 +1461,53 @@ function um_fetch_user( $user_id ) {
|
||||
*/
|
||||
function um_profile( $key ) {
|
||||
|
||||
if (!empty( UM()->user()->profile[$key] )) {
|
||||
$value = apply_filters( "um_profile_{$key}__filter", UM()->user()->profile[$key] );
|
||||
if ( ! empty( UM()->user()->profile[ $key ] ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_{$key}__filter
|
||||
* @description Change not empty profile field value
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"mixed","desc":"Profile Value"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_{$key}__filter', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_{$key}__filter', 'my_profile_value', 10, 1 );
|
||||
* function my_profile_value( $value ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_{$key}__filter", UM()->user()->profile[ $key ] );
|
||||
} else {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_{$key}_empty__filter
|
||||
* @description Change Profile field value if it's empty
|
||||
* @input_vars
|
||||
* [{"var":"$value","type":"mixed","desc":"Profile Value"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_profile_{$key}_empty__filter', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_{$key}_empty__filter', 'my_profile_value', 10, 1 );
|
||||
* function my_profile_value( $value ) {
|
||||
* // your code here
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_profile_{$key}_empty__filter", false );
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,6 +1638,27 @@ function um_get_avatar_uri( $image, $attrs ) {
|
||||
$find = false;
|
||||
$ext = '.' . pathinfo( $image, PATHINFO_EXTENSION );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_filter_avatar_cache_time
|
||||
* @description Change Profile field value if it's empty
|
||||
* @input_vars
|
||||
* [{"var":"$timestamp","type":"timestamp","desc":"Avatar cache time"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_filter_avatar_cache_time', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_filter_avatar_cache_time', 'my_avatar_cache_time', 10, 2 );
|
||||
* function my_avatar_cache_time( $timestamp, $user_id ) {
|
||||
* // your code here
|
||||
* return $timestamp;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$cache_time = apply_filters( 'um_filter_avatar_cache_time', current_time( 'timestamp' ), um_user( 'ID' ) );
|
||||
|
||||
if (!empty( $cache_time )) {
|
||||
@@ -1450,11 +1743,30 @@ function um_get_user_avatar_url() {
|
||||
*/
|
||||
function um_get_default_cover_uri() {
|
||||
$uri = UM()->options()->get( 'default_cover' );
|
||||
$uri = !empty( $uri['url'] ) ? $uri['url'] : '';
|
||||
if ($uri) {
|
||||
$uri = apply_filters( 'um_get_default_cover_uri_filter', $uri );
|
||||
$uri = ! empty( $uri['url'] ) ? $uri['url'] : '';
|
||||
if ( $uri ) {
|
||||
|
||||
return $uri;
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_default_cover_uri_filter
|
||||
* @description Change Default Cover URL
|
||||
* @input_vars
|
||||
* [{"var":"$uri","type":"string","desc":"Default Cover URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_get_default_cover_uri_filter', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_default_cover_uri_filter', 'my_default_cover_uri', 10, 1 );
|
||||
* function my_default_cover_uri( $uri ) {
|
||||
* // your code here
|
||||
* return $uri;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_get_default_cover_uri_filter', $uri );
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -1509,6 +1821,26 @@ function um_user( $data, $attrs = null ) {
|
||||
$name = implode( '-', array_map( 'ucfirst', explode( '-', $name ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_{$data}_case
|
||||
* @description Change user name on um_user function
|
||||
* @input_vars
|
||||
* [{"var":"$name","type":"string","desc":"User Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_{$data}_case', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_{$data}_case', 'my_user_case', 10, 1 );
|
||||
* function my_user_case( $name ) {
|
||||
* // your code here
|
||||
* return $name;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$name = apply_filters( "um_user_{$data}_case", $name );
|
||||
|
||||
return $name;
|
||||
@@ -1640,6 +1972,28 @@ function um_user( $data, $attrs = null ) {
|
||||
$name = implode( '-', array_map( 'ucfirst', explode( '-', $name ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_display_name_filter
|
||||
* @description Change user display name on um_user function
|
||||
* @input_vars
|
||||
* [{"var":"$name","type":"string","desc":"User Name"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$html","type":"bool","desc":"Is HTML"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_display_name_filter', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_display_name_filter', 'my_user_display_name', 10, 3 );
|
||||
* function my_user_display_name( $name, $user_id, $html ) {
|
||||
* // your code here
|
||||
* return $name;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_user_display_name_filter', $name, um_user( 'ID' ), ( $attrs == 'html' ) ? 1 : 0 );
|
||||
|
||||
break;
|
||||
@@ -1670,6 +2024,27 @@ function um_user( $data, $attrs = null ) {
|
||||
|
||||
$has_profile_photo = false;
|
||||
$photo_type = 'um-avatar-default';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_avatar_image_alternate_text
|
||||
* @description Change user display name on um_user function profile photo
|
||||
* @input_vars
|
||||
* [{"var":"$display_name","type":"string","desc":"User Display Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
||||
* function my_avatar_image_alternate_text( $display_name ) {
|
||||
* // your code here
|
||||
* return $display_name;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$image_alt = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ) );
|
||||
|
||||
if (um_profile( 'profile_photo' )) {
|
||||
@@ -1682,6 +2057,27 @@ function um_user( $data, $attrs = null ) {
|
||||
$avatar_uri = um_get_default_avatar_uri();
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_avatar_url_filter
|
||||
* @description Change user avatar URL
|
||||
* @input_vars
|
||||
* [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
|
||||
* function my_user_avatar_url( $avatar_uri ) {
|
||||
* // your code here
|
||||
* return $avatar_uri;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$avatar_uri = apply_filters( 'um_user_avatar_url_filter', $avatar_uri, um_user( 'ID' ) );
|
||||
|
||||
|
||||
@@ -1723,12 +2119,34 @@ function um_user( $data, $attrs = null ) {
|
||||
$is_default = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_cover_photo_uri__filter
|
||||
* @description Change user avatar URL
|
||||
* @input_vars
|
||||
* [{"var":"$cover_uri","type":"string","desc":"Cover URL"},
|
||||
* {"var":"$is_default","type":"bool","desc":"Default or not"},
|
||||
* {"var":"$attrs","type":"array","desc":"Attributes"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_cover_photo_uri__filter', 'function_name', 10, 3 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_cover_photo_uri__filter', 'my_user_cover_photo_uri', 10, 3 );
|
||||
* function my_user_cover_photo_uri( $cover_uri, $is_default, $attrs ) {
|
||||
* // your code here
|
||||
* return $cover_uri;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$cover_uri = apply_filters( 'um_user_cover_photo_uri__filter', $cover_uri, $is_default, $attrs );
|
||||
|
||||
if ($cover_uri)
|
||||
if ( $cover_uri )
|
||||
return '<img src="' . $cover_uri . '" alt="" />';
|
||||
|
||||
if (!$cover_uri)
|
||||
if ( ! $cover_uri )
|
||||
return '';
|
||||
|
||||
break;
|
||||
|
||||
@@ -24,6 +24,28 @@ class UM_Search_Widget extends \WP_Widget {
|
||||
|
||||
// Creating widget front-end
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title widget_title
|
||||
* @description UM Search Widget Title
|
||||
* @input_vars
|
||||
* [{"var":"$title","type":"string","desc":"UM Search Widget Title"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'widget_title', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'widget_title', 'my_widget_title', 10, 1 );
|
||||
* function my_widget_title( $title ) {
|
||||
* // your code here
|
||||
* return $title;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$title = apply_filters( 'widget_title', $instance['title'] );
|
||||
|
||||
// before and after widget arguments are defined by themes
|
||||
|
||||
+51
-29
@@ -2,36 +2,58 @@
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
<?php do_action('um_profile_before_header', $args ); ?>
|
||||
|
||||
<?php if ( um_is_on_edit_profile() ) { ?><form method="post" action=""><?php } ?>
|
||||
|
||||
<?php do_action('um_profile_header_cover_area', $args ); ?>
|
||||
|
||||
<?php do_action('um_profile_header', $args ); ?>
|
||||
<?php do_action('um_profile_before_header', $args );
|
||||
|
||||
<div class="um-profile-navbar <?php echo apply_filters( 'um_profile_navbar_classes', '' ) ?>">
|
||||
<?php do_action( 'um_profile_navbar', $args ); ?>
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
if ( um_is_on_edit_profile() ) { ?>
|
||||
<form method="post" action="">
|
||||
<?php }
|
||||
|
||||
<?php do_action( 'um_profile_menu', $args );
|
||||
|
||||
$nav = UM()->profile()->active_tab;
|
||||
$subnav = ( get_query_var('subnav') ) ? get_query_var('subnav') : 'default';
|
||||
|
||||
print "<div class='um-profile-body $nav $nav-$subnav'>";
|
||||
|
||||
// Custom hook to display tabbed content
|
||||
do_action("um_profile_content_{$nav}", $args);
|
||||
do_action("um_profile_content_{$nav}_{$subnav}", $args);
|
||||
|
||||
print "</div>";
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( um_is_on_edit_profile() ) { ?></form><?php } ?>
|
||||
|
||||
do_action('um_profile_header_cover_area', $args );
|
||||
do_action('um_profile_header', $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_navbar_classes
|
||||
* @description Additional classes for profile navbar
|
||||
* @input_vars
|
||||
* [{"var":"$classes","type":"string","desc":"UM Posts Tab query"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_navbar_classes', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_navbar_classes', 'my_profile_navbar_classes', 10, 1 );
|
||||
* function my_profile_navbar_classes( $classes ) {
|
||||
* // your code here
|
||||
* return $classes;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$classes = apply_filters( 'um_profile_navbar_classes', '' ); ?>
|
||||
|
||||
<div class="um-profile-navbar <?php echo $classes ?>">
|
||||
<?php do_action( 'um_profile_navbar', $args ); ?>
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'um_profile_menu', $args );
|
||||
|
||||
$nav = UM()->profile()->active_tab;
|
||||
$subnav = ( get_query_var('subnav') ) ? get_query_var('subnav') : 'default';
|
||||
|
||||
print "<div class='um-profile-body $nav $nav-$subnav'>";
|
||||
|
||||
// Custom hook to display tabbed content
|
||||
do_action("um_profile_content_{$nav}", $args);
|
||||
do_action("um_profile_content_{$nav}_{$subnav}", $args);
|
||||
|
||||
print "</div>";
|
||||
|
||||
if ( um_is_on_edit_profile() ) { ?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
+30
-12
@@ -1,23 +1,41 @@
|
||||
<?php $query_posts = UM()->query()->make('post_type=post&posts_per_page=10&offset=0&author=' . um_get_requested_user() ); ?>
|
||||
<?php $query_posts = UM()->query()->make('post_type=post&posts_per_page=10&offset=0&author=' . um_get_requested_user() );
|
||||
|
||||
<?php UM()->shortcodes()->loop = apply_filters('um_profile_query_make_posts', $query_posts ); ?>
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_query_make_posts
|
||||
* @description Some changes of WP_Query Posts Tab
|
||||
* @input_vars
|
||||
* [{"var":"$query_posts","type":"WP_Query","desc":"UM Posts Tab query"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_query_make_posts', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_query_make_posts', 'my_profile_query_make_posts', 10, 1 );
|
||||
* function my_profile_query_make_posts( $query_posts ) {
|
||||
* // your code here
|
||||
* return $query_posts;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
UM()->shortcodes()->loop = apply_filters( 'um_profile_query_make_posts', $query_posts );
|
||||
|
||||
<?php if ( UM()->shortcodes()->loop->have_posts()) { ?>
|
||||
|
||||
<?php UM()->shortcodes()->load_template('profile/posts-single'); ?>
|
||||
if ( UM()->shortcodes()->loop->have_posts() ) {
|
||||
|
||||
UM()->shortcodes()->load_template( 'profile/posts-single' ); ?>
|
||||
|
||||
<div class="um-ajax-items">
|
||||
|
||||
<!--Ajax output-->
|
||||
|
||||
<?php if ( UM()->shortcodes()->loop->found_posts >= 10 ) { ?>
|
||||
|
||||
<div class="um-load-items">
|
||||
<a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_get_requested_user(); ?>"><?php _e('load more posts','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="um-load-items">
|
||||
<a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_get_requested_user(); ?>"><?php _e('load more posts','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
Plugin Name: Ultimate Member
|
||||
Plugin URI: http://ultimatemember.com/
|
||||
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
Version: 2.0.1
|
||||
Version: 2.0.2
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
|
||||
+48
-50
@@ -8,13 +8,13 @@
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit;
|
||||
|
||||
if ( ! defined( 'um_path' ) )
|
||||
define( 'um_path', plugin_dir_path( __FILE__ ) );
|
||||
define( 'um_path', plugin_dir_path( __FILE__ ) );
|
||||
|
||||
if ( ! defined( 'um_url' ) )
|
||||
define( 'um_url', plugin_dir_url( __FILE__ ) );
|
||||
define( 'um_url', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
if ( ! defined( 'um_plugin' ) )
|
||||
define( 'um_plugin', plugin_basename( __FILE__ ) );
|
||||
define( 'um_plugin', plugin_basename( __FILE__ ) );
|
||||
|
||||
//for delete Email options only for Core email notifications
|
||||
remove_all_filters( 'um_email_notifications' );
|
||||
@@ -27,59 +27,59 @@ require_once plugin_dir_path( __FILE__ ) . 'includes/class-init.php';
|
||||
$delete_options = UM()->options()->get( 'uninstall_on_delete' );
|
||||
if ( ! empty( $delete_options ) ) {
|
||||
|
||||
//remove core pages
|
||||
foreach ( UM()->config()->core_pages as $page_key => $page_value ) {
|
||||
$page_id = UM()->options()->get( apply_filters( 'um_core_page_id_filter', 'core_' . $page_key ) );
|
||||
if ( ! empty( $page_id ) )
|
||||
wp_delete_post( $page_id, true );
|
||||
}
|
||||
//remove core pages
|
||||
foreach ( UM()->config()->core_pages as $page_key => $page_value ) {
|
||||
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( $page_key ) );
|
||||
if ( ! empty( $page_id ) )
|
||||
wp_delete_post( $page_id, true );
|
||||
}
|
||||
|
||||
//remove core settings
|
||||
$settings_defaults = UM()->config()->settings_defaults;
|
||||
foreach ( $settings_defaults as $k => $v ) {
|
||||
UM()->options()->remove( $k );
|
||||
}
|
||||
//remove core settings
|
||||
$settings_defaults = UM()->config()->settings_defaults;
|
||||
foreach ( $settings_defaults as $k => $v ) {
|
||||
UM()->options()->remove( $k );
|
||||
}
|
||||
|
||||
//delete UM Custom Post Types posts
|
||||
$um_posts = get_posts( array(
|
||||
'post_type' => array(
|
||||
'um_form',
|
||||
'um_directory',
|
||||
'um_role'
|
||||
),
|
||||
'numberposts' => -1
|
||||
) );
|
||||
//delete UM Custom Post Types posts
|
||||
$um_posts = get_posts( array(
|
||||
'post_type' => array(
|
||||
'um_form',
|
||||
'um_directory',
|
||||
'um_role'
|
||||
),
|
||||
'numberposts' => -1
|
||||
) );
|
||||
|
||||
foreach ( $um_posts as $um_post )
|
||||
wp_delete_post( $um_post->ID, 1 );
|
||||
foreach ( $um_posts as $um_post )
|
||||
wp_delete_post( $um_post->ID, 1 );
|
||||
|
||||
delete_option( 'um_options' );
|
||||
delete_option( 'um_version' );
|
||||
delete_option( 'um_is_installed' );
|
||||
delete_option( 'um_core_forms' );
|
||||
delete_option( 'um_core_directories' );
|
||||
delete_option( 'um_last_version_upgrade' );
|
||||
delete_option( 'um_first_setup_roles' );
|
||||
delete_option( 'um_hashed_passwords_fix' );
|
||||
delete_option( 'um_cached_users_queue' );
|
||||
delete_option( 'um_options-transients' );
|
||||
delete_option( 'um_cached_role_admin' );
|
||||
delete_option( 'um_cached_role_member' );
|
||||
delete_option( 'um_cache_fonticons' );
|
||||
delete_option( 'widget_um_search_widget' );
|
||||
delete_option( '__ultimatemember_sitekey' );
|
||||
delete_option( 'um_options' );
|
||||
delete_option( 'um_version' );
|
||||
delete_option( 'um_is_installed' );
|
||||
delete_option( 'um_core_forms' );
|
||||
delete_option( 'um_core_directories' );
|
||||
delete_option( 'um_last_version_upgrade' );
|
||||
delete_option( 'um_first_setup_roles' );
|
||||
delete_option( 'um_hashed_passwords_fix' );
|
||||
delete_option( 'um_cached_users_queue' );
|
||||
delete_option( 'um_options-transients' );
|
||||
delete_option( 'um_cached_role_admin' );
|
||||
delete_option( 'um_cached_role_member' );
|
||||
delete_option( 'um_cache_fonticons' );
|
||||
delete_option( 'widget_um_search_widget' );
|
||||
delete_option( '__ultimatemember_sitekey' );
|
||||
|
||||
foreach ( wp_load_alloptions() as $k => $v ) {
|
||||
if ( substr( $k, 0, 18 ) == 'um_cache_userdata_' )
|
||||
delete_option( $k );
|
||||
}
|
||||
foreach ( wp_load_alloptions() as $k => $v ) {
|
||||
if ( substr( $k, 0, 18 ) == 'um_cache_userdata_' )
|
||||
delete_option( $k );
|
||||
}
|
||||
|
||||
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$wpdb->query(
|
||||
"DELETE
|
||||
$wpdb->query(
|
||||
"DELETE
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key LIKE '_um%' OR
|
||||
meta_key LIKE 'um%' OR
|
||||
@@ -100,7 +100,5 @@ if ( ! empty( $delete_options ) ) {
|
||||
meta_key = '_cannot_add_review' OR
|
||||
meta_key = 'synced_profile_photo' OR
|
||||
meta_key = 'full_name'"
|
||||
);
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user