Skip to content

Instantly share code, notes, and snippets.

@denisbaranov
denisbaranov / um_grouped_filtes_custom.php
Last active February 12, 2023 17:59
This example shows how to group several filters in the Members Directory of the Ultimate Member (with the custom table for usermeta).
<?php
/**
* This example shows how to group several filters in the Members Directory of the Ultimate Member.
* For example there are three phone fields in the profile ("Phone", "Phone number", "Mobile Number"),
* but you want to use a single filter "Phone number" to filter by these three fields in the Member Directory.
*
* Note: This example works if the setting "Enable custom table for usermeta" is turned on.
* See the gist https://gist.github.com/denisbaranov/3631abb45a05d6cdfbb6a4b6a6862b4c otherwise.
*
@denisbaranov
denisbaranov / Block the email address by domain.php
Last active February 2, 2021 16:56
The following code requires users to register with a business email only and blocks popular email services, such as @gmail.com, @yahoo.com. ect. The code below requires a user email to be collected during registration.
<?php
/**
* This example shows how to validate the email address by domain on registration.
* The code below requires a user email to be collected during registration.
*
* Change the array $forbidden_email_domains - add or remove domains you need.
* Add this code snippet to the end of the file functions.php in the active theme directory.
*
* Ultimate Member documentation: https://docs.ultimatemember.com/
@denisbaranov
denisbaranov / Add an image field into the profile card in the member directory.php
Last active February 7, 2021 17:08
​Special field types (files, images, etc.) can't be added into the profile card. Settings don't contain these fields. You can use your custom function attached to the filter "um_ajax_get_members_data" to add additional data into the variable "user".
<?php
/**
* This example shows how to add an image field into the variable "user" in the member directory.
*
* Change the variable $key - enter meta_key of the field you need.
* Add this code snippet to the end of the file functions.php in the active theme directory.
*
* @link Documentation https://docs.ultimatemember.com/
* @link Article https://docs.ultimatemember.com/article/1586-add-an-image-field-into-the-profile-card-in-the-member-directory
*/
@denisbaranov
denisbaranov / um_member_directory_disable_clustering.php
Last active September 18, 2021 12:03
You can find some code samples for using hooks in the extension User Locations
<?php
/**
* Disable Clustering
* You may add this code to the file functions.php in the active theme directory.
*
* @author Ultimate Member support <[email protected]>
* @link https://ultimatemember.com/extensions/user-locations/
*/
add_action( 'wp_footer', function () {