Skip to content

Instantly share code, notes, and snippets.

@denisbaranov
denisbaranov / Manual approve a new member after email verification
Last active November 24, 2022 11:47
The way to use both Email verification and Admin review in Ultimate Member. This custom code works if the user role setting "Registration Status" is "Require Email Activation". This code snippet removes the default function, which handles email confirmation, and adds a new instead. Add this code to the end of the functions.php file in the active…
/**
* Set status 'awaiting_admin_review' after the Email verification
*/
function my_activate_account_via_email_link() {
if ( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'activate_via_email' && isset( $_REQUEST['hash'] ) && is_string( $_REQUEST['hash'] ) && strlen( $_REQUEST['hash'] ) == 40 &&
isset( $_REQUEST['user_id'] ) && is_numeric( $_REQUEST['user_id'] ) ) { // valid token
$user_id = absint( $_REQUEST['user_id'] );
delete_option( "um_cache_userdata_{$user_id}" );
um_fetch_user( $user_id );
@denisbaranov
denisbaranov / Show default field value on if field value is empty.php
Last active July 7, 2020 11:22
How to show default field value on "view" mode if field value is empty.
<?php
/**
* This code shows default field value on "view" mode if field value is empty in the Profile form of the Ultimate Member.
*
* You can add this code to the end of the file functions.php in the active theme (child theme) directory.
*
* Ultimate Member documentation: https://docs.ultimatemember.com/
* Ultimate Member support (for customers): https://ultimatemember.com/support/ticket/
*/
@denisbaranov
denisbaranov / Add new profile tab with a form.php
Last active January 25, 2024 01:16
This example shows how to add a new tab into the Profile page of the Ultimate Member.
<?php
/**
* This example shows how to add a new tab into the Profile page of the Ultimate Member.
* See the article https://docs.ultimatemember.com/article/69-how-do-i-add-my-extra-tabs-to-user-profiles
*
* This example adds the tab 'mycustomtab' that contains the field 'description'. You can add your own tabs and fields.
* Important! Each profile tab has an unique key. Replace 'mycustomtab' to your unique key.
*
* You can add this code to the end of the file functions.php in the active theme (child theme) directory.
@denisbaranov
denisbaranov / Add new account tab with custom WooCommerce fields.php
Last active June 18, 2021 10:34
This example shows how to add custom Account tab with WooCommerce fields in Ultimate Member.
<?php
/**
* This example shows how to add custom Account tab with WooCommerce fields in Ultimate Member.
* See the article https://docs.ultimatemember.com/article/1504-how-to-add-custom-woocommerce-fields-to-account
*
* This example adds the tab 'wc_custom' that contains the field 'wc_custom_01'. You can add your own tabs and fields.
* Important! Each account tab has an unique key. Replace 'wc_custom' to your unique key.
*
* You can add this code to the end of the file functions.php in the active theme directory.