- hook docs;

This commit is contained in:
nikitozzzzzzz
2018-03-05 16:35:51 +02:00
parent 2e619ae995
commit 12891ff743
44 changed files with 3820 additions and 392 deletions
+39 -2
View File
@@ -76,9 +76,46 @@ if ( ! class_exists( 'Admin' ) ) {
require_once 'core/um-admin-filters-fields.php';
if ( is_admin() && current_user_can('manage_options') &&
! empty( $_REQUEST['um_adm_action'] ) ) {
if ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_REQUEST['um_adm_action'] ) ) {
/**
* UM hook
*
* @type action
* @title um_admin_do_action__
* @description Make some action on custom admin action
* @input_vars
* [{"var":"$action","type":"string","desc":"Admin Action"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_do_action__', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_do_action__', 'my_admin_do_action', 10, 1 );
* function my_admin_do_action( $action ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_do_action__", $_REQUEST['um_adm_action'] );
/**
* UM hook
*
* @type action
* @title um_admin_do_action__{$action}
* @description Make some action on custom admin $action
* @input_vars
* [{"var":"$action","type":"string","desc":"Admin Action"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_do_action__{$action}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_do_action__{$action}', 'my_admin_do_action', 10, 1 );
* function my_admin_do_action( $action ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_do_action__{$_REQUEST['um_adm_action']}", $_REQUEST['um_adm_action'] );
}
}
+103 -7
View File
@@ -458,7 +458,10 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
if ( !is_user_logged_in() || !current_user_can('manage_options') ) die( __('Please login as administrator','ultimate-member') );
extract($_POST);
/**
* @var $act_id
*/
extract( $_POST );
switch ( $act_id ) {
@@ -466,8 +469,44 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
ob_start();
do_action('um_admin_ajax_modal_content__hook', $act_id );
do_action("um_admin_ajax_modal_content__hook_{$act_id}");
/**
* UM hook
*
* @type action
* @title um_admin_ajax_modal_content__hook
* @description Integration hook on ajax popup admin builder modal content
* @input_vars
* [{"var":"$act_id","type":"string","desc":"Ajax Action"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_ajax_modal_content__hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_ajax_modal_content__hook', 'my_admin_custom_hook', 10, 1 );
* function um_admin_ajax_modal_content__hook( $act_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_ajax_modal_content__hook', $act_id );
/**
* UM hook
*
* @type action
* @title um_admin_ajax_modal_content__hook_{$act_id}
* @description Integration hook on ajax popup admin builder modal content
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'my_admin_ajax_modal_content', 10 );
* function my_admin_ajax_modal_content() {
* // your code here
* }
* ?>
*/
do_action( "um_admin_ajax_modal_content__hook_{$act_id}" );
$output = ob_get_contents();
ob_end_clean();
@@ -605,7 +644,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
<?php if ( isset( $args['mce_content'] ) ) { ?><div class="dynamic-mce-content"><?php echo $metabox->edit_array['content']; ?></div><?php } ?>
<?php do_action('um_admin_field_modal_header'); ?>
<?php $this->modal_header(); ?>
<div class="um-admin-half">
@@ -625,7 +664,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
<?php do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?>
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
<?php
@@ -665,7 +704,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
<?php do_action('um_admin_field_modal_header'); ?>
<?php $this->modal_header(); ?>
<div class="um-admin-half">
@@ -685,7 +724,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt ); } ?>
<?php do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?>
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
<?php
@@ -732,6 +771,63 @@ if ( ! class_exists( 'Admin_Builder' ) ) {
}
/**
*
*/
function modal_header() {
/**
* UM hook
*
* @type action
* @title um_admin_field_modal_header
* @description Modal Window Header
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_field_modal_header', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_field_modal_header', 'my_admin_field_modal_header', 10 );
* function my_admin_field_modal_header() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_field_modal_header' );
}
/**
* @param $arg2
* @param $args
* @param $metabox
*/
function modal_footer( $arg2, $args, $metabox ) {
/**
* UM hook
*
* @type action
* @title um_admin_field_modal_footer
* @description Modal Window Footer
* @input_vars
* [{"var":"$arg2","type":"string","desc":"Ajax Action"},
* {"var":"$args","type":"array","desc":"Modal window arguments"},
* {"var":"$in_edit","type":"bool","desc":"Is edit mode?"},
* {"var":"$edit_array","type":"array","desc":"Edit Array"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_field_modal_footer', 'function_name', 10, 4 );
* @example
* <?php
* add_action( 'um_admin_field_modal_footer', 'my_admin_field_modal_footer', 10, 4 );
* function my_admin_field_modal_footer( $arg2, $args, $in_edit, $edit_array ) {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, ( isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' );
}
/**
* Retrieves dropdown/multi-select options from a callback function
*/
+17 -1
View File
@@ -114,8 +114,24 @@ if ( ! class_exists( 'Admin_Menu' ) ) {
add_submenu_page( $this->slug, __( 'Member Directories', 'ultimate-member' ), __( 'Member Directories', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_directory', '' );
}
/**
* UM hook
*
* @type action
* @title um_extend_admin_menu
* @description Extend UM menu
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_extend_admin_menu', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_extend_admin_menu', 'my_extend_admin_menu', 10 );
* function my_extend_admin_menu() {
* // your code here
* }
* ?>
*/
do_action( 'um_extend_admin_menu' );
}
+120 -3
View File
@@ -125,8 +125,31 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
function save_metabox_custom( $post_id, $post ) {
// validate nonce
if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) || ! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) return $post_id;
if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) ||
! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) {
return $post_id;
}
/**
* UM hook
*
* @type action
* @title um_admin_custom_restrict_content_metaboxes
* @description Save metabox custom with restrict content
* @input_vars
* [{"var":"$post_id","type":"int","desc":"Post ID"},
* {"var":"$post","type":"array","desc":"Post data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10, 2 );
* function my_admin_custom_restrict_content( $post_id, $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_custom_restrict_content_metaboxes', $post_id, $post );
}
@@ -134,7 +157,32 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
function add_metabox_restrict_content() {
global $current_screen;
add_meta_box( 'um-admin-restrict-content', __( 'UM Content Restriction', 'ultimate-member' ), array( &$this, 'restrict_content_cb' ), $current_screen->id, 'normal', 'default' );
add_meta_box(
'um-admin-restrict-content',
__( 'UM Content Restriction', 'ultimate-member' ),
array( &$this, 'restrict_content_cb' ),
$current_screen->id,
'normal',
'default'
);
/**
* UM hook
*
* @type action
* @title um_admin_custom_restrict_content_metaboxes
* @description Add restrict content custom metabox
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10 );
* function my_admin_custom_restrict_content() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_custom_restrict_content_metaboxes' );
}
@@ -799,18 +847,68 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
add_meta_box('um-admin-form-register_customize', __( 'Customize this form' ), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');
/**
* UM hook
*
* @type action
* @title um_admin_custom_register_metaboxes
* @description Add custom metaboxes for register form
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_register_metaboxes', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_custom_register_metaboxes', 'my_admin_custom_register_metaboxes', 10 );
* function my_admin_custom_register_metaboxes() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_custom_register_metaboxes' );
add_meta_box('um-admin-form-profile_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');
add_meta_box('um-admin-form-profile_settings', __('User Meta'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');
/**
* UM hook
*
* @type action
* @title um_admin_custom_profile_metaboxes
* @description Add custom metaboxes for profile form
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_profile_metaboxes', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_custom_profile_metaboxes', 'my_admin_custom_profile_metaboxes', 10 );
* function my_admin_custom_profile_metaboxes() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_custom_profile_metaboxes' );
add_meta_box('um-admin-form-login_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');
add_meta_box('um-admin-form-login_settings', __('Options'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');
/**
* UM hook
*
* @type action
* @title um_admin_custom_login_metaboxes
* @description Add custom metaboxes for login form
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_login_metaboxes', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_custom_login_metaboxes', 'my_admin_custom_login_metaboxes', 10 );
* function my_admin_custom_login_metaboxes() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_custom_login_metaboxes' );
}
/***
@@ -931,6 +1029,25 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
default:
/**
* UM hook
*
* @type action
* @title um_admin_field_edit_hook{$attribute}
* @description Integration for 3-d party fields at wp-admin
* @input_vars
* [{"var":"$edit_mode_value","type":"string","desc":"Post ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_field_edit_hook{$attribute}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_field_edit_hook{$attribute}', 'my_admin_field_edit', 10, 1 );
* function my_admin_field_edit( $edit_mode_value ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_field_edit_hook{$attribute}", $this->edit_mode_value );
break;
+18 -1
View File
@@ -93,7 +93,24 @@ if ( ! class_exists( 'Admin_Notices' ) ) {
}
do_action('um_admin_after_main_notices');
/**
* UM hook
*
* @type action
* @title um_admin_after_main_notices
* @description Insert some content after main admin notices
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_after_main_notices', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_after_main_notices', 'my_admin_after_main_notices', 10 );
* function my_admin_after_main_notices() {
* // your code here
* }
* ?>
*/
do_action( 'um_admin_after_main_notices' );
}
}
+162 -4
View File
@@ -1125,9 +1125,44 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
/**
* UM hook
*
* @type action
* @title um_settings_page_before_{$current_tab}_{$current_subtab}_content
* @description Show some content before settings page content
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'my_settings_page_before', 10 );
* function my_settings_page_before() {
* // your code here
* }
* ?>
*/
do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
if ( 'licenses' == $current_tab || 'install_info' == $current_tab ) {
/**
* UM hook
*
* @type action
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
* @description Show some content before section content at settings page
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
* function my_settings_page_before_section() {
* // your code here
* }
* ?>
*/
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
@@ -1171,7 +1206,25 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
<form method="post" action="" name="um-settings-form" id="um-settings-form">
<input type="hidden" value="save" name="um-settings-action" />
<?php do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
<?php
/**
* UM hook
*
* @type action
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
* @description Show some content before section content at settings page
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
* function my_settings_page_before_section() {
* // your code here
* }
* ?>
*/
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
@@ -1310,6 +1363,23 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
*/
function save_settings_handler() {
if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
/**
* UM hook
*
* @type action
* @title um_settings_before_save
* @description Before settings save action
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_settings_before_save', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_settings_before_save', 'my_settings_before_save', 10 );
* function my_settings_before_save() {
* // your code here
* }
* ?>
*/
do_action( "um_settings_before_save" );
/**
@@ -1338,6 +1408,23 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
UM()->options()->update( $key, $value );
}
/**
* UM hook
*
* @type action
* @title um_settings_save
* @description After settings save action
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_settings_save', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_settings_save', 'my_settings_save', 10 );
* function my_settings_save() {
* // your code here
* }
* ?>
*/
do_action( "um_settings_save" );
//redirect after save settings
@@ -1962,7 +2049,25 @@ if ( ! class_exists( 'Admin_Settings' ) ) {
## Please include this information when posting support requests ##
<?php do_action( 'um_install_info_before' ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_install_info_before
* @description Before install info settings
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_install_info_before', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_install_info_before', 'my_install_info_before', 10 );
* function my_install_info_before() {
* // your code here
* }
* ?>
*/
do_action( 'um_install_info_before' ); ?>
--- Site Info ---
@@ -2047,7 +2152,25 @@ Exclude CSS/JS on Home: <?php if( UM()->options()->get( 'js_css_exlcude_home'
--- UM Pages Configuration ---
<?php do_action("um_install_info_before_page_config") ?>
<?php
/**
* UM hook
*
* @type action
* @title um_install_info_before_page_config
* @description Before page config install info
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_install_info_before_page_config', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_install_info_before_page_config', 'my_install_info_before_page_config', 10 );
* function my_install_info_before_page_config() {
* // your code here
* }
* ?>
*/
do_action( "um_install_info_before_page_config" ); ?>
User: <?php echo get_permalink( UM()->options()->get('core_user') ) . "\n"; ?>
Account: <?php echo get_permalink( UM()->options()->get('core_account') ) . "\n"; ?>
Members: <?php echo get_permalink( UM()->options()->get('core_members') ) . "\n"; ?>
@@ -2055,7 +2178,25 @@ Register: <?php echo get_permalink( UM()->options()->get('core_register') )
Login: <?php echo get_permalink( UM()->options()->get('core_login') ) . "\n"; ?>
Logout: <?php echo get_permalink( UM()->options()->get('core_logout') ) . "\n"; ?>
Password Reset: <?php echo get_permalink( UM()->options()->get('core_password-reset') ) . "\n"; ?>
<?php do_action("um_install_info_after_page_config") ?>
<?php
/**
* UM hook
*
* @type action
* @title um_install_info_after_page_config
* @description After page config install info
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_install_info_after_page_config', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_install_info_after_page_config', 'my_install_info_after_page_config', 10 );
* function my_install_info_after_page_config() {
* // your code here
* }
* ?>
*/
do_action( "um_install_info_after_page_config" ); ?>
--- UM Users Configuration ---
@@ -2247,6 +2388,23 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
}
/**
* UM hook
*
* @type action
* @title um_install_info_after
* @description After install info
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_install_info_after', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_install_info_after', 'my_install_info_after', 10 );
* function my_install_info_after() {
* // your code here
* }
* ?>
*/
do_action( 'um_install_info_after' ); ?>
### End Install Info ###
+1 -1
View File
@@ -14,7 +14,7 @@ if ( ! class_exists( 'Admin_Upgrade' ) ) {
function __construct() {
$this->packages_dir = plugin_dir_path( __FILE__ ).'packages/';
$this->packages_dir = plugin_dir_path( __FILE__ ) . 'packages' . DIRECTORY_SEPARATOR;
$um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
+36
View File
@@ -304,8 +304,44 @@ if ( ! class_exists( 'Admin_Users' ) ) {
UM()->user()->set( $user_id );
if ( ! um_user( 'super_admin' ) ) {
/**
* UM hook
*
* @type action
* @title um_admin_user_action_hook
* @description Action on bulk user action
* @input_vars
* [{"var":"$bulk_action","type":"string","desc":"Bulk Action"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_user_action_hook{$action}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
* function my_admin_user_action( $bulk_action ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_user_action_hook", $bulk_action );
/**
* UM hook
*
* @type action
* @title um_admin_user_action_{$bulk_action}_hook
* @description Action on bulk user action
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_user_action_{$bulk_action}_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_user_action_{$bulk_action}_hook', 'my_admin_user_action', 10 );
* function my_admin_user_action() {
* // your code here
* }
* ?>
*/
do_action( "um_admin_user_action_{$bulk_action}_hook" );
} else {
@@ -12,8 +12,7 @@ if ( isset($_REQUEST['_wp_http_referer']) ) {
//remove extra query arg
if ( !empty( $_GET['_wp_http_referer'] ) ) {
do_action( 'wp_client_redirect', remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
exit;
um_js_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
}
$order_by = 'u.user_registered';
+58 -38
View File
@@ -3,44 +3,64 @@
if ( ! defined( 'ABSPATH' ) ) exit;
/***
*** @Does an action to user asap
***/
add_action('um_admin_user_action_hook', 'um_admin_user_action_hook');
function um_admin_user_action_hook( $action ){
switch ( $action ) {
/**
* Does an action to user asap
*
* @param string $action
*/
function um_admin_user_action_hook( $action ) {
switch ( $action ) {
default:
do_action("um_admin_custom_hook_{$action}", UM()->user()->id );
break;
default:
/**
* UM hook
*
* @type action
* @title um_admin_custom_hook_{$action}
* @description Integration hook on user action
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_custom_hook_{$action}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_custom_hook_{$action}', 'my_admin_custom_hook', 10, 1 );
* function my_admin_after_main_notices( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_custom_hook_{$action}", UM()->user()->id );
break;
case 'um_put_as_pending':
UM()->user()->pending();
break;
case 'um_approve_membership':
case 'um_reenable':
UM()->user()->approve();
break;
case 'um_reject_membership':
UM()->user()->reject();
break;
case 'um_resend_activation':
UM()->user()->email_pending();
break;
case 'um_deactivate':
UM()->user()->deactivate();
break;
case 'um_delete':
if ( is_admin() )
wp_die('This action is not allowed in backend.','ultimate-member');
UM()->user()->delete();
break;
case 'um_put_as_pending':
UM()->user()->pending();
break;
}
}
case 'um_approve_membership':
case 'um_reenable':
UM()->user()->approve();
break;
case 'um_reject_membership':
UM()->user()->reject();
break;
case 'um_resend_activation':
UM()->user()->email_pending();
break;
case 'um_deactivate':
UM()->user()->deactivate();
break;
case 'um_delete':
if ( is_admin() ) {
wp_die( 'This action is not allowed in backend.', 'ultimate-member' );
}
UM()->user()->delete();
break;
}
}
add_action( 'um_admin_user_action_hook', 'um_admin_user_action_hook', 10, 1 );
+38 -2
View File
@@ -171,8 +171,44 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$subaction = $_REQUEST['sub'];
do_action("um_admin_user_action_hook", $subaction);
do_action("um_admin_user_action_{$subaction}_hook");
/**
* UM hook
*
* @type action
* @title um_admin_user_action_hook
* @description Action on bulk user subaction
* @input_vars
* [{"var":"$subaction","type":"string","desc":"Bulk Subaction"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_user_action_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
* function my_admin_user_action( $subaction ) {
* // your code here
* }
* ?>
*/
do_action( "um_admin_user_action_hook", $subaction );
/**
* UM hook
*
* @type action
* @title um_admin_user_action_{$subaction}_hook
* @description Action on bulk user subaction
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_admin_user_action_{$subaction}_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_admin_user_action_{$subaction}_hook', 'my_admin_user_action', 10 );
* function my_admin_user_action() {
* // your code here
* }
* ?>
*/
do_action( "um_admin_user_action_{$subaction}_hook" );
um_reset_user();
+39 -3
View File
@@ -4,10 +4,46 @@ if ( ! defined( 'ABSPATH' ) ) {
}
wp_enqueue_script( 'postbox' );
wp_enqueue_media ();
wp_enqueue_media();
do_action( 'um_roles_add_meta_boxes', 'um_role_meta', '' );
do_action( 'um_roles_add_meta_boxes_um_role_meta' , '' );
/**
* UM hook
*
* @type action
* @title um_roles_add_meta_boxes
* @description Add meta boxes on add/edit UM Role
* @input_vars
* [{"var":"$meta","type":"string","desc":"Meta Box Key"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_roles_add_meta_boxes', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_roles_add_meta_boxes', 'my_roles_add_meta_boxes', 10, 1 );
* function my_roles_add_meta_boxes( $meta ) {
* // your code here
* }
* ?>
*/
do_action( 'um_roles_add_meta_boxes', 'um_role_meta' );
/**
* UM hook
*
* @type action
* @title um_roles_add_meta_boxes_um_role_meta
* @description Make add meta boxes on add/edit UM Role
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_roles_add_meta_boxes_um_role_meta', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_roles_add_meta_boxes_um_role_meta', 'my_roles_add_meta_boxes', 10 );
* function my_roles_add_meta_boxes() {
* // your code here
* }
* ?>
*/
do_action( 'um_roles_add_meta_boxes_um_role_meta' );
$data = array();
$option = array();
+85 -2
View File
@@ -333,13 +333,45 @@ if ( ! class_exists( 'Access' ) ) {
um_is_core_post( $post, 'login' ) )
return;
//check terms individual restrict options
/**
* UM hook
*
* @type action
* @title um_roles_add_meta_boxes_um_role_meta
* @description Check terms individual restrict options
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_check_individual_term_settings', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_access_check_individual_term_settings', 'my_access_check_individual_term_settings', 10 );
* function my_access_check_individual_term_settings() {
* // your code here
* }
* ?>
*/
do_action( 'um_access_check_individual_term_settings' );
//exit from function if term page is accessible
if ( $this->check_access() )
return;
//check global restrict content options
/**
* UM hook
*
* @type action
* @title um_access_check_global_settings
* @description Check global restrict content options
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_check_global_settings', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_access_check_global_settings', 'my_access_check_global_settings', 10 );
* function my_access_check_global_settings() {
* // your code here
* }
* ?>
*/
do_action( 'um_access_check_global_settings' );
$this->check_access();
@@ -578,6 +610,23 @@ if ( ! class_exists( 'Access' ) ) {
$this->current_single_post = $post;
add_filter( 'the_content', array( &$this, 'replace_post_content' ), 9999, 1 );
/**
* UM hook
*
* @type action
* @title um_access_fix_external_post_content
* @description Hook for 3-d party content filtration
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_fix_external_post_content', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_access_fix_external_post_content', 'my_access_fix_external_post_content', 10 );
* function my_access_fix_external_post_content() {
* // your code here
* }
* ?>
*/
do_action( 'um_access_fix_external_post_content' );
$filtered_posts[] = $post;
@@ -671,6 +720,23 @@ if ( ! class_exists( 'Access' ) ) {
}
}
/**
* UM hook
*
* @type action
* @title um_access_fix_external_post_content
* @description Hook for 3-d party content filtration
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_fix_external_post_content', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_access_fix_external_post_content', 'my_access_fix_external_post_content', 10 );
* function my_access_fix_external_post_content() {
* // your code here
* }
* ?>
*/
do_action( 'um_access_fix_external_post_content' );
$filtered_posts[] = $post;
@@ -740,6 +806,23 @@ if ( ! class_exists( 'Access' ) ) {
}
}
/**
* UM hook
*
* @type action
* @title um_access_fix_external_post_content
* @description Hook for 3-d party content filtration
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_fix_external_post_content', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_access_fix_external_post_content', 'my_access_fix_external_post_content', 10 );
* function my_access_fix_external_post_content() {
* // your code here
* }
* ?>
*/
do_action( 'um_access_fix_external_post_content' );
$filtered_posts[] = $post;
+174 -6
View File
@@ -167,10 +167,30 @@ if ( ! class_exists( 'Account' ) ) {
$this->current_tab = $args['tab'];
if ( ! empty( $this->tabs[$args['tab']] ) ) { ?>
if ( ! empty( $this->tabs[ $args['tab'] ] ) ) { ?>
<div class="um-form">
<form method="post" action="">
<?php do_action( 'um_account_page_hidden_fields', $args );
<?php
/**
* UM hook
*
* @type action
* @title um_account_page_hidden_fields
* @description Make some action before account tab loading
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_template_part', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_account_page_hidden_fields', 'my_account_page_hidden_fields', 10, 1 );
* function my_account_page_hidden_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_account_page_hidden_fields', $args );
$this->render_account_tab( $args['tab'], $this->tabs[$args['tab']], $args ); ?>
</form>
</div>
@@ -180,10 +200,65 @@ if ( ! class_exists( 'Account' ) ) {
$this->init_tabs( $args );
/**
* UM hook
*
* @type action
* @title um_pre_{$mode}_shortcode
* @description Make some action before account tabs loading
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_pre_{$mode}_shortcode', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_pre_{$mode}_shortcode', 'my_pre_account_shortcode', 10, 1 );
* function my_pre_account_shortcode( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_pre_{$args['mode']}_shortcode", $args );
/**
* UM hook
*
* @type action
* @title um_before_form_is_loaded
* @description Make some action before account tabs loading
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
* function my_before_form_is_loaded( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form_is_loaded", $args );
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_form_is_loaded
* @description Make some action before account tabs loading
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_form_is_loaded', 'my_before_account_form_is_loaded', 10, 1 );
* function my_before_account_form_is_loaded( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$args['mode']}_form_is_loaded", $args );
UM()->shortcodes()->template_load( $args['template'], $args );
@@ -239,7 +314,25 @@ if ( ! class_exists( 'Account' ) ) {
UM()->form()->post_form = $_POST;
//validate process
/**
* UM hook
*
* @type action
* @title um_submit_account_errors_hook
* @description Validate process on account submit
* @input_vars
* [{"var":"$submitted","type":"array","desc":"Account Page Submitted data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_account_errors_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_account_errors_hook', 'my_submit_account_errors', 10, 1 );
* function my_submit_account_errors( $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_account_errors_hook', UM()->form()->post_form );
if ( ! isset( UM()->form()->errors ) ) {
@@ -250,6 +343,25 @@ if ( ! class_exists( 'Account' ) ) {
$this->current_tab = UM()->form()->post_form['_um_account_tab'];
}
/**
* UM hook
*
* @type action
* @title um_submit_account_details
* @description On success account submit
* @input_vars
* [{"var":"$submitted","type":"array","desc":"Account Page Submitted data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_account_details', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_account_details', 'my_submit_account_details', 10, 1 );
* function my_submit_account_details( $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_account_details', UM()->form()->post_form );
}
@@ -567,10 +679,48 @@ if ( ! class_exists( 'Account' ) ) {
<?php }
/**
* UM hook
*
* @type action
* @title um_before_account_{$tab_id}
* @description Make some action before show account tab
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_account_{$tab_id}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_account_{$tab_id}', 'my_before_account_tab', 10, 1 );
* function my_before_account_tab( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_account_{$tab_id}", $args );
echo $output;
/**
* UM hook
*
* @type action
* @title um_after_account_{$tab_id}
* @description Make some action after show account tab
* @input_vars
* [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_account_{$tab_id}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_account_{$tab_id}', 'my_after_account_tab', 10, 1 );
* function my_after_account_tab( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_account_{$tab_id}", $args );
if ( ! isset( $tab_data['show_button'] ) || false !== $tab_data['show_button'] ) { ?>
@@ -580,7 +730,25 @@ if ( ! class_exists( 'Account' ) ) {
<input type="submit" name="um_account_submit" id="um_account_submit" class="um-button" value="<?php echo ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>" />
</div>
<?php do_action( "um_after_account_{$tab_id}_button" ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_account_{$tab_id}_button
* @description Make some action after show account tab button
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_account_{$tab_id}_button', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_account_{$tab_id}_button', 'my_after_account_tab_button', 10 );
* function my_after_account_tab_button() {
* // your code here
* }
* ?>
*/
do_action( "um_after_account_{$tab_id}_button" ); ?>
<div class="um-clear"></div>
</div>
+120 -91
View File
@@ -6,108 +6,137 @@ if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Common' ) ) {
class Common {
/**
* Common constructor.
*/
function __construct() {
add_action( 'init', array( &$this, 'create_post_types' ), 1 );
add_filter( 'posts_request', array( &$this, 'um_query_pages' ) );
}
/**
* Class Common
* @package um\core
*/
class Common {
/**
* Common constructor.
*/
function __construct() {
add_action( 'init', array( &$this, 'create_post_types' ), 1 );
add_filter( 'posts_request', array( &$this, 'um_query_pages' ) );
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000, 1 );
}
/**
* Create taxonomies for use for UM
*/
function create_post_types() {
/**
* Remove admin bar classes
*
* @param array $classes
*
* @return array
*/
function remove_admin_bar( $classes ) {
register_post_type( 'um_form', array(
'labels' => array(
'name' => __( 'Forms' ),
'singular_name' => __( 'Form' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __('Add New Form' ),
'edit_item' => __('Edit Form'),
'not_found' => __('You did not create any forms yet'),
'not_found_in_trash' => __('Nothing found in Trash'),
'search_items' => __('Search Forms')
),
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
'edit_posts' => 'manage_options',
'edit_others_posts' => 'manage_options',
'delete_posts' => 'manage_options',
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options'
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'supports' => array('title')
) );
if ( is_user_logged_in() ) {
if ( um_user( 'can_not_see_adminbar' ) ) {
$search = array_search( "admin-bar", $classes );
if ( ! empty( $search ) ) {
unset( $classes[ $search ] );
}
}
}
if ( UM()->options()->get( 'members_page' ) || ! get_option( 'um_options' ) ) {
register_post_type( 'um_directory', array(
'labels' => array(
'name' => __( 'Member Directories' ),
'singular_name' => __( 'Member Directory' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __('Add New Member Directory' ),
'edit_item' => __('Edit Member Directory'),
'not_found' => __('You did not create any member directories yet'),
'not_found_in_trash' => __('Nothing found in Trash'),
'search_items' => __('Search Member Directories')
),
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
'edit_posts' => 'manage_options',
'edit_others_posts' => 'manage_options',
'delete_posts' => 'manage_options',
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options'
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'supports' => array('title')
) );
}
}
return $classes;
}
/**
* Check query string on 'posts_request' for our pages
*
* @param string $q
*
* @return string
*/
public function um_query_pages( $q ) {
global $wp_query;
/**
* Create taxonomies for use for UM
*/
function create_post_types() {
//We need main query
if ( isset( $wp_query->request ) && $q == $wp_query->request ) {
register_post_type( 'um_form', array(
'labels' => array(
'name' => __( 'Forms' ),
'singular_name' => __( 'Form' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __('Add New Form' ),
'edit_item' => __('Edit Form'),
'not_found' => __('You did not create any forms yet'),
'not_found_in_trash' => __('Nothing found in Trash'),
'search_items' => __('Search Forms')
),
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
'edit_posts' => 'manage_options',
'edit_others_posts' => 'manage_options',
'delete_posts' => 'manage_options',
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options'
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'supports' => array('title')
) );
if ( ! empty( $wp_query->query_vars['um_page'] ) ) {
if ( UM()->options()->get( 'members_page' ) || ! get_option( 'um_options' ) ) {
if ( 'api' == $wp_query->query_vars['um_page'] ) {
$router = new Router();
$router->frontend_requests();
}
}
register_post_type( 'um_directory', array(
'labels' => array(
'name' => __( 'Member Directories' ),
'singular_name' => __( 'Member Directory' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __('Add New Member Directory' ),
'edit_item' => __('Edit Member Directory'),
'not_found' => __('You did not create any member directories yet'),
'not_found_in_trash' => __('Nothing found in Trash'),
'search_items' => __('Search Member Directories')
),
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
'edit_posts' => 'manage_options',
'edit_others_posts' => 'manage_options',
'delete_posts' => 'manage_options',
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options'
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'supports' => array('title')
) );
}
}
return $q;
}
}
}
/**
* Check query string on 'posts_request' for our pages
*
* @param string $q
*
* @return string
*/
public function um_query_pages( $q ) {
global $wp_query;
//We need main query
if ( isset( $wp_query->request ) && $q == $wp_query->request ) {
if ( ! empty( $wp_query->query_vars['um_page'] ) ) {
if ( 'api' == $wp_query->query_vars['um_page'] ) {
$router = new Router();
$router->frontend_requests();
}
}
}
return $q;
}
}
}
+104 -8
View File
@@ -753,7 +753,26 @@ if ( ! class_exists( 'Files' ) ) {
delete_user_meta( $user_id, $type );
do_action("um_after_remove_{$type}", $user_id);
/**
* UM hook
*
* @type action
* @title um_after_remove_{$type}
* @description Make some actions after remove file
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_remove_{$type}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_remove_{$type}', 'my_after_remove_file', 10, 1 );
* function my_after_remove_file( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_remove_{$type}", $user_id );
$dir = $this->upload_basedir . $user_id . '/';
$prefix = $type;
@@ -951,12 +970,12 @@ if ( ! class_exists( 'Files' ) ) {
// removes a synced profile photo
delete_user_meta( $user_id, 'synced_profile_photo' );
}else if ( $key == 'cover_photo' ) {
} else if ( $key == 'cover_photo' ) {
list($w, $h) = @getimagesize( $source );
$sizes = UM()->options()->get( 'cover_thumb_sizes' );
foreach( $sizes as $size ) {
foreach ( $sizes as $size ) {
$ratio = round( $w / $h, 2 );
$height = round( $size / $ratio, 2 );
@@ -996,14 +1015,91 @@ if ( ! class_exists( 'Files' ) ) {
unlink( $source );
rmdir( $dir );
// update user's meta
do_action('um_before_upload_db_meta', $user_id, $key );
do_action("um_before_upload_db_meta_{$key}", $user_id );
/**
* UM hook
*
* @type action
* @title um_before_upload_db_meta
* @description Update user's meta before upload
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$key","type":"string","desc":"Meta key"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_upload_db_meta', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_before_upload_db_meta', 'my_before_upload_db_meta', 10, 2 );
* function my_before_upload_db_meta( $user_id, $key ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_upload_db_meta', $user_id, $key );
/**
* UM hook
*
* @type action
* @title um_before_upload_db_meta_{$key}
* @description Update user's meta before upload
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_upload_db_meta_{$key}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_upload_db_meta_{$key}', 'my_before_upload_db_meta', 10, 1 );
* function my_before_upload_db_meta( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_upload_db_meta_{$key}", $user_id );
update_user_meta( $user_id, $key, $filename );
do_action('um_after_upload_db_meta', $user_id, $key );
do_action("um_after_upload_db_meta_{$key}", $user_id );
/**
* UM hook
*
* @type action
* @title um_after_upload_db_meta
* @description Update user's meta before upload
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$key","type":"string","desc":"Meta key"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_upload_db_meta', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_upload_db_meta', 'my_after_upload_db_meta', 10, 2 );
* function my_after_upload_db_meta( $user_id, $key ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_upload_db_meta', $user_id, $key );
/**
* UM hook
*
* @type action
* @title um_after_upload_db_meta_{$key}
* @description Update user's meta after upload
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_upload_db_meta_{$key}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_upload_db_meta_{$key}', 'my_after_upload_db_meta', 10, 1 );
* function my_after_upload_db_meta( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_upload_db_meta_{$key}", $user_id );
// the url of upload
return $this->upload_baseurl . $user_id . '/' . $filename;
+76 -1
View File
@@ -35,6 +35,25 @@ if ( ! class_exists( 'Form' ) ) {
switch( $hook ) {
default:
/**
* UM hook
*
* @type action
* @title um_run_ajax_function__{$hook}
* @description Action on AJAX muted action
* @input_vars
* [{"var":"$request","type":"int","desc":"Request"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_run_ajax_function__{$hook}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_run_ajax_function__{$hook}', 'my_run_ajax_function', 10, 1 );
* function my_run_ajax_function( $request ) {
* // your code here
* }
* ?>
*/
do_action( "um_run_ajax_function__{$hook}", $_REQUEST );
break;
}
@@ -192,6 +211,25 @@ if ( ! class_exists( 'Form' ) ) {
if ( $http_post && ! is_admin() && isset( $_POST['form_id'] ) && is_numeric( $_POST['form_id'] ) ) {
/**
* UM hook
*
* @type action
* @title um_before_submit_form_post
* @description Before submit form
* @input_vars
* [{"var":"$post","type":"int","desc":"Post data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_submit_form_post', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_submit_form_post', 'my_before_submit_form_post', 10, 1 );
* function my_run_ajax_function( $post ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_submit_form_post", $_POST );
$this->form_id = $_POST['form_id'];
@@ -307,8 +345,45 @@ if ( ! class_exists( 'Form' ) ) {
/* Continue based on form mode - pre-validation */
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook
* @description Action on submit form
* @input_vars
* [{"var":"$post","type":"int","desc":"Post data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook', 'my_submit_form_errors', 10, 1 );
* function my_submit_form_errors( $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_form_errors_hook', $this->post_form );
/**
* UM hook
*
* @type action
* @title um_submit_form_{$mode}
* @description Action on submit form
* @input_vars
* [{"var":"$post","type":"int","desc":"Post data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_{$mode}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_{$mode}', 'my_submit_form', 10, 1 );
* function my_submit_form( $post ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_{$this->post_form['mode']}", $this->post_form );
}
+62 -2
View File
@@ -152,11 +152,51 @@ if ( ! class_exists( 'Mail' ) ) {
}
ob_start();
/**
* UM hook
*
* @type action
* @title um_before_email_template_part
* @description Action before email template loading
* @input_vars
* [{"var":"$slug","type":"string","desc":"Email template slug"},
* {"var":"$located","type":"string","desc":"Email template location"},
* {"var":"$args","type":"array","desc":"Email template arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_email_template_part', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_before_email_template_part', 'my_before_email_template_part', 10, 3 );
* function my_before_email_template_part( $slug, $located, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_email_template_part', $slug, $located, $args );
include( $located );
/**
* UM hook
*
* @type action
* @title um_after_email_template_part
* @description Action after email template loading
* @input_vars
* [{"var":"$slug","type":"string","desc":"Email template slug"},
* {"var":"$located","type":"string","desc":"Email template location"},
* {"var":"$args","type":"array","desc":"Email template arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_email_template_part', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_after_email_template_part', 'my_after_email_template_part', 10, 3 );
* function my_after_email_template_part( $slug, $located, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_email_template_part', $slug, $located, $args );
return ob_get_clean();
@@ -200,6 +240,26 @@ if ( ! class_exists( 'Mail' ) ) {
*/
echo apply_filters( 'um_email_template_html_formatting', '<html>', $slug, $args );
/**
* UM hook
*
* @type action
* @title um_before_email_template_body
* @description Action before email template body display
* @input_vars
* [{"var":"$slug","type":"string","desc":"Email template slug"},
* {"var":"$args","type":"array","desc":"Email template arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_email_template_body', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_before_email_template_body', 'my_before_email_template_body', 10, 2 );
* function my_before_email_template_body( $slug, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_email_template_body', $slug, $args );
/**
+41 -2
View File
@@ -341,11 +341,50 @@ if ( ! class_exists( 'Members' ) ) {
$query_args = array();
}
do_action('um_user_before_query', $query_args );
/**
* UM hook
*
* @type action
* @title um_user_before_query
* @description Action before users query on member directory
* @input_vars
* [{"var":"$query_args","type":"array","desc":"Query arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_before_query', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_before_query', 'my_user_before_query', 10, 1 );
* function my_user_before_query( $query_args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_before_query', $query_args );
$users = new \WP_User_Query( $query_args );
do_action('um_user_after_query', $query_args, $users );
/**
* UM hook
*
* @type action
* @title um_user_after_query
* @description Action before users query on member directory
* @input_vars
* [{"var":"$query_args","type":"array","desc":"Query arguments"},
* {"var":"$users","type":"array","desc":"Users"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_after_query', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_user_after_query', 'my_user_after_query', 10, 2 );
* function my_user_after_query( $query_args, $users ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_after_query', $query_args, $users );
$array['users'] = isset( $users->results ) && ! empty( $users->results ) ? array_unique( $users->results ) : array();
+144 -13
View File
@@ -79,19 +79,57 @@ if ( ! class_exists( 'Password' ) ) {
}
/***
*** @password page form
***/
/**
* Password page form
*/
function form_init() {
if ( um_requesting_password_reset() ) {
UM()->form()->post_form = $_POST;
do_action('um_reset_password_errors_hook', UM()->form()->post_form );
/**
* UM hook
*
* @type action
* @title um_reset_password_errors_hook
* @description Action on reset password submit form
* @input_vars
* [{"var":"$post","type":"array","desc":"Form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_reset_password_errors_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_reset_password_errors_hook', 'my_reset_password_errors', 10, 1 );
* function my_reset_password_errors( $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_reset_password_errors_hook', UM()->form()->post_form );
if ( !isset( UM()->form()->errors) ) {
if ( ! isset( UM()->form()->errors ) ) {
do_action('um_reset_password_process_hook', UM()->form()->post_form );
/**
* UM hook
*
* @type action
* @title um_reset_password_process_hook
* @description Action on reset password success submit form
* @input_vars
* [{"var":"$post","type":"array","desc":"Form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_reset_password_process_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_reset_password_process_hook', 'my_reset_password_process', 10, 1 );
* function my_reset_password_process( $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_reset_password_process_hook', UM()->form()->post_form );
}
@@ -101,11 +139,49 @@ if ( ! class_exists( 'Password' ) ) {
UM()->form()->post_form = $_POST;
do_action('um_change_password_errors_hook', UM()->form()->post_form );
/**
* UM hook
*
* @type action
* @title um_change_password_errors_hook
* @description Action on change password submit form
* @input_vars
* [{"var":"$post","type":"array","desc":"Form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_change_password_errors_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_change_password_errors_hook', 'my_change_password_errors', 10, 1 );
* function my_change_password_errors( $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_change_password_errors_hook', UM()->form()->post_form );
if ( !isset( UM()->form()->errors ) ) {
if ( ! isset( UM()->form()->errors ) ) {
do_action('um_change_password_process_hook', UM()->form()->post_form );
/**
* UM hook
*
* @type action
* @title um_change_password_process_hook
* @description Action on change password success submit form
* @input_vars
* [{"var":"$post","type":"array","desc":"Form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_change_password_process_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_change_password_process_hook', 'my_change_password_process', 10, 1 );
* function my_change_password_process( $post ) {
* // your code here
* }
* ?>
*/
do_action( 'um_change_password_process_hook', UM()->form()->post_form );
}
@@ -218,10 +294,65 @@ if ( ! class_exists( 'Password' ) ) {
extract( $args, EXTR_SKIP );
do_action("um_pre_{$mode}_shortcode", $args);
do_action("um_before_form_is_loaded", $args);
/**
* UM hook
*
* @type action
* @title um_pre_{$mode}_shortcode
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_pre_{$mode}_shortcode', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_pre_{$mode}_shortcode', 'my_pre_password_shortcode', 10, 1 );
* function my_pre_password_shortcode( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_pre_{$mode}_shortcode", $args );
/**
* UM hook
*
* @type action
* @title um_before_form_is_loaded
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
* function my_before_form_is_loaded( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form_is_loaded", $args );
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_form_is_loaded
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
* function my_before_form_is_loaded( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$mode}_form_is_loaded", $args );
UM()->shortcodes()->template_load( $template, $args );
+22 -4
View File
@@ -208,7 +208,7 @@ if ( ! class_exists( 'Permalinks' ) ) {
/***
*** @activates an account via email
***/
function activate_account_via_email_link(){
function activate_account_via_email_link() {
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && is_string($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 &&
isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id']) ) { // valid token
@@ -225,7 +225,7 @@ if ( ! class_exists( 'Permalinks' ) ) {
$login = (bool) um_user('login_email_activate');
// log in automatically
if ( !is_user_logged_in() && $login ) {
if ( ! is_user_logged_in() && $login ) {
$user = get_userdata($user_id);
$user_id = $user->ID;
@@ -239,8 +239,26 @@ if ( ! class_exists( 'Permalinks' ) ) {
}
um_reset_user();
do_action('um_after_email_confirmation', $user_id );
/**
* UM hook
*
* @type action
* @title um_after_email_confirmation
* @description Action on user activation
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_email_confirmation', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_email_confirmation', 'my_after_email_confirmation', 10, 1 );
* function my_after_email_confirmation( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_email_confirmation', $user_id );
exit( wp_redirect( $redirect ) );
+27 -1
View File
@@ -16,11 +16,37 @@ if ( ! class_exists( 'Query' ) ) {
}
/**
* Ajax pagination for posts
*/
function ajax_paginate() {
extract( $_REQUEST );
/**
* @var $hook
* @var $args
*/
extract( $_REQUEST );
ob_start();
/**
* UM hook
*
* @type action
* @title um_ajax_load_posts__{$hook}
* @description Action on posts loading by AJAX
* @input_vars
* [{"var":"$args","type":"array","desc":"Query arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_ajax_load_posts__{$hook}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_ajax_load_posts__{$hook}', 'my_ajax_load_posts', 10, 1 );
* function my_ajax_load_posts( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_ajax_load_posts__{$hook}", $args );
$output = ob_get_contents();
+83 -1
View File
@@ -364,9 +364,29 @@ if ( ! class_exists( 'REST_API' ) ) {
$old_roles = $wp_user_object->roles;
$wp_user_object->set_role( $value );
/**
* UM hook
*
* @type action
* @title um_after_member_role_upgrade
* @description Action after user role was changed
* @input_vars
* [{"var":"$new_roles","type":"array","desc":"New User Roles"},
* {"var":"$old_roles","type":"array","desc":"Old roles"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_member_role_upgrade', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_member_role_upgrade', 'my_after_member_role_upgrade', 10, 2 );
* function my_after_member_role_upgrade( $new_roles, $old_roles ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_member_role_upgrade', array( $value ), $old_roles );
$response['success'] = __('User role has been changed.','ultimate-member');
$response['success'] = __( 'User role has been changed.', 'ultimate-member' );
break;
default:
update_user_meta( $id, $data, esc_attr( $value ) );
@@ -757,6 +777,27 @@ if ( ! class_exists( 'REST_API' ) ) {
status_header( $status_code );
/**
* UM hook
*
* @type action
* @title um_api_output_before
* @description Action before API output
* @input_vars
* [{"var":"$data","type":"array","desc":"API data"},
* {"var":"$rest_api","type":"object","desc":"REST API class"},
* {"var":"$format","type":"string","desc":"Format"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_api_output_before', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_api_output_before', 'my_api_output_before', 10, 3 );
* function my_api_output_before( $data, $rest_api, $format ) {
* // your code here
* }
* ?>
*/
do_action( 'um_api_output_before', $this->data, $this, $format );
switch ( $format ) :
@@ -784,12 +825,53 @@ if ( ! class_exists( 'REST_API' ) ) {
default :
// Allow other formats to be added via extensions
/**
* UM hook
*
* @type action
* @title um_api_output_{$format}
* @description Action before API output
* @input_vars
* [{"var":"$data","type":"array","desc":"API data"},
* {"var":"$rest_api","type":"object","desc":"REST API class"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_api_output_{$format}', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_api_output_{$format}', 'my_api_output', 10, 2 );
* function my_api_output( $data, $rest_api ) {
* // your code here
* }
* ?>
*/
do_action( 'um_api_output_' . $format, $this->data, $this );
break;
endswitch;
/**
* UM hook
*
* @type action
* @title um_api_output_after
* @description Action after API output
* @input_vars
* [{"var":"$data","type":"array","desc":"API data"},
* {"var":"$rest_api","type":"object","desc":"REST API class"},
* {"var":"$format","type":"string","desc":"Format"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_api_output_after', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_api_output_after', 'my_api_output_after', 10, 3 );
* function my_api_output_after( $data, $rest_api, $format ) {
* // your code here
* }
* ?>
*/
do_action( 'um_api_output_after', $this->data, $this, $format );
die();
+22 -3
View File
@@ -196,15 +196,34 @@ if ( ! class_exists( 'Rewrite' ) ) {
um_set_requested_user( $user_id );
do_action('um_access_profile', $user_id );
/**
* UM hook
*
* @type action
* @title um_access_profile
* @description Action on user access profile
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_access_profile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_access_profile', 'my_access_profile', 10, 1 );
* function my_access_profile( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_access_profile', $user_id );
} else {
exit( wp_redirect( um_get_core_page('user') ) );
exit( wp_redirect( um_get_core_page( 'user' ) ) );
}
} else if ( um_is_core_page('user') ) {
} else if ( um_is_core_page( 'user' ) ) {
if ( is_user_logged_in() ) { // just redirect to their profile
+96 -6
View File
@@ -118,19 +118,109 @@ if ( ! class_exists( 'Roles_Capabilities' ) ) {
$user->add_role( $new_role );
}
/**
* UM hook
*
* @type action
* @title um_when_role_is_set
* @description Action before user role changed
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_when_role_is_set', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_when_role_is_set', 'my_when_role_is_set', 10, 1 );
* function my_when_role_is_set( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_when_role_is_set', $user_id );
do_action('um_before_user_role_is_changed');
/**
* UM hook
*
* @type action
* @title um_before_user_role_is_changed
* @description Action before user role changed
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_user_role_is_changed', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_before_user_role_is_changed', 'my_before_user_role_is_changed', 10 );
* function my_before_user_role_is_changed() {
* // your code here
* }
* ?>
*/
do_action( 'um_before_user_role_is_changed' );
UM()->user()->profile['role'] = $new_role;
/**
* UM hook
*
* @type action
* @title um_member_role_upgrade
* @description Action on user role changed
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$role","type":"string","desc":"User role"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_member_role_upgrade', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_member_role_upgrade', 'my_member_role_upgrade', 10, 2 );
* function my_member_role_upgrade( $old_role, $new_role ) {
* // your code here
* }
* ?>
*/
do_action( 'um_member_role_upgrade', $role, UM()->user()->profile['role'] );
UM()->user()->update_usermeta_info( 'role' );
do_action('um_after_user_role_is_changed');
do_action('um_after_user_role_is_updated', $user_id, $role );
/**
* UM hook
*
* @type action
* @title um_after_user_role_is_changed
* @description Action after user role changed
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_role_is_changed', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_user_role_is_changed', 'my_after_user_role_is_changed', 10 );
* function my_after_user_role_is_changed() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_role_is_changed' );
/**
* UM hook
*
* @type action
* @title um_after_user_role_is_updated
* @description Action after user role changed
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$role","type":"string","desc":"User role"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_role_is_updated', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_user_role_is_updated', 'my_after_user_role_is_updated', 10, 2 );
* function my_after_user_role_is_updated( $user_id, $role ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_role_is_updated', $user_id, $role );
}
} else {
// User does don exist so return false
+79 -8
View File
@@ -473,22 +473,93 @@ if ( ! class_exists( 'Shortcodes' ) ) {
}
}
// start loading the template here
do_action("um_pre_{$mode}_shortcode", $args);
do_action("um_before_form_is_loaded", $args);
do_action("um_before_{$mode}_form_is_loaded", $args);
/**
* UM hook
*
* @type action
* @title um_pre_{$mode}_shortcode
* @description Action pre-load form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_pre_{$mode}_shortcode', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_pre_{$mode}_shortcode', 'my_pre_shortcode', 10, 1 );
* function my_pre_shortcode( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_pre_{$mode}_shortcode", $args );
/**
* UM hook
*
* @type action
* @title um_before_form_is_loaded
* @description Action pre-load form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form_is_loaded', 'my_pre_shortcode', 10, 1 );
* function my_pre_shortcode( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form_is_loaded", $args );
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_form_is_loaded
* @description Action pre-load form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_form_is_loaded', 'my_pre_shortcode', 10, 1 );
* function my_pre_shortcode( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$mode}_form_is_loaded", $args );
$this->template_load( $template, $args );
$this->dynamic_css( $args );
if (um_get_requested_user() || $mode == 'logout') {
if ( um_get_requested_user() || $mode == 'logout' ) {
um_reset_user();
}
do_action('um_after_everything_output');
/**
* UM hook
*
* @type action
* @title um_after_everything_output
* @description Action after load shortcode content
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_everything_output', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_everything_output', 'my_after_everything_output', 10 );
* function my_after_everything_output() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_everything_output' );
$output = ob_get_contents();
ob_end_clean();
+271 -26
View File
@@ -347,6 +347,26 @@ if ( ! class_exists( 'User' ) ) {
UM()->user()->update_usermeta_info( 'role' );
}
/**
* UM hook
*
* @type action
* @title um_user_register
* @description Action on user registration
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$submitted","type":"array","desc":"Registration form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_register', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_user_register', 'my_user_register', 10, 2 );
* function my_user_register( $user_id, $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_register', $user_id, $_POST );
}
@@ -376,6 +396,26 @@ if ( ! class_exists( 'User' ) ) {
}
}
/**
* UM hook
*
* @type action
* @title um_after_member_role_upgrade
* @description Action on user registration
* @input_vars
* [{"var":"$new_roles","type":"array","desc":"User new roles"},
* {"var":"$old_roles","type":"array","desc":"Old roles"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_member_role_upgrade', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_member_role_upgrade', 'my_after_member_role_upgrade', 10, 2 );
* function my_after_member_role_upgrade( $new_roles, $old_roles ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_member_role_upgrade', $new_roles, $old_roles );
//Update permalink
@@ -836,23 +876,66 @@ if ( ! class_exists( 'User' ) ) {
*/
$submitted = apply_filters( 'um_before_save_filter_submitted', $submitted );
do_action('um_before_save_registration_details', $this->id, $submitted );
/**
* UM hook
*
* @type action
* @title um_before_save_registration_details
* @description Action on user registration before save details
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$submitted","type":"array","desc":"Registration form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_save_registration_details', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_before_save_registration_details', 'my_before_save_registration_details', 10, 2 );
* function my_before_save_registration_details( $user_id, $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_save_registration_details', $this->id, $submitted );
update_user_meta( $this->id, 'submitted', $submitted );
$this->update_profile( $submitted );
do_action('um_after_save_registration_details', $this->id, $submitted );
/**
* UM hook
*
* @type action
* @title um_after_save_registration_details
* @description Action on user registration after save details
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$submitted","type":"array","desc":"Registration form submitted"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_save_registration_details', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_save_registration_details', 'my_after_save_registration_details', 10, 2 );
* function my_after_save_registration_details( $user_id, $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_save_registration_details', $this->id, $submitted );
}
/***
*** @A plain version of password
***/
/**
* A plain version of password
*
* @param $plain
*/
function set_plain_password( $plain ) {
update_user_meta( $this->id, '_um_cool_but_hard_to_guess_plain_pw', $plain );
}
/**
* Set last login for new registered users
*/
@@ -861,20 +944,77 @@ if ( ! class_exists( 'User' ) ) {
}
/***
*** @Set user's account status
***/
function set_status( $status ){
/**
* Set user's account status
*
* @param $status
*/
function set_status( $status ) {
do_action( 'um_when_status_is_set', um_user('ID') );
/**
* UM hook
*
* @type action
* @title um_when_status_is_set
* @description Action on user status changed
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_when_status_is_set', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_when_status_is_set', 'my_when_status_is_set', 10, 1 );
* function my_when_status_is_set( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_when_status_is_set', um_user( 'ID' ) );
$this->profile['account_status'] = $status;
$this->update_usermeta_info('account_status');
$this->update_usermeta_info( 'account_status' );
/**
* UM hook
*
* @type action
* @title um_after_user_status_is_changed_hook
* @description Action after user status changed
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_status_is_changed_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_user_status_is_changed_hook', 'my_after_user_status_is_changed', 10 );
* function my_after_user_status_is_changed() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_status_is_changed_hook' );
do_action( 'um_after_user_status_is_changed', $status);
/**
* UM hook
*
* @type action
* @title um_after_user_status_is_changed
* @description Action after user status changed
* @input_vars
* [{"var":"$status","type":"string","desc":"User Status"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_status_is_changed', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_user_status_is_changed', 'my_after_user_status_is_changed', 10, 1 );
* function my_after_user_status_is_changed( $status ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_status_is_changed', $status );
}
@@ -890,13 +1030,46 @@ if ( ! class_exists( 'User' ) ) {
/***
*** @Set user's hash
***/
function assign_secretkey(){
do_action('um_before_user_hash_is_changed');
function assign_secretkey() {
/**
* UM hook
*
* @type action
* @title um_before_user_hash_is_changed
* @description Action before user hash is changed
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_user_hash_is_changed', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_before_user_hash_is_changed', 'my_before_user_hash_is_changed', 10 );
* function my_before_user_hash_is_changed() {
* // your code here
* }
* ?>
*/
do_action( 'um_before_user_hash_is_changed' );
$this->profile['account_secret_hash'] = UM()->validation()->generate();
$this->update_usermeta_info('account_secret_hash');
do_action('um_after_user_hash_is_changed');
$this->update_usermeta_info( 'account_secret_hash' );
/**
* UM hook
*
* @type action
* @title um_after_user_hash_is_changed
* @description Action after user hash is changed
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_hash_is_changed', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_user_hash_is_changed', 'my_after_user_hash_is_changed', 10 );
* function my_after_user_hash_is_changed() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_hash_is_changed' );
}
@@ -954,8 +1127,26 @@ if ( ! class_exists( 'User' ) ) {
$this->delete_meta('account_secret_hash');
$this->delete_meta('_um_cool_but_hard_to_guess_plain_pw');
do_action('um_after_user_is_approved', um_user('ID') );
/**
* UM hook
*
* @type action
* @title um_after_user_is_approved
* @description Action after user was approved
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_is_approved', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_user_is_approved', 'my_after_user_is_approved', 10, 1 );
* function my_after_user_hash_is_changed( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_is_approved', um_user( 'ID' ) );
}
/***
@@ -1041,11 +1232,29 @@ if ( ! class_exists( 'User' ) ) {
*
*/
function deactivate(){
$this->set_status('inactive');
$this->set_status( 'inactive' );
/**
* UM hook
*
* @type action
* @title um_after_user_is_inactive
* @description Action after user was inactive
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_is_inactive', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_user_is_inactive', 'my_after_user_is_inactive', 10, 1 );
* function my_after_user_is_inactive( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_is_inactive', um_user( 'ID' ) );
do_action('um_after_user_is_inactive', um_user('ID') );
UM()->mail()->send( um_user('user_email'), 'inactive_email' );
UM()->mail()->send( um_user( 'user_email' ), 'inactive_email' );
}
@@ -1053,8 +1262,44 @@ if ( ! class_exists( 'User' ) ) {
*** @delete user
***/
function delete( $send_mail = true ) {
do_action( 'um_delete_user_hook' );
do_action( 'um_delete_user', um_user('ID') );
/**
* UM hook
*
* @type action
* @title um_delete_user_hook
* @description On delete user
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
* function my_delete_user() {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user_hook' );
/**
* UM hook
*
* @type action
* @title um_delete_user
* @description On delete user
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
* function my_delete_user( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user', um_user( 'ID' ) );
// send email notifications
if ( $send_mail ) {
+76 -4
View File
@@ -104,6 +104,23 @@ function um_submit_account_errors_hook( $args ) {
}
default:
/**
* UM hook
*
* @type action
* @title um_submit_account_{$tab}_tab_errors_hook
* @description On submit account current $tab validation
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_account_{$tab}_tab_errors_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_submit_account_{$tab}_tab_errors_hook', 'my_submit_account_tab_errors', 10 );
* function my_submit_account_tab_errors() {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_account_' . $_POST['_um_account_tab'] . '_tab_errors_hook' );
break;
}
@@ -230,13 +247,68 @@ function um_submit_account_errors_hook( $args ) {
*/
$changes = apply_filters( 'um_account_pre_updating_profile_array', $changes );
// fired on account page, just before updating profile
do_action('um_account_pre_update_profile', $changes, um_user('ID') );
/**
* UM hook
*
* @type action
* @title um_account_pre_update_profile
* @description Fired on account page, just before updating profile
* @input_vars
* [{"var":"$changes","type":"array","desc":"Submitted data"},
* {"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_account_pre_update_profile', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_account_pre_update_profile', 'my_account_pre_update_profile', 10, 2 );
* function my_account_pre_update_profile( $changes, $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_account_pre_update_profile', $changes, um_user( 'ID' ) );
UM()->user()->update_profile( $changes );
do_action('um_post_account_update');
/**
* UM hook
*
* @type action
* @title um_post_account_update
* @description Fired on account page, after updating profile
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_post_account_update', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_post_account_update', 'my_post_account_update', 10 );
* function my_account_pre_update_profile() {
* // your code here
* }
* ?>
*/
do_action( 'um_post_account_update' );
/**
* UM hook
*
* @type action
* @title um_after_user_account_updated
* @description Fired on account page, after updating profile
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$changes","type":"array","desc":"Submitted data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_account_updated', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_user_account_updated', 'my_after_user_account_updated', 10, 2 );
* function my_after_user_account_updated( $user_id, $changes ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_account_updated', get_current_user_id(), $changes );
$url = '';
+27 -7
View File
@@ -17,19 +17,39 @@ if ( ! defined( 'ABSPATH' ) ) exit;
wp_die( __( 'Super administrators can not be modified.','ultimate-member' ) );
}
if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ){
wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
}
if ( isset($_REQUEST['uid'])){
if ( isset( $_REQUEST['uid'] ) ) {
$uid = $_REQUEST['uid'];
}
switch( $_REQUEST['um_action'] ) {
switch ( $_REQUEST['um_action'] ) {
default:
$uid = ( isset( $_REQUEST['uid'] ) ) ? $_REQUEST['uid'] : 0;
do_action('um_action_user_request_hook', $_REQUEST['um_action'], $uid);
$uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
/**
* UM hook
*
* @type action
* @title um_action_user_request_hook
* @description Integration for user actions
* @input_vars
* [{"var":"$action","type":"string","desc":"Action for user"},
* {"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_action_user_request_hook', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_action_user_request_hook', 'my_action_user_request', 10, 2 );
* function my_action_user_request( $action, $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid );
break;
case 'edit':
+184 -13
View File
@@ -100,24 +100,154 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$fields = unserialize( $args['custom_fields'] );
if ( $mode == 'register' ){
if ( $mode == 'register' ) {
do_action("um_submit_form_errors_hook__registration", $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__registration
* @description Submit registration form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__registration', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__registration', 'my_submit_form_errors_registration', 10, 1 );
* function my_submit_form_errors_registration( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__registration", $args );
}
do_action("um_submit_form_errors_hook__blockedips", $args );
do_action("um_submit_form_errors_hook__blockedemails", $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__blockedips
* @description Submit form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__blockedips', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__blockedips', 'my_submit_form_errors_hook__blockedips', 10, 1 );
* function my_submit_form_errors_hook__blockedips( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__blockedips", $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__blockedemails
* @description Submit form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__blockedemails', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__blockedemails', 'my_submit_form_errors_hook__blockedemails', 10, 1 );
* function my_submit_form_errors_hook__blockedemails( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__blockedemails", $args );
if ( $mode == 'login' ) {
do_action('um_submit_form_errors_hook_login', $args );
do_action('um_submit_form_errors_hook_logincheck', $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook_login
* @description Submit login form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook_login', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook_login', 'my_submit_form_errors_hook_login', 10, 1 );
* function my_submit_form_errors_hook_login( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_form_errors_hook_login', $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook_logincheck
* @description Submit login form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook_logincheck', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook_logincheck', 'my_submit_form_errors_hook_logincheck', 10, 1 );
* function my_submit_form_errors_hook_logincheck( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_form_errors_hook_logincheck', $args );
} else {
do_action('um_submit_form_errors_hook_', $args );
do_action("um_submit_form_errors_hook__blockedwords", $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook_
* @description Submit form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook_', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook_', 'my_submit_form_errors_hook', 10, 1 );
* function my_submit_form_errors_hook( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_submit_form_errors_hook_', $args );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__blockedwords
* @description Submit form validation
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__blockedwords', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__blockedwords', 'my_submit_form_errors_hook__blockedwords', 10, 1 );
* function my_submit_form_errors_hook__blockedwords( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__blockedwords", $args );
}
@@ -263,7 +393,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
}
}
/**
* UM hook
*
* @type action
* @title um_add_error_on_form_submit_validation
* @description Submit form validation
* @input_vars
* [{"var":"$field","type":"array","desc":"Field Data"},
* {"var":"$key","type":"string","desc":"Field Key"},
* {"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_add_error_on_form_submit_validation', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_add_error_on_form_submit_validation', 'my_add_error_on_form_submit_validation', 10, 3 );
* function my_add_error_on_form_submit_validation( $field, $key, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_add_error_on_form_submit_validation', $array, $key, $args );
if ( isset( $args[$key] ) ) {
@@ -351,7 +501,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
case 'custom':
$custom = $array['custom_validate'];
do_action("um_custom_field_validation_{$custom}", $key, $array, $args );
/**
* UM hook
*
* @type action
* @title um_custom_field_validation_{$custom}
* @description Submit form validation for custom field
* @input_vars
* [{"var":"$key","type":"string","desc":"Field Key"},
* {"var":"$field","type":"array","desc":"Field Data"},
* {"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_custom_field_validation_{$custom}', 'function_name', 10, 3 );
* @example
* <?php
* add_action( 'um_custom_field_validation_{$custom}', 'my_custom_field_validation', 10, 3 );
* function my_custom_field_validation( $key, $field, $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_custom_field_validation_{$custom}", $key, $array, $args );
break;
case 'numeric':
+61 -5
View File
@@ -180,7 +180,25 @@ if ( ! defined( 'ABSPATH' ) ) exit;
UM()->user()->auto_login( um_user( 'ID' ), $rememberme );
// Hook that runs after successful login and before user is redirected
/**
* UM hook
*
* @type action
* @title um_on_login_before_redirect
* @description Hook that runs after successful login and before user is redirected
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_on_login_before_redirect', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_on_login_before_redirect', 'my_on_login_before_redirect', 10, 1 );
* function my_on_login_before_redirect( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_on_login_before_redirect', um_user( 'ID' ) );
// Priority redirect
@@ -220,13 +238,51 @@ if ( ! defined( 'ABSPATH' ) ) exit;
/***
*** @form processing
***/
add_action('um_submit_form_login', 'um_submit_form_login', 10);
function um_submit_form_login($args){
if ( !isset( UM()->form()->errors) ) {
add_action( 'um_submit_form_login', 'um_submit_form_login', 10 );
function um_submit_form_login( $args ) {
if ( ! isset( UM()->form()->errors ) ) {
/**
* UM hook
*
* @type action
* @title um_user_login
* @description Hook that runs after successful submit login form
* @input_vars
* [{"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_login', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_login', 'my_user_login', 10, 1 );
* function my_user_login( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_login', $args );
}
do_action('um_user_login_extra_hook', $args );
/**
* UM hook
*
* @type action
* @title um_user_login_extra_hook
* @description Hook that runs after successful submit login form
* @input_vars
* [{"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_login_extra_hook', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_login_extra_hook', 'my_user_login_extra', 10, 1 );
* function my_user_login_extra( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_login_extra_hook', $args );
}
/***
+42 -3
View File
@@ -48,7 +48,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
delete_user_meta( $args['user_id'], 'reset_pass_hash_token');
delete_user_meta( $args['user_id'], 'password_rst_attempts');
do_action('um_after_changing_user_password', $args['user_id'] );
/**
* UM hook
*
* @type action
* @title um_after_changing_user_password
* @description Hook that runs after user change their password
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_changing_user_password', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_changing_user_password', 'my_after_changing_user_password', 10, 1 );
* function my_user_login_extra( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_changing_user_password', $args['user_id'] );
if ( is_user_logged_in() ) {
@@ -259,9 +278,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<?php $output = null;
foreach( $fields as $key => $data ) {
$output .= UM()->fields()->edit_field( $key, $data );
}echo $output; ?>
} echo $output; ?>
<?php do_action( 'um_after_password_reset_fields', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_password_reset_fields
* @description Hook that runs after user reset their password
* @input_vars
* [{"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_password_reset_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_password_reset_fields', 'my_after_password_reset_fields', 10, 1 );
* function my_after_password_reset_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_password_reset_fields', $args ); ?>
<div class="um-col-alt um-col-alt-b">
+430 -28
View File
@@ -38,17 +38,130 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$can_view = apply_filters( 'um_profile_can_view_main', -1, um_profile_id() );
if ( $can_view == -1 ) {
/**
* UM hook
*
* @type action
* @title um_before_form
* @description Some actions before profile form
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form', 'my_before_form', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form", $args );
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_fields
* @description Some actions before profile form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"{Profile} form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_main_{$mode}_fields
* @description Some actions before login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_main_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form_fields
* @description Some actions after login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_{$mode}_fields
* @description Some actions after profile form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_{$mode}_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form
* @description Some actions after profile form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form', 'my_after_form', 10, 1 );
* function my_after_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form", $args );
} else {
@@ -84,6 +197,25 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$userinfo = UM()->user()->profile;
/**
* UM hook
*
* @type action
* @title um_user_before_updating_profile
* @description Some actions before profile submit
* @input_vars
* [{"var":"$userinfo","type":"array","desc":"User Data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_before_updating_profile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_before_updating_profile', 'my_user_before_updating_profile', 10, 1 );
* function my_user_before_updating_profile( $userinfo ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_before_updating_profile', $userinfo );
if (!empty( $args['custom_fields'] ))
@@ -140,6 +272,25 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$args['roles_before_upgrade'] = UM()->roles()->get_all_user_roles( um_user( 'ID' ) );
}
/**
* UM hook
*
* @type action
* @title um_user_pre_updating_profile
* @description Some actions before profile submit
* @input_vars
* [{"var":"$userinfo","type":"array","desc":"Submitted User Data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_pre_updating_profile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_pre_updating_profile', 'my_user_pre_updating_profile', 10, 1 );
* function my_user_pre_updating_profile( $userinfo ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_pre_updating_profile', $to_update );
/**
@@ -168,6 +319,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
if ( is_array( $to_update ) ) {
UM()->user()->update_profile( $to_update );
/**
* UM hook
*
* @type action
* @title um_after_user_updated
* @description Some actions after user profile updated
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form Data"},
* {"var":"$userinfo","type":"array","desc":"Submitted User Data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_updated', 'function_name', 10, 33 );
* @example
* <?php
* add_action( 'um_after_user_updated', 'my_after_user_updated', 10, 3 );
* function my_after_user_updated( $user_id, $args, $userinfo ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_updated', um_user( 'ID' ), $args, $to_update );
}
@@ -195,13 +367,92 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
if (is_array( $files )) {
/**
* UM hook
*
* @type action
* @title um_before_user_upload
* @description Before file uploaded on complete UM user profile.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$files","type":"array","desc":"Files data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_user_upload', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_before_user_upload', 'my_before_user_upload', 10, 2 );
* function my_before_user_upload( $user_id, $files ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_user_upload', um_user( 'ID' ), $files );
UM()->user()->update_files( $files );
/**
* UM hook
*
* @type action
* @title um_after_user_upload
* @description After complete UM user profile edit and file uploaded.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$files","type":"array","desc":"Files data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_upload', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_user_upload', 'my_after_user_upload', 10, 2 );
* function my_after_user_upload( $user_id, $files ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_upload', um_user( 'ID' ), $files );
}
/**
* UM hook
*
* @type action
* @title um_user_after_updating_profile
* @description After upgrade user's profile
* @input_vars
* [{"var":"$submitted","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_after_updating_profile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_after_updating_profile', 'my_user_after_updating_profile'', 10, 1 );
* function my_user_after_updating_profile( $submitted ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_after_updating_profile', $to_update );
/**
* UM hook
*
* @type action
* @title um_update_profile_full_name
* @description On update user profile change full name
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_update_profile_full_name', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_update_profile_full_name', 'my_update_profile_full_name', 10, 2 );
* function my_update_profile_full_name( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_update_profile_full_name', um_user( 'ID' ), $to_update );
if ( ! isset( $args['is_signup'] ) ) {
@@ -314,26 +565,42 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<div class="um-cover <?php if (um_profile( 'cover_photo' ) || ( $default_cover && $default_cover['url'] )) echo 'has-cover'; ?>"
data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
<?php do_action( 'um_cover_area_content', um_profile_id() ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_cover_area_content
* @description Cover area content change
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_cover_area_content', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_cover_area_content', 'my_cover_area_content', 10, 1 );
* function my_cover_area_content( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_cover_area_content', um_profile_id() );
if ( UM()->fields()->editing ) {
if (UM()->fields()->editing) {
$items = array(
'<a href="#" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . __( 'Change cover photo', 'ultimate-member' ) . '</a>',
'<a href="#" class="um-reset-cover-photo" data-user_id="' . um_profile_id() . '">' . __( 'Remove', 'ultimate-member' ) . '</a>',
'<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
);
$items = array(
'<a href="#" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . __( 'Change cover photo', 'ultimate-member' ) . '</a>',
'<a href="#" class="um-reset-cover-photo" data-user_id="' . um_profile_id() . '">' . __( 'Remove', 'ultimate-member' ) . '</a>',
'<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
);
echo UM()->menu()->new_ui( 'bc', 'div.um-cover', 'click', $items );
echo UM()->menu()->new_ui( 'bc', 'div.um-cover', 'click', $items );
}
}
?>
UM()->fields()->add_hidden_field( 'cover_photo' );
<?php UM()->fields()->add_hidden_field( 'cover_photo' ); ?>
<?php echo $overlay; ?>
echo $overlay; ?>
<div class="um-cover-e">
@@ -421,7 +688,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<div class="um-header<?php echo $classes; ?>">
<?php do_action( 'um_pre_header_editprofile', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_pre_header_editprofile
* @description Insert some content before edit profile header
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_pre_header_editprofile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_pre_header_editprofile', 'my_pre_header_editprofile', 10, 1 );
* function my_pre_header_editprofile( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_pre_header_editprofile', $args ); ?>
<div class="um-profile-photo" data-user_id="<?php echo um_profile_id(); ?>">
@@ -511,21 +798,78 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<div class="um-main-meta">
<?php if ($args['show_name']) { ?>
<?php if ( $args['show_name'] ) { ?>
<div class="um-name">
<a href="<?php echo um_user_profile_url(); ?>"
title="<?php echo um_user( 'display_name' ); ?>"><?php echo um_user( 'display_name', 'html' ); ?></a>
<?php do_action( 'um_after_profile_name_inline', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_profile_name_inline
* @description Insert after profile name some content
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_profile_name_inline', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_profile_name_inline', 'my_after_profile_name_inline', 10, 1 );
* function my_after_profile_name_inline( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_profile_name_inline', $args ); ?>
</div>
<?php } ?>
<div class="um-clear"></div>
<?php do_action( 'um_after_profile_header_name_args', $args ); ?>
<?php do_action( 'um_after_profile_header_name' ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_profile_header_name_args
* @description Insert after profile header name some content
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_profile_header_name_args', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_profile_header_name_args', 'my_after_profile_header_name_args', 10, 1 );
* function my_after_profile_header_name_args( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_profile_header_name_args', $args );
/**
* UM hook
*
* @type action
* @title um_after_profile_name_inline
* @description Insert after profile name some content
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_profile_name_inline', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_profile_name_inline', 'my_after_profile_name_inline', 10 );
* function my_after_profile_name_inline() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_profile_header_name' ); ?>
</div>
@@ -576,18 +920,57 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<span><?php printf( __( 'This user account status is %s', 'ultimate-member' ), um_user( 'account_status_name' ) ); ?></span>
</div>
<?php do_action( 'um_after_header_meta', um_user( 'ID' ), $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_header_meta
* @description Insert after header meta some content
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_header_meta', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_header_meta', 'my_after_header_meta', 10, 2 );
* function my_after_header_meta( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_header_meta', um_user( 'ID' ), $args ); ?>
</div>
<div class="um-clear"></div>
<?php
if (UM()->fields()->is_error( 'profile_photo' )) {
echo UM()->fields()->field_error( UM()->fields()->show_error( 'profile_photo' ), 'force_show' );
}
?>
<?php if ( UM()->fields()->is_error( 'profile_photo' ) ) {
echo UM()->fields()->field_error( UM()->fields()->show_error( 'profile_photo' ), 'force_show' );
}
<?php do_action( 'um_after_header_info', um_user( 'ID' ), $args ); ?>
/**
* UM hook
*
* @type action
* @title um_after_header_info
* @description Insert after header info some content
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_header_info', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_header_info', 'my_after_header_info', 10, 2 );
* function my_after_header_info( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_header_info', um_user( 'ID' ), $args ); ?>
</div>
@@ -768,9 +1151,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
***/
add_action( 'um_submit_form_profile', 'um_submit_form_profile', 10 );
function um_submit_form_profile( $args ) {
if (isset( UM()->form()->errors ))
if ( isset( UM()->form()->errors ) )
return false;
/**
* UM hook
*
* @type action
* @title um_user_edit_profile
* @description Run on successful submit profile form
* @input_vars
* [{"var":"$args","type":"array","desc":"Form Arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_edit_profile', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_user_edit_profile', 'my_user_edit_profile', 10, 1 );
* function my_user_edit_profile( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_edit_profile', $args );
}
+161 -4
View File
@@ -50,10 +50,48 @@ if ( ! defined( 'ABSPATH' ) ) exit;
UM()->user()->set_registration_details( $args['submitted'] );
}
/**
* UM hook
*
* @type action
* @title um_registration_set_extra_data
* @description Hook that runs after insert user to DB and there you can set any extra details
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_registration_set_extra_data', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_registration_set_extra_data', 'my_registration_set_extra_data', 10, 2 );
* function my_registration_set_extra_data( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_registration_set_extra_data', $user_id, $args );
//redirects handlers at 100 priority, you can add some info before redirects
//after complete UM user registration
/**
* UM hook
*
* @type action
* @title um_registration_complete
* @description After complete UM user registration. Redirects handlers at 100 priority, you can add some info before redirects
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_registration_complete', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_registration_complete', 'my_registration_complete', 10, 2 );
* function my_registration_complete( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_registration_complete', $user_id, $args );
}
add_action( 'um_user_register', 'um_after_insert_user', 10, 2 );
@@ -86,7 +124,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
function um_check_user_status( $user_id, $args ) {
$status = um_user( 'status' );
do_action( "um_post_registration_{$status}_hook", $user_id, $args );
/**
* UM hook
*
* @type action
* @title um_post_registration_{$status}_hook
* @description After complete UM user registration.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_post_registration_{$status}_hook', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_post_registration_{$status}_hook', 'my_post_registration', 10, 2 );
* function my_post_registration( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_post_registration_{$status}_hook", $user_id, $args );
if ( ! is_admin() ) {
@@ -102,7 +160,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
UM()->user()->auto_login( $user_id );
UM()->user()->generate_profile_slug( $user_id );
do_action( 'um_registration_after_auto_login', $user_id );
/**
* UM hook
*
* @type action
* @title um_registration_after_auto_login
* @description After complete UM user registration and autologin.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_registration_after_auto_login', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_registration_after_auto_login', 'my_registration_after_auto_login', 10, 1 );
* function my_registration_after_auto_login( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_registration_after_auto_login', $user_id );
if ( um_user( 'auto_approve_act' ) == 'redirect_url' && um_user( 'auto_approve_url' ) !== '' ) {
exit( wp_redirect( um_user( 'auto_approve_url' ) ) );
@@ -284,6 +361,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
);
$user_id = wp_insert_user( $userdata );
/**
* UM hook
*
* @type action
* @title um_user_register
* @description After complete UM user registration.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_user_register', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_user_register', 'my_user_register', 10, 2 );
* function my_user_register( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_user_register', $user_id, $args );
return $user_id;
@@ -507,8 +604,48 @@ if ( ! defined( 'ABSPATH' ) ) exit;
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
if ( !empty( $files ) ) {
/**
* UM hook
*
* @type action
* @title um_before_user_upload
* @description Before file uploaded on complete UM user registration.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$files","type":"array","desc":"Files data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_user_upload', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_before_user_upload', 'my_before_user_upload', 10, 2 );
* function my_before_user_upload( $user_id, $files ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_user_upload', $user_id, $files );
UM()->user()->update_files( $files );
/**
* UM hook
*
* @type action
* @title um_after_user_upload
* @description After complete UM user registration and file uploaded.
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$files","type":"array","desc":"Files data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_user_upload', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_after_user_upload', 'my_after_user_upload', 10, 2 );
* function my_after_user_upload( $user_id, $files ) {
* // your code here
* }
* ?>
*/
do_action( 'um_after_user_upload', $user_id, $files );
}
}
@@ -522,6 +659,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
* @param $args
*/
function um_registration_set_profile_full_name( $user_id, $args ) {
/**
* UM hook
*
* @type action
* @title um_update_profile_full_name
* @description On update user profile change full name
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_update_profile_full_name', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_update_profile_full_name', 'my_update_profile_full_name', 10, 2 );
* function my_update_profile_full_name( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_update_profile_full_name', $user_id, $args );
}
+41 -4
View File
@@ -53,10 +53,47 @@ if ( ! defined( 'ABSPATH' ) ) exit;
***/
add_filter('authenticate', 'um_wp_form_errors_hook_ip_test', 10, 3);
function um_wp_form_errors_hook_ip_test( $user, $username, $password ) {
if (!empty($username)) {
do_action("um_submit_form_errors_hook__blockedips", $args=array() );
do_action("um_submit_form_errors_hook__blockedemails", $args=array('username' => $username ) );
if ( ! empty( $username ) ) {
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__blockedips
* @description Hook that runs after user reset their password
* @input_vars
* [{"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__blockedips', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__blockedips', 'my_submit_form_errors_hook__blockedips', 10, 1 );
* function my_submit_form_errors_hook__blockedips( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__blockedips", $args = array() );
/**
* UM hook
*
* @type action
* @title um_submit_form_errors_hook__blockedemails
* @description Hook that runs after user reset their password
* @input_vars
* [{"var":"$args","type":"array","desc":"Form data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_submit_form_errors_hook__blockedemails', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_submit_form_errors_hook__blockedemails', 'my_submit_form_errors_hook__blockedemails', 10, 1 );
* function my_submit_form_errors_hook__blockedemails( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_submit_form_errors_hook__blockedemails", $args = array( 'username' => $username ) );
}
+61 -3
View File
@@ -4,7 +4,27 @@
<form method="post" action="">
<?php do_action( 'um_account_page_hidden_fields', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_account_page_hidden_fields
* @description Show hidden fields on account form
* @input_vars
* [{"var":"$args","type":"array","desc":"Account shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_account_page_hidden_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_account_page_hidden_fields', 'my_account_page_hidden_fields', 10, 1 );
* function my_account_page_hidden_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_account_page_hidden_fields', $args ); ?>
<div class="um-account-meta radius-<?php echo UM()->options()->get( 'profile_photocorner' ); ?> uimob340-show uimob500-show">
@@ -71,7 +91,27 @@
<div class="um-account-main" data-current_tab="<?php echo UM()->account()->current_tab; ?>">
<?php do_action( 'um_before_form', $args );
<?php
/**
* UM hook
*
* @type action
* @title um_before_form
* @description Show some content before account form
* @input_vars
* [{"var":"$args","type":"array","desc":"Account shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form', 'my_before_form', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_before_form', $args );
foreach ( UM()->account()->tabs as $id => $info ) {
@@ -100,7 +140,25 @@
<div class="um-clear"></div>
</form>
<?php do_action( 'um_after_account_page_load' ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_after_account_page_load
* @description After account form
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_account_page_load', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_after_account_page_load', 'my_after_account_page_load', 10 );
* function my_after_account_page_load() {
* // your code here
* }
* ?>
*/
do_action( 'um_after_account_page_load' ); ?>
</div>
+126 -15
View File
@@ -5,23 +5,134 @@
<form method="post" action="" autocomplete="off">
<?php
/**
* UM hook
*
* @type action
* @title um_before_form
* @description Some actions before login form
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form', 'my_before_form', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form", $args );
do_action("um_before_form", $args);
do_action("um_before_{$mode}_fields", $args);
do_action("um_main_{$mode}_fields", $args);
do_action("um_after_form_fields", $args);
do_action("um_after_{$mode}_fields", $args);
do_action("um_after_form", $args);
?>
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_fields
* @description Some actions before login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_main_{$mode}_fields
* @description Some actions before login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_main_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form_fields
* @description Some actions after login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_{$mode}_fields
* @description Some actions after login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_{$mode}_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form
* @description Some actions after login form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form', 'my_after_form', 10, 1 );
* function my_after_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form", $args ); ?>
</form>
</div>
</div>
+44 -6
View File
@@ -5,21 +5,59 @@
<div class="um-misc-with-img">
<div class="um-misc-img">
<a href="<?php echo um_get_core_page('user'); ?>"><?php echo um_user('profile_photo', 80); ?></a>
<a href="<?php echo um_get_core_page( 'user' ); ?>"><?php echo um_user( 'profile_photo', 80 ); ?></a>
</div>
<div><strong><?php echo um_user('display_name'); ?></strong></div>
<div><strong><?php echo um_user( 'display_name' ); ?></strong></div>
<?php do_action('um_logout_after_user_welcome', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_logout_after_user_welcome
* @description Some actions on logout form
* @input_vars
* [{"var":"$args","type":"array","desc":"Logout form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_logout_after_user_welcome', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_logout_after_user_welcome', 'my_logout_after_user_welcome', 10, 1 );
* function my_logout_after_user_welcome( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_logout_after_user_welcome', $args ); ?>
</div>
<ul class="um-misc-ul">
<?php do_action('um_logout_user_links', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_logout_user_links
* @description Logout user links
* @input_vars
* [{"var":"$args","type":"array","desc":"Logout form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_logout_user_links', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_logout_user_links', 'my_logout_user_links', 10, 1 );
* function my_logout_user_links( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_logout_user_links', $args ); ?>
</ul>
</div>
</div>
+43 -2
View File
@@ -37,7 +37,28 @@
<div class="um-member-name"><a href="<?php echo um_user_profile_url(); ?>" title="<?php echo esc_attr(um_user('display_name')); ?>"><?php echo um_user('display_name', 'html'); ?></a></div>
<?php } ?>
<?php do_action('um_members_just_after_name', um_user('ID'), $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_members_just_after_name
* @description Show content just after user name
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_just_after_name', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_members_just_after_name', 'my_members_just_after_name', 10, 2 );
* function my_members_just_after_name( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_just_after_name', um_user('ID'), $args ); ?>
<?php if ( UM()->roles()->um_current_user_can( 'edit', um_user('ID') ) || UM()->roles()->um_user_can( 'can_edit_everyone' ) ) { ?>
<div class="um-members-edit-btn">
@@ -45,7 +66,27 @@
</div>
<?php }
do_action('um_members_after_user_name', um_user('ID'), $args); ?>
/**
* UM hook
*
* @type action
* @title um_members_after_user_name
* @description Show content just after user name
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"},
* {"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_after_user_name', 'function_name', 10, 2 );
* @example
* <?php
* add_action( 'um_members_after_user_name', 'my_members_after_user_name', 10, 2 );
* function my_members_after_user_name( $user_id, $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_after_user_name', um_user('ID'), $args ); ?>
<?php
if ( $show_tagline && is_array( $tagline_fields ) ) {
+83 -8
View File
@@ -2,14 +2,89 @@
<div class="um-form">
<?php do_action('um_members_directory_search', $args ); ?>
<?php do_action('um_members_directory_head', $args ); ?>
<?php do_action('um_members_directory_display', $args ); ?>
<?php do_action('um_members_directory_footer', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_members_directory_search
* @description Member directory search
* @input_vars
* [{"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_directory_search', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_members_directory_search', 'my_members_directory_search', 10, 1 );
* function my_members_directory_search( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_directory_search', $args );
/**
* UM hook
*
* @type action
* @title um_members_directory_head
* @description Member directory header
* @input_vars
* [{"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_directory_head', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_members_directory_head', 'my_members_directory_head', 10, 1 );
* function my_members_directory_head( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_directory_head', $args );
/**
* UM hook
*
* @type action
* @title um_members_directory_display
* @description Member directory display content
* @input_vars
* [{"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_directory_display', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_members_directory_display', 'my_members_directory_display', 10, 1 );
* function my_members_directory_display( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_directory_display', $args );
/**
* UM hook
*
* @type action
* @title um_members_directory_footer
* @description Member directory display footer
* @input_vars
* [{"var":"$args","type":"array","desc":"Member directory shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_members_directory_footer', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_members_directory_footer', 'my_members_directory_footer', 10, 1 );
* function my_members_directory_footer( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_members_directory_footer', $args ); ?>
</div>
</div>
+65 -14
View File
@@ -4,22 +4,73 @@
<form method="post" action="">
<?php
<?php if ( !isset( UM()->password()->reset_request ) ) {
/**
* UM hook
*
* @type action
* @title um_change_password_page_hidden_fields
* @description Password change hidden fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Password change shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_change_password_page_hidden_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_change_password_page_hidden_fields', 'my_change_password_page_hidden_fields', 10, 1 );
* function my_change_password_page_hidden_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_change_password_page_hidden_fields', $args );
/**
* UM hook
*
* @type action
* @title um_change_password_form
* @description Password change form content
* @input_vars
* [{"var":"$args","type":"array","desc":"Password change shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_change_password_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_change_password_form', 'my_change_password_form', 10, 1 );
* function my_change_password_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_change_password_form', $args );
/**
* UM hook
*
* @type action
* @title um_after_form_fields
* @description Password change after form content
* @input_vars
* [{"var":"$args","type":"array","desc":"Password change shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form_fields", $args );
if ( !isset( UM()->password()->reset_request ) ) {
do_action('um_change_password_page_hidden_fields', $args );
do_action('um_change_password_form', $args );
do_action("um_after_form_fields", $args);
}
?>
} ?>
</form>
</div>
</div>
+69 -18
View File
@@ -7,27 +7,78 @@
<?php
if ( ! isset( UM()->password()->reset_request ) ) {
/**
* UM hook
*
* @type action
* @title um_reset_password_page_hidden_fields
* @description Password reset hidden fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Password reset shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_reset_password_page_hidden_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_reset_password_page_hidden_fields', 'my_reset_password_page_hidden_fields', 10, 1 );
* function my_reset_password_page_hidden_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_reset_password_page_hidden_fields', $args );
/**
* UM hook
*
* @type action
* @title um_reset_password_form
* @description Password reset display form
* @input_vars
* [{"var":"$args","type":"array","desc":"Password reset shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_reset_password_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_reset_password_form', 'my_reset_password_form', 10, 1 );
* function my_reset_password_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_reset_password_form', $args );
/**
* UM hook
*
* @type action
* @title um_after_form_fields
* @description Password reset after display form
* @input_vars
* [{"var":"$args","type":"array","desc":"Password reset shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form_fields", $args );
do_action('um_reset_password_page_hidden_fields', $args );
do_action('um_reset_password_form', $args );
do_action("um_after_form_fields", $args);
} else { ?>
} else {
echo '<div class="um-field-block">';
echo '<p>' . __('We have sent you a password reset link to your e-mail. Please check your inbox.', 'ultimate-member' ) . '</p>';
echo '</div>';
}
?>
<div class="um-field-block">
<p><?php _e( 'We have sent you a password reset link to your e-mail. Please check your inbox.', 'ultimate-member' ) ?></p>
</div>
<?php } ?>
</form>
</div>
</div>
+145 -7
View File
@@ -2,14 +2,73 @@
<div class="um-form">
<?php do_action('um_profile_before_header', $args );
<?php
/**
* UM hook
*
* @type action
* @title um_profile_before_header
* @description Some actions before profile form header
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_before_header', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_before_header', 'my_profile_before_header', 10, 1 );
* function my_profile_before_header( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_profile_before_header', $args );
if ( um_is_on_edit_profile() ) { ?>
<form method="post" action="">
<?php }
do_action('um_profile_header_cover_area', $args );
do_action('um_profile_header', $args );
/**
* UM hook
*
* @type action
* @title um_profile_header_cover_area
* @description Profile header cover area
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_header_cover_area', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_header_cover_area', 'my_profile_header_cover_area', 10, 1 );
* function my_profile_header_cover_area( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_profile_header_cover_area', $args );
/**
* UM hook
*
* @type action
* @title um_profile_header
* @description Profile header area
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_header', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_header', 'my_profile_header', 10, 1 );
* function my_profile_header( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_profile_header', $args );
/**
* UM hook
@@ -35,11 +94,51 @@
$classes = apply_filters( 'um_profile_navbar_classes', '' ); ?>
<div class="um-profile-navbar <?php echo $classes ?>">
<?php do_action( 'um_profile_navbar', $args ); ?>
<?php
/**
* UM hook
*
* @type action
* @title um_profile_navbar
* @description Profile navigation bar
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_navbar', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_navbar', 'my_profile_navbar', 10, 1 );
* function my_profile_navbar( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_profile_navbar', $args ); ?>
<div class="um-clear"></div>
</div>
<?php do_action( 'um_profile_menu', $args );
<?php
/**
* UM hook
*
* @type action
* @title um_profile_menu
* @description Profile menu
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_menu', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_menu', 'my_profile_navbar', 10, 1 );
* function my_profile_navbar( $args ) {
* // your code here
* }
* ?>
*/
do_action( 'um_profile_menu', $args );
$nav = UM()->profile()->active_tab;
$subnav = ( get_query_var('subnav') ) ? get_query_var('subnav') : 'default';
@@ -47,8 +146,47 @@
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);
/**
* UM hook
*
* @type action
* @title um_profile_content_{$nav}
* @description Custom hook to display tabbed content
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_content_{$nav}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_content_{$nav}', 'my_profile_content', 10, 1 );
* function my_profile_content( $args ) {
* // your code here
* }
* ?>
*/
do_action("um_profile_content_{$nav}", $args);
/**
* UM hook
*
* @type action
* @title um_profile_content_{$nav}_{$subnav}
* @description Custom hook to display tabbed content
* @input_vars
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_profile_content_{$nav}_{$subnav}', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_profile_content_{$nav}_{$subnav}', 'my_profile_content', 10, 1 );
* function my_profile_content( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_profile_content_{$nav}_{$subnav}", $args );
print "</div>";
+124 -13
View File
@@ -5,20 +5,131 @@
<form method="post" action="">
<?php
/**
* UM hook
*
* @type action
* @title um_before_form
* @description Some actions before register form
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_form', 'my_before_form', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_form", $args );
do_action("um_before_form", $args);
do_action("um_before_{$mode}_fields", $args);
do_action("um_main_{$mode}_fields", $args);
do_action("um_after_form_fields", $args);
do_action("um_after_{$mode}_fields", $args);
do_action("um_after_form", $args);
?>
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_fields
* @description Some actions before register form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_before_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_before_{$mode}_fields
* @description Some actions before register form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
* function my_before_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_main_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form_fields
* @description Some actions after register form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_{$mode}_fields
* @description Some actions after register form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_{$mode}_fields', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_{$mode}_fields', 'my_after_form_fields', 10, 1 );
* function my_after_form_fields( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_{$mode}_fields", $args );
/**
* UM hook
*
* @type action
* @title um_after_form
* @description Some actions after register form fields
* @input_vars
* [{"var":"$args","type":"array","desc":"Register form shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_after_form', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_after_form', 'my_after_form', 10, 1 );
* function my_after_form( $args ) {
* // your code here
* }
* ?>
*/
do_action( "um_after_form", $args ); ?>
</form>