options()->get( 'profile_tab_main' ) && ! isset( $_REQUEST['um_action'] ) ) { return; } /** * UM hook * * @type filter * @title um_profile_can_view_main * @description Check user can view profile * @input_vars * [{"var":"$view","type":"bool","desc":"Can view?"}, * {"var":"$user_id","type":"int","desc":"User profile ID"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $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 { ?>
roles()->um_current_user_can( 'edit', $user_id ) ) { UM()->user()->set( $user_id ); } else { wp_die( __( 'You are not allowed to edit this user.', 'ultimate-member' ) ); } $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'] ) ) { $fields = apply_filters( 'um_user_edit_profile_fields', unserialize( $args['custom_fields'] ), $args ); } // loop through fields if ( ! empty( $fields ) ) { foreach ( $fields as $key => $array ) { if ( ! isset( $array['type'] ) ) { continue; } if ( isset( $array['edit_forbidden'] ) ) { continue; } // required option? 'required_opt' - it's field attribute predefined in the field data in code if ( isset( $array['required_opt'] ) ) { $opt = $array['required_opt']; if ( UM()->options()->get( $opt[0] ) != $opt[1] ) { continue; } } // fields that need to be disabled in edit mode (profile) (email, username, etc.) $arr_restricted_fields = UM()->fields()->get_restricted_fields_for_edit( $user_id ); if ( in_array( $key, $arr_restricted_fields ) ) { continue; } if ( ! um_can_edit_field( $array ) || ! um_can_view_field( $array ) ) { continue; } // skip saving role here if ( in_array( $key, array( 'role', 'role_select', 'role_radio' ) ) ) { continue; } //the same code in class-validation.php validate_fields_values for registration form //rating field validation if ( $array['type'] == 'rating' && isset( $args['submitted'][ $key ] ) ) { if ( ! is_numeric( $args['submitted'][ $key ] ) ) { continue; } else { if ( $array['number'] == 5 ) { if ( ! in_array( $args['submitted'][ $key ], range( 1, 5 ) ) ) { continue; } } elseif ( $array['number'] == 10 ) { if ( ! in_array( $args['submitted'][ $key ], range( 1, 10 ) ) ) { continue; } } } } /** * Returns dropdown/multi-select options keys from a callback function * @since 2019-05-30 */ $has_custom_source = apply_filters( "um_has_dropdown_options_source__{$key}", false ); if ( isset( $array['options'] ) && in_array( $array['type'], array( 'select', 'multiselect' ) ) ) { $options = array(); if ( ! empty( $array['custom_dropdown_options_source'] ) && function_exists( $array['custom_dropdown_options_source'] ) && ! $has_custom_source ) { if ( ! UM()->fields()->is_source_blacklisted( $array['custom_dropdown_options_source'] ) ) { $callback_result = call_user_func( $array['custom_dropdown_options_source'], $array['options'] ); if ( is_array( $callback_result ) ) { $options = array_keys( $callback_result ); } } } $array['options'] = apply_filters( "um_custom_dropdown_options__{$key}", $options ); } //validation of correct values from options in wp-admin $stripslashes = ''; if ( isset( $args['submitted'][ $key ] ) && is_string( $args['submitted'][ $key ] ) ) { $stripslashes = stripslashes( $args['submitted'][ $key ] ); } if ( in_array( $array['type'], array( 'select' ) ) ) { if ( ! empty( $array['options'] ) && ! empty( $stripslashes ) && ! in_array( $stripslashes, array_map( 'trim', $array['options'] ) ) && ! $has_custom_source ) { continue; } //update empty user meta if ( ! isset( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == '' ) { update_user_meta( $user_id, $key, '' ); } } //validation of correct values from options in wp-admin //the user cannot set invalid value in the hidden input at the page if ( in_array( $array['type'], array( 'multiselect', 'checkbox', 'radio' ) ) ) { if ( ! empty( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) ) { $args['submitted'][ $key ] = array_map( 'stripslashes', array_map( 'trim', $args['submitted'][ $key ] ) ); $args['submitted'][ $key ] = array_intersect( $args['submitted'][ $key ], array_map( 'trim', $array['options'] ) ); } // update empty user meta if ( ! isset( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == '' ) { update_user_meta( $user_id, $key, array() ); } } if ( isset( $args['submitted'][ $key ] ) ) { if ( isset( $array['type'] ) && in_array( $array['type'], array( 'image', 'file' ) ) ) { if ( um_is_temp_file( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == 'empty_file' ) { $files[ $key ] = $args['submitted'][ $key ]; } elseif( um_is_file_owner( UM()->uploader()->get_upload_base_url() . $user_id . '/' . $args['submitted'][ $key ], $user_id ) ) { } else { $files[ $key ] = 'empty_file'; } } else { if ( $array['type'] == 'password' ) { $to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] ); $args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] ); } else { if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) { $to_update[ $key ] = $args['submitted'][ $key ]; } elseif ( $args['submitted'][ $key ] != '' ) { $to_update[ $key ] = $args['submitted'][ $key ]; } } } // use this filter after all validations has been completed and we can extends data based on key $to_update = apply_filters( 'um_change_usermeta_for_update', $to_update, $args, $fields, $key ); } } } $description_key = UM()->profile()->get_show_bio_key( $args ); if ( isset( $args['submitted'][ $description_key ] ) ) { $to_update[ $description_key ] = $args['submitted'][ $description_key ]; } // Secure selected role if ( is_admin() ) { if ( ! empty( $args['submitted']['role'] ) && current_user_can( 'promote_users' ) ) { global $wp_roles; $exclude_roles = array_diff( array_keys( $wp_roles->roles ), UM()->roles()->get_editable_user_roles() ); if ( ! in_array( $args['submitted']['role'], $exclude_roles ) ) { $to_update['role'] = $args['submitted']['role']; } $args['roles_before_upgrade'] = UM()->roles()->get_all_user_roles( $user_id ); } } else { if ( ( isset( $fields['role'] ) && $fields['role']['editable'] != 0 && um_can_view_field( $fields['role'] ) ) || ( isset( $fields['role_select'] ) && $fields['role_select']['editable'] != 0 && um_can_view_field( $fields['role_select'] ) ) || ( isset( $fields['role_radio'] ) ) && $fields['role_radio']['editable'] != 0 && um_can_view_field( $fields['role_radio'] ) ) { if ( ! empty( $args['submitted']['role'] ) ) { global $wp_roles; $exclude_roles = array_diff( array_keys( $wp_roles->roles ), UM()->roles()->get_editable_user_roles() ); if ( ! in_array( $args['submitted']['role'], $exclude_roles ) ) { $to_update['role'] = $args['submitted']['role']; } $args['roles_before_upgrade'] = UM()->roles()->get_all_user_roles( $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"}, * {"var":"$user_id","type":"int","desc":"User ID"}] * @change_log * ["Since: 2.0"] * @usage add_action( 'um_user_pre_updating_profile', 'function_name', 10, 2 ); * @example * */ do_action( 'um_user_pre_updating_profile', $to_update, $user_id ); /** * UM hook * * @type filter * @title um_user_pre_updating_profile_array * @description Change submitted data before update profile * @input_vars * [{"var":"$to_update","type":"array","desc":"Profile data upgrade"}, * {"var":"$user_id","type":"int","desc":"User ID"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $to_update = apply_filters( 'um_user_pre_updating_profile_array', $to_update, $user_id ); if ( is_array( $to_update ) ) { if ( isset( $to_update['first_name'] ) || isset( $to_update['last_name'] ) || isset( $to_update['nickname'] ) ) { $user = get_userdata( $user_id ); if ( ! empty( $user ) && ! is_wp_error( $user ) ) { UM()->user()->previous_data['display_name'] = $user->display_name; if ( isset( $to_update['first_name'] ) ) { UM()->user()->previous_data['first_name'] = $user->first_name; } if ( isset( $to_update['last_name'] ) ) { UM()->user()->previous_data['last_name'] = $user->last_name; } if ( isset( $to_update['nickname'] ) ) { UM()->user()->previous_data['nickname'] = $user->nickname; } } } 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', $user_id, $args, $to_update ); } /** * UM hook * * @type filter * @title um_user_pre_updating_files_array * @description Change submitted files before update profile * @input_vars * [{"var":"$files","type":"array","desc":"Profile data files"}, * {"var":"$user_id","type":"int","desc":"User ID"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $files = apply_filters( 'um_user_pre_updating_files_array', $files, $user_id ); if ( ! empty( $files ) && is_array( $files ) ) { UM()->uploader()->replace_upload_dir = true; UM()->uploader()->move_temporary_files( $user_id, $files ); UM()->uploader()->replace_upload_dir = false; } /** * 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"}, * {"var":"$user_id","type":"int","desc":"User Id"}] * @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, $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, $to_update ); if ( ! isset( $args['is_signup'] ) ) { $url = um_user_profile_url( $user_id ); $url = apply_filters( 'um_update_profile_redirect_after', $url, $user_id, $args ); exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) ); } } add_action( 'um_user_edit_profile', 'um_user_edit_profile', 10 ); /** * @param array $post_form */ function um_profile_validate_nonce( $post_form ) { $user_id = isset( $post_form['user_id'] ) ? $post_form['user_id'] : ''; $nonce = isset( $post_form['profile_nonce'] ) ? $post_form['profile_nonce'] : ''; if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'um-profile-nonce' . $user_id ) ) { wp_die( __( 'This is not possible for security reasons.', 'ultimate-member' ) ); } } add_action( 'um_submit_form_errors_hook__profile', 'um_profile_validate_nonce', 10, 1 ); add_filter( 'um_user_pre_updating_files_array', array( UM()->validation(), 'validate_files' ), 10, 1 ); add_filter( 'um_before_save_filter_submitted', array( UM()->validation(), 'validate_fields_values' ), 10, 2 ); /** * Leave roles for User, which are not in the list of update profile (are default WP or 3rd plugins roles) * * @param $user_id * @param $args * @param $to_update */ function um_restore_default_roles( $user_id, $args, $to_update ) { if ( ! empty( $args['submitted']['role'] ) && ! empty( $to_update['role'] ) ) { $wp_user = new WP_User( $user_id ); $leave_roles = array_diff( $args['roles_before_upgrade'], UM()->roles()->get_editable_user_roles() ); if ( UM()->roles()->is_role_custom( $to_update['role'] ) ) { $wp_user->remove_role( $to_update['role'] ); $roles = array_merge( $leave_roles, array( $to_update['role'] ) ); } else { $roles = array_merge( array( $to_update['role'] ), $leave_roles ); } foreach ( $roles as $role_k ) { $wp_user->add_role( $role_k ); } } } add_action( 'um_after_user_updated', 'um_restore_default_roles', 10, 3 ); /** * If editing another user * * @param $args */ function um_editing_user_id_input( $args ) { if ( UM()->fields()->editing == 1 && UM()->fields()->set_mode == 'profile' && UM()->user()->target_id ) { ?> Settings > Reading] * "Profile Privacy" in [Account > Privacy] * "Avoid indexing my profile by search engines in [Account > Privacy] * "Avoid indexing profile by search engines" in [wp-admin > Ultimate Member > User Roles > Edit Role] * "Avoid indexing profile by search engines" in [wp-admin > Ultimate Member > Settings > General > Users] */ if ( UM()->user()->is_profile_noindex( $user_id ) ) { echo ''; return; } $locale = get_user_locale( $user_id ); $site_name = get_bloginfo( 'name' ); $twitter = (string) um_user( 'twitter' ); if ( ! empty( $twitter ) ) { $twitter = trim( str_replace( 'https://twitter.com/', '', $twitter ), "/ \n\r\t\v\0" ); } $title = trim( um_user( 'display_name' ) ); $description = um_convert_tags( UM()->options()->get( 'profile_desc' ) ); $url = um_user_profile_url( $user_id ); /** * UM hook * * @type filter * @title um_profile_dynamic_meta_image_size * @description Change the profile SEO image size. Default 190. Available 'original'. * @input_vars * [{"var":"$image_size","type":"int|string","desc":"Image size"}, * {"var":"$user_id","type":"int","desc":"User ID"}] * @change_log * ["Since: 2.5.5"] * @usage add_filter( 'um_profile_dynamic_meta_image_size', 'function_name', 10, 2 ); * @example * */ $image_size = apply_filters( 'um_profile_dynamic_meta_image_size', 190, $user_id ); /** * UM hook * * @type filter * @title um_profile_dynamic_meta_image_type * @description Change the profile SEO image type. Default 'profile_photo'. Available 'cover_photo', 'profile_photo', . * @input_vars * [{"var":"$image_type","type":"string","desc":"Image type - cover_photo or profile_photo"}, * {"var":"$user_id","type":"int","desc":"User ID"}] * @change_log * ["Since: 2.5.5"] * @usage add_filter( 'um_profile_dynamic_meta_image_type', 'function_name', 10, 2 ); * @example * */ $image_type = apply_filters( 'um_profile_dynamic_meta_image_type', 'profile_photo', $user_id ); if ( 'cover_photo' === $image_type ) { if ( is_numeric( $image_size ) ) { $sizes = UM()->options()->get( 'cover_thumb_sizes' ); if ( is_array( $sizes ) ) { $image_size = um_closest_num( $sizes, $image_size ); } $image = um_get_cover_uri( um_profile( 'cover_photo' ), $image_size ); } else { $image = um_get_cover_uri( um_profile( 'cover_photo' ), null ); } } else { if ( is_numeric( $image_size ) ) { $sizes = UM()->options()->get( 'photo_thumb_sizes' ); if ( is_array( $sizes ) ) { $image_size = um_closest_num( $sizes, $image_size ); } $image = um_get_user_avatar_url( $user_id, $image_size ); } else { $image = um_get_user_avatar_url( $user_id, 'original' ); } } $person = array( "@context" => "http://schema.org", "@type" => "Person", "name" => esc_attr( $title ), "description" => esc_attr( stripslashes( $description ) ), "image" => esc_url( $image ), "url" => esc_url( $url ), ); um_reset_user(); ?> options()->get( 'default_cover' ); $overlay = ' ' . __( 'Change your cover photo', 'ultimate-member' ) . ' '; ?>
*/ do_action( 'um_cover_area_content', um_profile_id() ); if ( UM()->fields()->editing ) { $hide_remove = um_user( 'cover_photo' ) ? false : ' style="display:none;"'; $text = ! um_user( 'cover_photo' ) ? __( 'Upload a cover photo', 'ultimate-member' ) : __( 'Change cover photo', 'ultimate-member' ) ; $items = array( '' . $text . '', '' . __( 'Remove', 'ultimate-member' ) . '', '' . __( 'Cancel', 'ultimate-member' ) . '', ); $items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() ); UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items ); } else { if ( ! isset( UM()->user()->cannot_edit ) && ! um_user( 'cover_photo' ) ) { $items = array( '' . __( 'Upload a cover photo', 'ultimate-member' ) . '', '' . __( 'Cancel', 'ultimate-member' ) . '', ); $items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() ); UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items ); } } UM()->fields()->add_hidden_field( 'cover_photo' ); ?>
mobile()->isMobile() ) { // set for mobile width = 300 by default but can be changed via filter if ( ! UM()->mobile()->isTablet() ) { $size = 300; } /** * UM hook * * @type filter * @title um_mobile_cover_photo * @description Add size for mobile device * @input_vars * [{"var":"$size","type":"int","desc":"Form's agrument - Cover Photo size"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $size = apply_filters( 'um_mobile_cover_photo', $size ); } echo um_user( 'cover_photo', $size ); } elseif ( $default_cover && $default_cover['url'] ) { $default_cover = $default_cover['url']; echo ''; } else { if ( ! isset( UM()->user()->cannot_edit ) ) { ?>
'; UM()->fields()->show_social_urls(); echo ''; } } add_action( 'um_after_profile_header_name_args', 'um_social_links_icons', 50 ); /** * Profile header * * @param $args */ function um_profile_header( $args ) { $classes = null; if ( ! $args['cover_enabled'] ) { $classes .= ' no-cover'; } $default_size = str_replace( 'px', '', $args['photosize'] ); // Switch on/off the profile photo uploader $disable_photo_uploader = empty( $args['use_custom_settings'] ) ? UM()->options()->get( 'disable_profile_photo_upload' ) : $args['disable_photo_upload']; if ( ! empty( $disable_photo_uploader ) ) { $args['disable_photo_upload'] = 1; $overlay = ''; } else { $overlay = ' '; } ?>
*/ do_action( 'um_pre_header_editprofile', $args ); ?>
uploader()->get_upload_base_url() . um_user( 'ID' ) . "/" . um_profile( 'profile_photo' ); $data = um_get_user_avatar_data( um_user( 'ID' ) ); echo $overlay . sprintf( '%s', esc_url( $profile_photo ), esc_attr( $data['class'] ), esc_attr( $data['alt'] ), esc_attr( $data['default'] ), 'if ( ! this.getAttribute(\'data-load-error\') ){ this.setAttribute(\'data-load-error\', \'1\');this.setAttribute(\'src\', this.getAttribute(\'data-default\'));}' ); } else { echo $overlay . get_avatar( um_user( 'ID' ), $default_size ); } ?> user()->cannot_edit ) ) { UM()->fields()->add_hidden_field( 'profile_photo' ); if ( ! um_profile( 'profile_photo' ) ) { // has profile photo $items = array( '' . __( 'Upload photo', 'ultimate-member' ) . '', '' . __( 'Cancel', 'ultimate-member' ) . '', ); /** * UM hook * * @type filter * @title um_user_photo_menu_view * @description Change user photo on menu view * @input_vars * [{"var":"$items","type":"array","desc":"User Photos"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $items = apply_filters( 'um_user_photo_menu_view', $items ); UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items ); } elseif ( UM()->fields()->editing == true ) { $items = array( '' . __( 'Change photo', 'ultimate-member' ) . '', '' . __( 'Remove photo', 'ultimate-member' ) . '', '' . __( 'Cancel', 'ultimate-member' ) . '', ); /** * UM hook * * @type filter * @title um_user_photo_menu_edit * @description Change user photo on menu edit * @input_vars * [{"var":"$items","type":"array","desc":"User Photos"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $items = apply_filters( 'um_user_photo_menu_edit', $items ); UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items ); } } ?>
*/ do_action( 'um_before_profile_main_meta', $args ); ?>
*/ 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' ); ?>
profile()->show_meta( $args['metafields'] ); ?>
profile()->get_show_bio_key( $args ); if ( UM()->fields()->viewing == true && um_user( $description_key ) && $args['show_bio'] ) { ?>
options()->get( 'profile_show_html_bio' ) ) { echo make_clickable( wpautop( wp_kses_post( $description ) ) ); } else { echo esc_html( $description ); } ?>
fields()->editing == true && $args['show_bio'] ) { ?>
options()->get( 'profile_bio_maxchars' ); ?> fields()->is_error( $description_key ) ) { echo UM()->fields()->field_error( UM()->fields()->show_error( $description_key ), true ); } ?>
*/ 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' ); } /** * 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 ); ?>
fields()->editing ) { if ( um_get_requested_user() ) { if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) ) { um_redirect_home( um_get_requested_user(), um_is_myprofile() ); } um_fetch_user( um_get_requested_user() ); } } else { UM()->fields()->viewing = 1; if ( um_get_requested_user() ) { if ( ! um_can_view_profile( um_get_requested_user() ) && ! um_is_myprofile() ) { um_redirect_home( um_get_requested_user(), um_is_myprofile() ); } if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) ) { UM()->user()->cannot_edit = 1; } um_fetch_user( um_get_requested_user() ); } else { if ( ! is_user_logged_in() ) { um_redirect_home( um_get_requested_user(), um_is_myprofile() ); } if ( ! um_user( 'can_edit_profile' ) ) { UM()->user()->cannot_edit = 1; } } } } } add_action( 'um_pre_profile_shortcode', 'um_pre_profile_shortcode' ); /** * Display the edit profile icon * * @param $args */ function um_add_edit_icon( $args ) { if ( ! is_user_logged_in() ) { // not allowed for guests return; } // do not proceed if user cannot edit if ( UM()->fields()->editing == true ) { ?>
roles()->um_current_user_can( 'edit', um_profile_id() ) && ! UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) { return; } $items = UM()->user()->get_admin_actions(); if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) { $items['editprofile'] = '' . __( 'Edit Profile', 'ultimate-member' ) . ''; } /** * UM hook * * @type filter * @title um_profile_edit_menu_items * @description Edit menu items on profile page * @input_vars * [{"var":"$items","type":"array","desc":"User Menu"}, * {"var":"$user_id","type":"int","desc":"Profile ID"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() ); $items['cancel'] = '' . __( 'Cancel', 'ultimate-member' ) . ''; } else { $items = array( 'editprofile' => '' . __( 'Edit Profile', 'ultimate-member' ) . '', 'myaccount' => '' . __( 'My Account', 'ultimate-member' ) . '', 'logout' => '' . __( 'Logout', 'ultimate-member' ) . '', 'cancel' => '' . __( 'Cancel', 'ultimate-member' ) . '', ); if ( ! empty( UM()->user()->cannot_edit ) ) { unset( $items['editprofile'] ); } /** * UM hook * * @type filter * @title um_myprofile_edit_menu_items * @description Edit menu items on my profile page * @input_vars * [{"var":"$items","type":"array","desc":"User Menu"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $items = apply_filters( 'um_myprofile_edit_menu_items', $items ); } ?>
profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items ); ?>
fields()->editing == true ) { echo UM()->fields()->display( 'profile', $args ); } else { UM()->fields()->viewing = true; echo UM()->fields()->display_view( 'profile', $args ); } } add_action( 'um_main_profile_fields', 'um_add_profile_fields', 100 ); /** * Form processing * * @param $args */ function um_submit_form_profile( $args ) { if ( isset( UM()->form()->errors ) ) { return; } UM()->fields()->set_mode = 'profile'; UM()->fields()->editing = true; if ( ! empty( $args['submitted'] ) ) { $args['submitted'] = UM()->form()->clean_submitted_data( $args['submitted'] ); } /** * 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 ); } add_action( 'um_submit_form_profile', 'um_submit_form_profile', 10 ); /** * Show the submit button (highest priority) * * @param $args */ function um_add_submit_button_to_profile( $args ) { // DO NOT add when reviewing user's details if ( UM()->user()->preview == true && is_admin() ) { return; } // only when editing if ( UM()->fields()->editing == false ) { return; } if ( ! isset( $args['primary_btn_word'] ) || $args['primary_btn_word'] == '' ){ $args['primary_btn_word'] = UM()->options()->get( 'profile_primary_btn_word' ); } if ( ! isset( $args['secondary_btn_word'] ) || $args['secondary_btn_word'] == '' ){ $args['secondary_btn_word'] = UM()->options()->get( 'profile_secondary_btn_word' ); } ?>
options()->get( 'profile_menu' ) ) { return; } // get active tabs $tabs = UM()->profile()->tabs_active(); $all_tabs = $tabs; $tabs = array_filter( $tabs, function( $item ) { if ( ! empty( $item['hidden'] ) ) { return false; } return true; }); $active_tab = UM()->profile()->active_tab(); //check here tabs with hidden also, to make correct check of active tab if ( ! isset( $all_tabs[ $active_tab ] ) || um_is_on_edit_profile() ) { $active_tab = 'main'; UM()->profile()->active_tab = $active_tab; UM()->profile()->active_subnav = null; } $has_subnav = false; if ( count( $tabs ) == 1 ) { foreach ( $tabs as $tab ) { if ( isset( $tab['subnav'] ) ) { $has_subnav = true; } } } // need enough tabs to continue if ( count( $tabs ) <= 1 && ! $has_subnav && count( $all_tabs ) === count( $tabs ) ) { return; } if ( count( $tabs ) > 1 || count( $all_tabs ) > count( $tabs ) ) { // Move default tab priority $default_tab = UM()->options()->get( 'profile_menu_default_tab' ); $dtab = ( isset( $tabs[ $default_tab ] ) ) ? $tabs[ $default_tab ] : 'main'; if ( isset( $tabs[ $default_tab ] ) ) { unset( $tabs[ $default_tab ] ); $dtabs[ $default_tab ] = $dtab; $tabs = $dtabs + $tabs; } if ( ! empty( $tabs ) ) { ?>
$tab ) { $nav_link = UM()->permalinks()->get_current_url( get_option( 'permalink_structure' ) ); $nav_link = remove_query_arg( 'um_action', $nav_link ); $nav_link = remove_query_arg( 'subnav', $nav_link ); $nav_link = add_query_arg( 'profiletab', $id, $nav_link ); /** * UM hook * * @type filter * @title um_profile_menu_link_{$id} * @description Change profile menu link by tab $id * @input_vars * [{"var":"$nav_link","type":"string","desc":"Profile Tab Link"}] * @change_log * ["Since: 2.0"] * @usage * * @example * */ $nav_link = apply_filters( "um_profile_menu_link_{$id}", $nav_link ); /** * Filters a profile menu navigation links' tag attributes. * * @since 2.6.3 * @hook um_profile_menu_link_{$id}_attrs * * @param {string} $profile_nav_attrs Link's tag attributes. * @param {array} $args Profile form arguments. * * @return {string} Link's tag attributes. * * @example Add a link's tag attributes. * function um_profile_menu_link_attrs( $profile_nav_attrs ) { * // your code here * return $profile_nav_attrs; * } * add_filter( 'um_profile_menu_link_{$id}_attrs', 'um_profile_menu_link_attrs', 10, 1 ); */ $profile_nav_attrs = apply_filters( "um_profile_menu_link_{$id}_attrs", '', $args ); $profile_nav_class = ''; if ( ! UM()->options()->get( 'profile_menu_icons' ) ) { $profile_nav_class .= ' without-icon'; } if ( $id == $active_tab ) { $profile_nav_class .= ' active'; } ?>
options()->get( 'profile_menu_icons' ) ) { ?> > 0 ) { ?> > 0 ) { ?> > 0 ) { ?> > 0 ) { ?>
$tab ) { if ( isset( $tab['subnav'] ) && $active_tab == $id ) { $active_subnav = ( UM()->profile()->active_subnav() ) ? UM()->profile()->active_subnav() : $tab['subnav_default']; ?>
$subtab ) { $subnav_link = add_query_arg( 'subnav', $id_s ); $subnav_link = apply_filters( 'um_user_profile_subnav_link', $subnav_link, $id_s, $subtab ); ?>