Skip to content

Instantly share code, notes, and snippets.

View yuriinalivaiko's full-sized avatar

Yurii Nalivaiko yuriinalivaiko

View GitHub Profile
@yuriinalivaiko
yuriinalivaiko / um_custom_tags_patterns_group_comment.php
Created November 30, 2022 20:20
These code snippets add custom placeholders {post_content} and {comment_content} for the email notifications in the "Ultimate Member - Groups" extension.
<?php
/**
* Add custom placeholder {comment_content} for the "Groups - New comment" email template.
*/
add_action( 'um_groups_after_wall_comment_published', 'um_custom_tags_patterns_group_comment_on', 8, 4 );
add_action( 'um_groups_after_wall_comment_published', 'um_custom_tags_patterns_group_comment_off', 12, 4 );
function um_custom_tags_patterns_group_comment_on( $commentid, $comment_parent, $post_id, $user_id ){
$GLOBALS['um_groups_after_wall_comment_published_id'] = $commentid;
add_filter( 'um_template_tags_patterns_hook', 'um_custom_tags_patterns_group_comment', 10, 1 );
@yuriinalivaiko
yuriinalivaiko / um_message_send_on_enter.js
Last active May 12, 2025 12:16
This code disables sending a private message when the user presses the ENTER key.
// Don't send private messages on the "Enter" keypress.
jQuery(document).ready(function() {
jQuery( document.body ).off( 'keypress', 'textarea.um_message_text' );
});
@yuriinalivaiko
yuriinalivaiko / um_profile_menu.php
Created November 24, 2022 21:33
This code changes the profile menu layout to a "hamburger menu" view on mobile devices.
<?php
/**
* Display profile menu as a hamburger menu on mobile.
* Add this code to the file functions.php in the active theme directory.
*/
add_action( 'um_profile_menu', function(){
?>
<div class="um-profile-menu">
<button class="um-profile-nav-toggle um-profile-nav-item um-tip-n uimob800-show uimob500-show uimob340-show" onclick="jQuery(this).toggleClass('open');" title="Profile Menu"><i class="um-faicon-bars"></i></button>
@yuriinalivaiko
yuriinalivaiko / um_login_redirect_url.php
Created November 6, 2022 16:59
Hook um_login_redirect_url
<?php
/**
* Hook: um_login_redirect_url
*
* Type: filter
*
* Description: Change redirect URL after successful login.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L258
@yuriinalivaiko
yuriinalivaiko / um_after_everything_output.php
Created November 6, 2022 16:34
Hook um_after_everything_output
<?php
/**
* Hook: um_after_everything_output
*
* Type: action
*
* Description: Fires after the form shortcode is loaded.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-shortcodes.php#L819
@yuriinalivaiko
yuriinalivaiko / um_after_form.php
Created November 6, 2022 16:22
Hook um_after_form
<?php
/**
* Hook: um_after_form
*
* Type: action
*
* Description: Fires before the closing tag in the form.
* May be used to display custom content in the form footer.
*
@yuriinalivaiko
yuriinalivaiko / um_after_mode_fields.php
Created November 6, 2022 16:10
Hook um_after_{$mode}_fields
<?php
/**
* Hook: um_after_{$mode}_fields
*
* Type: action
*
* Description: Fires after the form fields.
* May be used to display custom content after form fields or add hidden fields.
*
@yuriinalivaiko
yuriinalivaiko / um_before_mode_fields.php
Created November 6, 2022 15:49
Hook um_before_{$mode}_fields
<?php
/**
* Hook: um_before_{$mode}_fields
*
* Type: action
*
* Description: Fires before the form fields.
* May be used to display custom content before form fields or add hidden fields.
*
@yuriinalivaiko
yuriinalivaiko / um_before_form.php
Created November 5, 2022 19:38
Hook um_before_form
<?php
/**
* Hook: um_before_form
*
* Type: action
*
* Description: Fires after opening tag in the form.
* May be used to display custom content in the form header.
*
@yuriinalivaiko
yuriinalivaiko / um_registration_for_loggedin_users.php
Created November 5, 2022 19:18
Hook um_registration_for_loggedin_users
<?php
/**
* Hook: um_registration_for_loggedin_users
*
* Type: filter
*
* Description: Allows to display the registration form for logged in users if TRUE. Default value is FALSE.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-shortcodes.php#L686