mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- reviewed um_profile_content_main();
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
} // Exit if accessed directly
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Um_profile_content_{main_tab}
|
||||
* It renders the content of main profile tab.
|
||||
*
|
||||
* @param $args
|
||||
* @param array $args
|
||||
*/
|
||||
function um_profile_content_main( $args ) {
|
||||
|
||||
if ( ! array_key_exists( 'mode', $args ) ) {
|
||||
return;
|
||||
}
|
||||
$mode = $args['mode'];
|
||||
|
||||
if ( ! UM()->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 <caption>Can view profile.</caption>
|
||||
* function my_profile_can_view_main( $can_view, $user_id ) {
|
||||
* // your code here
|
||||
* @example <caption>Make profile hidden.</caption>
|
||||
* 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 <caption>Make any custom action before form.</caption>
|
||||
* @example <caption>Make any custom action before UM form.</caption>
|
||||
* 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 <caption>Make any custom action before fields.</caption>
|
||||
* function my_before_fields( $args ) {
|
||||
* @example <caption>Make any custom action before UM Profile form fields.</caption>
|
||||
* 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 <caption>Make any custom action before UM Login form fields.</caption>
|
||||
* function my_before_login_fields( $args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* add_action( 'um_before_login_fields', 'my_before_login_fields' );
|
||||
* @example <caption>Make any custom action before UM Register form fields.</caption>
|
||||
* 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 <caption>Make any custom action before login form fields.</caption>
|
||||
* function my_before_form( $args ) {
|
||||
* @example <caption>Make any custom action when profile form fields are rendered.</caption>
|
||||
* 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 <caption>Make any custom action when login form fields are rendered.</caption>
|
||||
* function my_main_login_fields( $args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* add_action( 'um_main_login_fields', 'my_main_login_fields' );
|
||||
* @example <caption>Make any custom action when register form fields are rendered.</caption>
|
||||
* 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 <caption>Make any custom action after login form fields.</caption>
|
||||
* @example <caption>Make any custom action after UM Form fields.</caption>
|
||||
* 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 <caption>Make any custom action after profile form fields.</caption>
|
||||
* 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 <caption>Make any custom action after login form fields.</caption>
|
||||
* function my_after_login_fields( $args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* add_action( 'um_after_login_fields', 'my_after_login_fields' );
|
||||
* @example <caption>Make any custom action after register form fields.</caption>
|
||||
* 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 <caption>Make any custom action after profile form fields.</caption>
|
||||
* @example <caption>Make any custom action after UM Form content.</caption>
|
||||
* 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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user