diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php
index febbb555..1376c69a 100644
--- a/includes/core/um-actions-profile.php
+++ b/includes/core/um-actions-profile.php
@@ -1,38 +1,38 @@
-options()->get( 'profile_tab_main' ) && ! isset( $_REQUEST['um_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
+ // phpcs:ignore WordPress.Security.NonceVerification -- $_REQUEST is used for echo only
+ if ( ! isset( $_REQUEST['um_action'] ) && ! UM()->options()->get( 'profile_tab_main' ) ) {
return;
}
/**
- * Filters check user can view profile
+ * Filters user's ability to view a profile
*
- * @since 2.0
+ * @since 1.3.x
* @hook um_profile_can_view_main
*
- * @param {int} $can_view Can view profile.
- * @param {int} $user_id User ID.
+ * @param {int} $can_view Can view profile. It's -1 by default.
+ * @param {int} $profile_id User Profile ID.
*
- * @return {int} Can view profile.
+ * @return {int} Can view profile. Set it to -1 for displaying and vice versa to hide.
*
- * @example
Can view profile.
- * function my_profile_can_view_main( $can_view, $user_id ) {
- * // your code here
+ * @example Make profile hidden.
+ * function my_profile_can_view_main( $can_view, $profile_id ) {
+ * $can_view = 1; // make profile hidden.
* return $can_view;
* }
* add_filter( 'um_profile_can_view_main', 'my_profile_can_view_main', 10, 2 );
@@ -41,98 +41,129 @@ function um_profile_content_main( $args ) {
if ( -1 === (int) $can_view ) {
/**
- * Fires before form.
+ * Fires before UM Form content.
*
- * @since 2.0
+ * @since 1.3.x
* @hook um_before_form
*
- * @param {array} $args Profile form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
- * @example Make any custom action before form.
+ * @example Make any custom action before UM form.
* function my_before_form( $args ) {
* // your code here
* }
- * add_action( 'um_before_form', 'my_before_form', 10, 1 );
+ * add_action( 'um_before_form', 'my_before_form' );
*/
do_action( 'um_before_form', $args );
-
/**
- * Fires before profile form fields.
+ * Fires before UM Form fields.
*
- * @since 2.0
+ * Note: $mode can be equals to 'login', 'profile', 'register'.
+ *
+ * @since 1.3.x
* @hook um_before_{$mode}_fields
*
- * @param {array} $args Profile form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
- * @example Make any custom action before fields.
- * function my_before_fields( $args ) {
+ * @example Make any custom action before UM Profile form fields.
+ * function my_before_profile_fields( $args ) {
* // your code here
* }
- * add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
+ * add_action( 'um_before_profile_fields', 'my_before_profile_fields' );
+ * @example Make any custom action before UM Login form fields.
+ * function my_before_login_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_before_login_fields', 'my_before_login_fields' );
+ * @example Make any custom action before UM Register form fields.
+ * function my_before_register_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_before_register_fields', 'my_before_register_fields' );
*/
do_action( "um_before_{$mode}_fields", $args );
-
/**
- * Fires before login form fields.
+ * Fires for rendering UM Form fields.
*
- * @since 2.0
+ * Note: $mode can be equals to 'login', 'profile', 'register'.
+ *
+ * @since 1.3.x
* @hook um_main_{$mode}_fields
*
- * @param {array} $args Login form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
- * @example Make any custom action before login form fields.
- * function my_before_form( $args ) {
+ * @example Make any custom action when profile form fields are rendered.
+ * function my_main_profile_fields( $args ) {
* // your code here
* }
- * add_action( 'um_main_{$mode}_fields', 'my_before_form', 10, 1 );
+ * add_action( 'um_main_profile_fields', 'my_main_profile_fields' );
+ * @example Make any custom action when login form fields are rendered.
+ * function my_main_login_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_main_login_fields', 'my_main_login_fields' );
+ * @example Make any custom action when register form fields are rendered.
+ * function my_main_register_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_main_register_fields', 'my_main_register_fields' );
*/
do_action( "um_main_{$mode}_fields", $args );
-
/**
- * Fires after login form fields.
+ * Fires after UM Form fields.
*
- * @since 2.0
+ * @since 1.3.x
* @hook um_after_form_fields
*
- * @param {array} $args Login form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
- * @example Make any custom action after login form fields.
+ * @example Make any custom action after UM Form fields.
* function my_after_form_fields( $args ) {
* // your code here
* }
- * add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
+ * add_action( 'um_after_form_fields', 'my_after_form_fields' );
*/
do_action( 'um_after_form_fields', $args );
-
/**
- * Fires after profile form fields.
+ * Fires after UM Form fields.
*
- * @since 2.0
+ * Note: $mode can be equals to 'login', 'profile', 'register'.
+ *
+ * @since 1.3.x
* @hook um_after_{$mode}_fields
*
- * @param {array} $args Profile form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
* @example Make any custom action after profile form fields.
- * function my_after_form_fields( $args ) {
+ * function my_after_profile_fields( $args ) {
* // your code here
* }
- * add_action( 'um_after_{$mode}_fields', 'my_after_form_fields', 10, 1 );
+ * add_action( 'um_after_profile_fields', 'my_after_profile_fields' );
+ * @example Make any custom action after login form fields.
+ * function my_after_login_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_after_login_fields', 'my_after_login_fields' );
+ * @example Make any custom action after register form fields.
+ * function my_after_register_fields( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_after_register_fields', 'my_after_register_fields' );
*/
do_action( "um_after_{$mode}_fields", $args );
-
/**
- * Fires after profile form fields.
+ * Fires after UM Form content.
*
- * @since 2.0
- * @hook my_after_form
+ * @since 1.3.x
+ * @hook um_after_form
*
- * @param {array} $args Profile form shortcode arguments.
+ * @param {array} $args UM Form shortcode arguments.
*
- * @example Make any custom action after profile form fields.
+ * @example Make any custom action after UM Form content.
* function my_after_form( $args ) {
* // your code here
* }
- * add_action( 'my_after_form', 'my_after_form', 10, 1 );
+ * add_action( 'um_after_form', 'my_after_form' );
*/
do_action( 'um_after_form', $args );
@@ -149,7 +180,6 @@ function um_profile_content_main( $args ) {
}
add_action( 'um_profile_content_main', 'um_profile_content_main' );
-
/**
* Update user's profile
*