diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 9ad80460..992a2052 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -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 + * + */ 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 + * + */ do_action( "um_admin_do_action__{$_REQUEST['um_adm_action']}", $_REQUEST['um_adm_action'] ); } } diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index 270a8d64..693b70aa 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -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 + * + */ + 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 + * + */ + 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' ) ) {
edit_array['content']; ?>
- + modal_header(); ?>
@@ -625,7 +664,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) { field_input ( $opt, null, $metabox->edit_array ); } ?> - in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?> + modal_footer( $arg2, $args, $metabox ); ?> " /> - + modal_header(); ?>
@@ -685,7 +724,7 @@ if ( ! class_exists( 'Admin_Builder' ) ) { field_input ( $opt ); } ?> - in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?> + modal_footer( $arg2, $args, $metabox ); ?> + */ + 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 + * + */ + 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 */ diff --git a/includes/admin/core/class-admin-menu.php b/includes/admin/core/class-admin-menu.php index c4c56fcf..1ab6303a 100644 --- a/includes/admin/core/class-admin-menu.php +++ b/includes/admin/core/class-admin-menu.php @@ -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 + * + */ do_action( 'um_extend_admin_menu' ); - } diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 83c57857..f950baad 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( "um_admin_field_edit_hook{$attribute}", $this->edit_mode_value ); break; diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index f3bceaf8..74500acb 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -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 + * + */ + do_action( 'um_admin_after_main_notices' ); } } diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index e92e6c6c..21012bc7 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -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 + * + */ 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 + * + */ 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' ) ) {
- + */ + 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 + * + */ 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 + * + */ 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 ## - + + */ +do_action( 'um_install_info_before' ); ?> --- Site Info --- @@ -2047,7 +2152,25 @@ Exclude CSS/JS on Home: options()->get( 'js_css_exlcude_home' --- UM Pages Configuration --- - + + */ +do_action( "um_install_info_before_page_config" ); ?> User: options()->get('core_user') ) . "\n"; ?> Account: options()->get('core_account') ) . "\n"; ?> Members: options()->get('core_members') ) . "\n"; ?> @@ -2055,7 +2178,25 @@ Register: options()->get('core_register') ) Login: options()->get('core_login') ) . "\n"; ?> Logout: options()->get('core_logout') ) . "\n"; ?> Password Reset: options()->get('core_password-reset') ) . "\n"; ?> - + + */ +do_action( "um_install_info_after_page_config" ); ?> --- UM Users Configuration --- @@ -2247,6 +2388,23 @@ Use Only Cookies: + */ do_action( 'um_install_info_after' ); ?> ### End Install Info ### diff --git a/includes/admin/core/class-admin-upgrade.php b/includes/admin/core/class-admin-upgrade.php index 75fef7a9..c35d1df6 100644 --- a/includes/admin/core/class-admin-upgrade.php +++ b/includes/admin/core/class-admin-upgrade.php @@ -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' ); diff --git a/includes/admin/core/class-admin-users.php b/includes/admin/core/class-admin-users.php index 544dfb35..aee96956 100644 --- a/includes/admin/core/class-admin-users.php +++ b/includes/admin/core/class-admin-users.php @@ -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 + * + */ 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 + * + */ do_action( "um_admin_user_action_{$bulk_action}_hook" ); } else { diff --git a/includes/admin/core/list-tables/emails-list-table.php b/includes/admin/core/list-tables/emails-list-table.php index 015b1e5e..e51b8fe4 100644 --- a/includes/admin/core/list-tables/emails-list-table.php +++ b/includes/admin/core/list-tables/emails-list-table.php @@ -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'; diff --git a/includes/admin/core/um-admin-actions-user.php b/includes/admin/core/um-admin-actions-user.php index 28895e3d..5d60cf98 100644 --- a/includes/admin/core/um-admin-actions-user.php +++ b/includes/admin/core/um-admin-actions-user.php @@ -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 + * + */ + 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; - } - - } \ No newline at end of file + 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 ); \ No newline at end of file diff --git a/includes/admin/core/um-admin-actions.php b/includes/admin/core/um-admin-actions.php index 4755c968..21d91c9e 100644 --- a/includes/admin/core/um-admin-actions.php +++ b/includes/admin/core/um-admin-actions.php @@ -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 + * + */ + 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 + * + */ + do_action( "um_admin_user_action_{$subaction}_hook" ); um_reset_user(); diff --git a/includes/admin/templates/role/role-edit.php b/includes/admin/templates/role/role-edit.php index 597746a8..4162a3d1 100644 --- a/includes/admin/templates/role/role-edit.php +++ b/includes/admin/templates/role/role-edit.php @@ -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 + * + */ +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 + * + */ +do_action( 'um_roles_add_meta_boxes_um_role_meta' ); $data = array(); $option = array(); diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 61cea339..f8de16a8 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( 'um_access_fix_external_post_content' ); $filtered_posts[] = $post; diff --git a/includes/core/class-account.php b/includes/core/class-account.php index 4a3fb705..7812af33 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -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'] ] ) ) { ?>
- + */ + do_action( 'um_account_page_hidden_fields', $args ); $this->render_account_tab( $args['tab'], $this->tabs[$args['tab']], $args ); ?>
@@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( 'um_submit_account_details', UM()->form()->post_form ); } @@ -567,10 +679,48 @@ if ( ! class_exists( 'Account' ) ) { + */ 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 + * + */ 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' ) ) {
- + + */ + do_action( "um_after_account_{$tab_id}_button" ); ?>
diff --git a/includes/core/class-common.php b/includes/core/class-common.php index 9e53bc7f..8f0962d6 100644 --- a/includes/core/class-common.php +++ b/includes/core/class-common.php @@ -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; + } + } } \ No newline at end of file diff --git a/includes/core/class-files.php b/includes/core/class-files.php index 9b901442..f4b27434 100644 --- a/includes/core/class-files.php +++ b/includes/core/class-files.php @@ -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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + do_action( "um_after_upload_db_meta_{$key}", $user_id ); // the url of upload return $this->upload_baseurl . $user_id . '/' . $filename; diff --git a/includes/core/class-form.php b/includes/core/class-form.php index 72ad0b1c..fd9d9d1f 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( "um_submit_form_{$this->post_form['mode']}", $this->post_form ); } diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index 19a0b0a7..1a9c4d64 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -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 + * + */ 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 + * + */ 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', '', $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 + * + */ do_action( 'um_before_email_template_body', $slug, $args ); /** diff --git a/includes/core/class-members.php b/includes/core/class-members.php index fda7df95..acd2bba4 100644 --- a/includes/core/class-members.php +++ b/includes/core/class-members.php @@ -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 + * + */ + 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 + * + */ + do_action( 'um_user_after_query', $query_args, $users ); $array['users'] = isset( $users->results ) && ! empty( $users->results ) ? array_unique( $users->results ) : array(); diff --git a/includes/core/class-password.php b/includes/core/class-password.php index c30d1e6c..ec6a0dd4 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ do_action( "um_before_{$mode}_form_is_loaded", $args ); UM()->shortcodes()->template_load( $template, $args ); diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php index 67ff23c0..e0ac13bc 100644 --- a/includes/core/class-permalinks.php +++ b/includes/core/class-permalinks.php @@ -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 + * + */ + do_action( 'um_after_email_confirmation', $user_id ); exit( wp_redirect( $redirect ) ); diff --git a/includes/core/class-query.php b/includes/core/class-query.php index 06bff679..ca6d2130 100644 --- a/includes/core/class-query.php +++ b/includes/core/class-query.php @@ -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 + * + */ do_action( "um_ajax_load_posts__{$hook}", $args ); $output = ob_get_contents(); diff --git a/includes/core/class-rest-api.php b/includes/core/class-rest-api.php index f129fde3..faa8a871 100644 --- a/includes/core/class-rest-api.php +++ b/includes/core/class-rest-api.php @@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( 'um_api_output_after', $this->data, $this, $format ); die(); diff --git a/includes/core/class-rewrite.php b/includes/core/class-rewrite.php index b00e7e5b..998e5de8 100644 --- a/includes/core/class-rewrite.php +++ b/includes/core/class-rewrite.php @@ -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 + * + */ + 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 diff --git a/includes/core/class-roles-capabilities.php b/includes/core/class-roles-capabilities.php index ef79b02c..30c3ae5e 100644 --- a/includes/core/class-roles-capabilities.php +++ b/includes/core/class-roles-capabilities.php @@ -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 + * + */ 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 + * + */ + 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 + * + */ 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 + * + */ + 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 + * + */ + do_action( 'um_after_user_role_is_updated', $user_id, $role ); } } else { // User does don exist so return false diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index f26ad3f6..c52b90f0 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + do_action( 'um_after_everything_output' ); $output = ob_get_contents(); ob_end_clean(); diff --git a/includes/core/class-user.php b/includes/core/class-user.php index dd23a0c9..d9e025cf 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -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 + * + */ 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 + * + */ 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + do_action( 'um_delete_user', um_user( 'ID' ) ); // send email notifications if ( $send_mail ) { diff --git a/includes/core/um-actions-account.php b/includes/core/um-actions-account.php index 2d6d580d..d23c24a1 100644 --- a/includes/core/um-actions-account.php +++ b/includes/core/um-actions-account.php @@ -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 + * + */ 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 + * + */ + 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 + * + */ + 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 + * + */ do_action( 'um_after_user_account_updated', get_current_user_id(), $changes ); $url = ''; diff --git a/includes/core/um-actions-core.php b/includes/core/um-actions-core.php index 99291c63..8d83c265 100644 --- a/includes/core/um-actions-core.php +++ b/includes/core/um-actions-core.php @@ -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 + * + */ + do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid ); break; case 'edit': diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index b7d85eb1..7f134cd4 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ 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 + * + */ + do_action( "um_custom_field_validation_{$custom}", $key, $array, $args ); break; case 'numeric': diff --git a/includes/core/um-actions-login.php b/includes/core/um-actions-login.php index e9540467..9f0846b0 100644 --- a/includes/core/um-actions-login.php +++ b/includes/core/um-actions-login.php @@ -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 + * + */ 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 + * + */ 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 + * + */ + do_action( 'um_user_login_extra_hook', $args ); } /*** diff --git a/includes/core/um-actions-password.php b/includes/core/um-actions-password.php index 9f29c8b3..a6c76914 100644 --- a/includes/core/um-actions-password.php +++ b/includes/core/um-actions-password.php @@ -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 + * + */ + do_action( 'um_after_changing_user_password', $args['user_id'] ); if ( is_user_logged_in() ) { @@ -259,9 +278,29 @@ if ( ! defined( 'ABSPATH' ) ) exit; $data ) { $output .= UM()->fields()->edit_field( $key, $data ); - }echo $output; ?> + } echo $output; ?> - + + */ + do_action( 'um_after_password_reset_fields', $args ); ?>
diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index c75d17e3..dc5a04ed 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ 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;
- - + */ + do_action( 'um_cover_area_content', um_profile_id() ); + if ( UM()->fields()->editing ) { - if (UM()->fields()->editing) { + $items = array( + '' . __( 'Change cover photo', 'ultimate-member' ) . '', + '' . __( 'Remove', 'ultimate-member' ) . '', + '' . __( 'Cancel', 'ultimate-member' ) . '', + ); - $items = array( - '' . __( 'Change cover photo', 'ultimate-member' ) . '', - '' . __( 'Remove', 'ultimate-member' ) . '', - '' . __( 'Cancel', 'ultimate-member' ) . '', - ); + 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' ); - fields()->add_hidden_field( 'cover_photo' ); ?> - - + echo $overlay; ?>
@@ -421,7 +688,27 @@ if ( ! defined( 'ABSPATH' ) ) exit;
- + + */ + do_action( 'um_pre_header_editprofile', $args ); ?>
@@ -511,21 +798,78 @@ if ( ! defined( 'ABSPATH' ) ) exit;
- +
- + + */ + do_action( 'um_after_profile_name_inline', $args ); ?>
- - + + */ + 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 + * + */ + do_action( 'um_after_profile_header_name' ); ?>
@@ -576,18 +920,57 @@ if ( ! defined( 'ABSPATH' ) ) exit;
- + + */ + do_action( 'um_after_header_meta', um_user( 'ID' ), $args ); ?>
- fields()->is_error( 'profile_photo' )) { - echo UM()->fields()->field_error( UM()->fields()->show_error( 'profile_photo' ), 'force_show' ); - } - ?> + fields()->is_error( 'profile_photo' ) ) { + echo UM()->fields()->field_error( UM()->fields()->show_error( 'profile_photo' ), 'force_show' ); + } - + /** + * 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 + * + */ + do_action( 'um_after_header_info', um_user( 'ID' ), $args ); ?>
@@ -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 + * + */ do_action( 'um_user_edit_profile', $args ); } diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 0f671879..de55ca4f 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -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 + * + */ 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 + * + */ 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 + * + */ + 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 + * + */ + 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 + * + */ 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 + * + */ 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 + * + */ 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 + * + */ do_action( 'um_update_profile_full_name', $user_id, $args ); } diff --git a/includes/core/um-filters-login.php b/includes/core/um-filters-login.php index 96151374..c08fc641 100644 --- a/includes/core/um-filters-login.php +++ b/includes/core/um-filters-login.php @@ -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 + * + */ + 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 + * + */ + do_action( "um_submit_form_errors_hook__blockedemails", $args = array( 'username' => $username ) ); } diff --git a/templates/account.php b/templates/account.php index c30c39b6..9d938a93 100644 --- a/templates/account.php +++ b/templates/account.php @@ -4,7 +4,27 @@
- + + */ + do_action( 'um_account_page_hidden_fields', $args ); ?>
- +
\ No newline at end of file diff --git a/templates/logout.php b/templates/logout.php index 7e9c7846..9843bd7c 100644 --- a/templates/logout.php +++ b/templates/logout.php @@ -5,21 +5,59 @@
- +
-
+
- + + */ + do_action( 'um_logout_after_user_welcome', $args ); ?>
-
- \ No newline at end of file diff --git a/templates/members-grid.php b/templates/members-grid.php index 831f52e9..cc9d731d 100644 --- a/templates/members-grid.php +++ b/templates/members-grid.php @@ -37,7 +37,28 @@
- + + */ + do_action( 'um_members_just_after_name', um_user('ID'), $args ); ?> roles()->um_current_user_can( 'edit', um_user('ID') ) || UM()->roles()->um_user_can( 'can_edit_everyone' ) ) { ?>
@@ -45,7 +66,27 @@
+ /** + * 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 + * + */ + do_action( 'um_members_after_user_name', um_user('ID'), $args ); ?> - - - - - - - + + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + do_action( 'um_members_directory_footer', $args ); ?> - \ No newline at end of file diff --git a/templates/password-change.php b/templates/password-change.php index 421707c5..267ac462 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -4,22 +4,73 @@
- 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 + * + */ + 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 + * + */ + 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 + * + */ + 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); - - } - - ?> + } ?>
- - \ No newline at end of file diff --git a/templates/password-reset.php b/templates/password-reset.php index 2e827ae1..854669e9 100644 --- a/templates/password-reset.php +++ b/templates/password-reset.php @@ -7,27 +7,78 @@ 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 '
'; - - echo '

' . __('We have sent you a password reset link to your e-mail. Please check your inbox.', 'ultimate-member' ) . '

'; - - echo '
'; - - } - - ?> +
+

+
+ + - - \ No newline at end of file diff --git a/templates/profile.php b/templates/profile.php index df0a8cfa..82129b90 100644 --- a/templates/profile.php +++ b/templates/profile.php @@ -2,14 +2,73 @@
- + */ + do_action( 'um_profile_before_header', $args ); if ( um_is_on_edit_profile() ) { ?>
+ */ + 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 + * + */ + do_action( 'um_profile_header', $args ); /** * UM hook @@ -35,11 +94,51 @@ $classes = apply_filters( 'um_profile_navbar_classes', '' ); ?>
- + + */ + do_action( 'um_profile_navbar', $args ); ?>
- + */ + 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 "
"; // 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 + * + */ + 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 + * + */ + do_action( "um_profile_content_{$nav}_{$subnav}", $args ); print "
"; diff --git a/templates/register.php b/templates/register.php index 47339cb1..611998ed 100644 --- a/templates/register.php +++ b/templates/register.php @@ -5,20 +5,131 @@ + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + 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 + * + */ + do_action( "um_after_form", $args ); ?>