Skip to content

Instantly share code, notes, and snippets.

@max-kk
max-kk / MC4WP.html
Last active August 31, 2020 14:40
LMR :: Mailchimp for WordPress
<!-- Mailchimp for WordPress - https://www.mc4wp.com/ -->
<input type="hidden" name="_mc4wp_subscribe_wp-registration-form" value="0">
<p class=" mc4wp-checkbox mc4wp-checkbox-wp-registration-form">
<label>
<input type="checkbox" name="_mc4wp_subscribe_wp-registration-form" value="1">
<span>Yes, add me to your mailing list</span>
</label>
</p>
<!-- / Mailchimp for WordPress -->
<style>
@max-kk
max-kk / extra_mail_args.php
Last active May 27, 2023 07:11
LRM :: extra_mail_args
<?php
// User Emails
add_filter("lrm/mails/registration/body", function($mail_body, $user_login, $userdata, $user) {
// Let's replace the {{USER_PHONE}} tag with user meta value
$mail_body = str_replace( '{{USER_PHONE}}', get_user_meta($user->ID, 'phone', true), $mail_body );
return $mail_body;
}, 10, 4);
@max-kk
max-kk / menu.js
Created August 18, 2020 13:20
LRM Mobile menu issue
jQuery(document).on("lrm/before_display/login", function() {
jQuery("#mobileMenu").attr("tabindex", false);
});
jQuery(document).on("lrm/before_display/registration", function() {
jQuery("#mobileMenu").attr("tabindex", false);
});
jQuery(document).on("lrm/close_modal", function() {
jQuery("#mobileMenu").attr("tabindex", "-1");
@max-kk
max-kk / pilotpress.php
Created August 1, 2020 13:53
LRM :: pilotpress redirect fix
<?php
add_action('pilotpress_post_user_login', function () {
$user_signon = wp_get_current_user();
if ( !$user_signon ) {
return;
}
do_action('lrm/login_successful', $user_signon);
$message = lrm_setting('general/registration/reload_after_login', true) ?
<?PHP
// COPY AFTER THIS LINE !!!!
add_action('wccp/public/confirmation_page/before_confirm_button', function() {
echo '<div class="Wccp_Page_Sidebar">';
});
add_action('wccp/public/confirmation_page/after_confirm_button', function() {
echo "SOME DETAILS";
echo '</div>';
@max-kk
max-kk / lrm_add_user_avatar_to_menu.php
Last active October 9, 2020 21:53
LRM :: add useravatar and username to the menu
<?php
// COPY AFTER THIS LINE !!!
add_filter( 'wp_nav_menu_items', 'lrm_your_custom_menu_item', 10, 2 );
function lrm_your_custom_menu_item ( $items, $args ) {
// Please, don’t forget to replace the theme_location !
// if the id of my menu was main-menu, I would write if( $args->theme_location == 'main-menu' ) {
if( $args->theme_location == 'main-menu' ){
@max-kk
max-kk / lrm-save-custom-fields-wc-example.php
Last active August 26, 2020 15:39
LRM :: save custom fields
<?php
// How to add html: https://monosnap.com/file/2MVkjClgYE3W3U9cgPEjy4VXXCzXf2
// COPY AFTER
$lrm_fields = [ 'billing_city'=>'City', 'billing_state'=>'State', 'billing_postcode' => 'Postcode', 'ETC'=>'ETC' ];
add_filter( 'registration_errors',function ( $errors, $sanitized_user_login, $user_email ) use($lrm_fields) {
foreach( $lrm_fields as $lrm_field=>$lrm_field_label ) {
if ( empty( $_POST[$lrm_field ] ) ) {
@max-kk
max-kk / lrm-mfp.js
Created December 10, 2019 09:06
LRM modal tabindex mfp
jQuery(document).on("lrm/before_display/login", function() {
jQuery(".mfp-wrap").attr("tabindex", false);
});
jQuery(document).on("lrm/before_display/registration", function() {
jQuery(".mfp-wrap").attr("tabindex", false);
});
@max-kk
max-kk / hide_some_votes.php
Last active December 2, 2019 08:10
FV hide 20+ some votes
<?php
// Copy after
add_filter("fv/competitor/get_votes", function($result, $competitor, $contest_voting_type, $contest) {
if ( $competitor->votes_count > 20 && ! current_user_can("manage_options") ) {
return "20+";
}
return $result;
}, 10, 4);
@max-kk
max-kk / lrm-add-desc-js.js
Created October 24, 2019 07:46
LRM Add felds desc
jQuery( document ).ready(function() {
var $form = jQuery( ".lrm-form[data-action='login']" );
$form.find("[name='username']").after('<span class="lrm-desc">TEXT</span>');
$form.find("[name='password']").after('<span class="lrm-desc">TEXT</span>');
});