Skip to content

Instantly share code, notes, and snippets.

View yuriinalivaiko's full-sized avatar

Yurii Nalivaiko yuriinalivaiko

View GitHub Profile
@yuriinalivaiko
yuriinalivaiko / um_email_notifications_profile_is_complete.php
Last active November 24, 2025 18:03
This code adds custom email template "Profile Completeness - Profile is complete" to be used in the "Ultimate Member - Profile Completeness" extension.
<?php
/**
* Add custom email template "Profile Completeness - Profile is complete".
*
* @param array $emails Emails list.
* @return array
*/
function um_email_notification_profile_is_complete( $emails ) {
@yuriinalivaiko
yuriinalivaiko / um_user_locations_map_args_customize_02.php
Last active October 26, 2023 11:29
This code snippet disables the ability to pan and zoom the map in the extension User Locations.
<?php
/**
* Disable the ability to pan and zoom the map.
*/
add_action( 'wp_footer', function () {
?><script type="text/javascript">
function um_user_locations_customize_02 ( args, hash, directory ) {
args.zoom = 4;
@yuriinalivaiko
yuriinalivaiko / um_profile_completeness_complete_profile_redirect.php
Last active July 10, 2022 11:12
Customize redirection after the profile is completed in the widget "Ultimate Member - Complete your Profile".
<?php
/**
* Redirection after profile is completed
* Add this code to the file functions.php in the active theme directory.
*/
add_filter( 'um_profile_completeness_complete_profile_redirect', function( $redirect, $user_id, $result ) {
if ( is_array( $result ) && absint( $result['progress'] ) >= absint( $result['req_progress'] ) ) {
$redirect = home_url();
@yuriinalivaiko
yuriinalivaiko / um_member_directory_notme.php
Last active July 10, 2022 11:08
This code snippet prevents members from being able to see themselves in the member directory.
<?php
/**
* Prevent members from being able to see themselves in the member directory.
* Add this code to the file functions.php in the active theme directory.
*/
function um_pre_users_query_notme( $directory ) {
if ( is_user_logged_in() ) {
$directory->where_clauses[] = 'u.ID != ' . get_current_user_id();
@yuriinalivaiko
yuriinalivaiko / um_display_all_form_errors.css
Last active December 12, 2024 18:54
Display all form errors below the form in Ultimate Member.
/**
* Hide error messages under fields.
*/
.um-field .um-field-error {
display: none;
}
@yuriinalivaiko
yuriinalivaiko / js_code_snippet.js
Last active August 3, 2022 10:59
Use one of these code snippets to fix a form view in popup. This example uses a button selector for the Elementor popup. Change a button selector to use this code with another popup plugin.
/**
* A code snippet that triggers the "resize" once the popup is open.
* Add this code to your custom JS file.
*/
jQuery( '.elementor-button[href^="#elementor-action"]' ).on( 'click', function () {
setTimeout( function() {
jQuery( window ).trigger( 'resize' );
}, 100 );
} );
@yuriinalivaiko
yuriinalivaiko / um_sitemaps_users.php
Last active February 12, 2023 20:38
This code snippet adds all approved users whose Ultimate Member profiles are public to the sitemap.
<?php
/**
* Add all approved users whose Ultimate Member profiles are public to the sitemap.
* Add this code to the file functions.php in the active theme directory.
*/
add_filter( 'wp_sitemaps_max_urls', 'um_sitemaps_users_max_urls', 10, 2 );
add_filter( 'wp_sitemaps_users_pre_max_num_pages', 'um_sitemaps_users_max_num_pages', 10, 1 );
add_filter( 'wp_sitemaps_users_pre_url_list', 'um_sitemaps_users_get_url_list', 10, 2 );
@yuriinalivaiko
yuriinalivaiko / re-initialize_dropdown_fields.js
Last active November 27, 2022 13:02
This code snippet can fix a dropdown functionality in Ultimate Member if it is broken due to plugins conflict.
/**
* Re-initialize dropdown functionality.
* Add this code to your custom JS file.
*/
jQuery( function () {
/**
* Verifies that there is no empty value.
*/
function unselectEmptyOption( e ) {
@yuriinalivaiko
yuriinalivaiko / um_account_custom_fields.php
Last active November 23, 2024 12:21
This code snippet adds fields to the main Account tab.
<?php
// Add pre-defined fields to the main Account tab.
function um_account_tab_general_fields( $args, $shortcode_args ) {
// Fields Meta Keys.
$args .= ',birth_date';
$args .= ',country';
$args .= ',languages';
@yuriinalivaiko
yuriinalivaiko / my_before_password_form_is_loaded.php
Last active September 7, 2022 12:07
This gist provides examples and description for hooks used by the Ultimate Member plugin on password reset process.
<?php
/**
* Description: Fires before the password reset form shortcode is loaded.
*
* Hook: um_before_password_form_is_loaded
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC239