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
Created November 29, 2022 19:43
This code sends a private message when the user presses the ENTER key.
/**
* Send private message on ENTER.
* Add this code to your custom JS file.
*/
jQuery( document.body ).on( 'keypress', 'textarea.um_message_text', function ( event ) {
if ( event.keyCode && event.keyCode === 13 || event.which === 13 ) {
jQuery( event.target ).closest( '.um-message-footer' ).find( '.um-message-send' ).trigger( 'click' );
}
} );
@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_after_email_template_part.php
Created November 6, 2022 20:33
Hook um_after_email_template_part
<?php
/**
* Hook: um_after_email_template_part
*
* Type: action
*
* Description: Fires after email template loading.
* May be used to display custom content below the main email message.
*
@yuriinalivaiko
yuriinalivaiko / um_before_email_template_part.php
Created November 6, 2022 20:29
Hook um_before_email_template_part
<?php
/**
* Hook: um_before_email_template_part
*
* Type: action
*
* Description: Fires before email template loading.
* May be used to display custom content above the main email message.
*
@yuriinalivaiko
yuriinalivaiko / um_email_template_path.php
Created November 6, 2022 20:18
Hook um_email_template_path
<?php
/**
* Hook: um_email_template_path
*
* Type: filter
*
* Description: Change email template location.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-mail.php#L189
@yuriinalivaiko
yuriinalivaiko / um_after_email_notification_sending.php
Created November 6, 2022 20:04
Hook um_after_email_notification_sending
<?php
/**
* Hook: um_after_email_notification_sending
*
* Type: action
*
* Description: Fires after sending an email notification.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-mail.php#L456
@yuriinalivaiko
yuriinalivaiko / um_email_send_message_content.php
Created November 6, 2022 20:00
Hoo: um_email_send_message_content
<?php
/**
* Hook: um_email_send_message_content
*
* Type: filter
*
* Description: Change email notification body.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-mail.php#L381
@yuriinalivaiko
yuriinalivaiko / um_email_send_subject.php
Created November 6, 2022 19:44
Hook um_email_send_subject
<?php
/**
* Hook: um_email_send_subject
*
* Type: filter
*
* Description: Change email notification subject.
* Used in the core to translate email subject.
*
@yuriinalivaiko
yuriinalivaiko / um_before_email_notification_sending.php
Created November 6, 2022 19:35
Hook um_before_email_notification_sending
<?php
/**
* Hook: um_before_email_notification_sending
*
* Type: action
*
* Description: Fires before sending an email notification.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-mail.php#L408