Skip to content

Instantly share code, notes, and snippets.

@max-kk
max-kk / gist:bbea2d9bff3bc3fa5e54b24253d7eed8
Last active November 27, 2019 09:53
LRM :: reorder registration fields
/* PUT YOUR JS HERE */
jQuery( document ).ready(function($) {
var phone_html = $(".fieldset--phone").get(0).outerHTML;
$(".lrm-signup-section .fieldset--phone").remove()
$(".lrm-signup-section .fieldset--email").before(phone_html);
@max-kk
max-kk / gist:3e5605d6403c4564ec55e18ea3af1aeb
Created August 30, 2019 14:28
FV :: redirect on click to the leaders image
if ( ! jQuery("body").hasClass("home") ) {
jQuery(".fv-leaders img").on("click", function(e) {
e.preventDefault();
window.location.href = "YOUR URL";
});
}
@max-kk
max-kk / extra_fields_with_icons.html
Last active November 15, 2020 15:26
LRM :: Custom Phone Field for registration form
<div class="fieldset fieldset--phone">
<label class="image-replace lrm-email lrm-ficon-phone" title="phone*"></label>
<input name="phone" class="full-width has-padding has-border" type="text" placeholder="lrm-ficon-phone*" required="">
<span class="lrm-error-message"></span>
</div>
<div class="fieldset fieldset--location">
<label class="image-replace lrm-email lrm-ficon-location" title=""></label>
<input name="location" class="full-width has-padding has-border" type="text" placeholder=".lrm-ficon-location" required="">
<span class="lrm-error-message"></span>
@max-kk
max-kk / lrm_filter_redirect.php
Last active November 19, 2020 08:57
LRM :: filter redirect URL
<?php
// COPY AFTER to your theme functions.php
add_filter('lrm/redirect_url', function($redirect_to, $action) {
if ( 'login' !== $action ) {
return $redirect_to;
}
// Do Something with a $redirect_to, like
$url = parse_url( $_SERVER["HTTP_REFERER"] );
// IF the user is registered but not logged in (have to enter pass or verify account)
jQuery(document).on('lrm/ajax_response', function(event, response, $form, action) {
if ( "registration" === action && "register_new_user" === response.data.from && response.data.message.indexOf("Your account is still pending approval") > 0 ) {
location.href = "URL";
}
});
add_filter( 'lrm/um/default_register_form_ID', function($default_register_form_ID) {
if (is_singular('teacher') ) {
return 5; 'YOUR CUSTOM FORM ID'
}
return $default_register_form_ID;
});
<?php
// Copy after
add_shortcode('fv_prize_pool', function($atts){
global $contest_id;
if ( empty($contest_id) ) {
if ( !empty($atts['contest_id'])) {
$contest_id = absint($atts['contest_id']);
} else {
@max-kk
max-kk / fv_default_contest_sorting.php
Created May 16, 2019 08:23
FV :: default_contest_sorting
add_filter('fv/admin/create_contest/default_options', function($atts) {
$atts['sorting'] = 'pseudo-random';
return $atts;
});
@max-kk
max-kk / lrm_redirect_on_close_modal_auto_trigger.js
Created April 25, 2019 13:23
LRM :: redirect_on_close_modal_auto_trigger
jQuery(document).on("lrm/close_modal", function(el, event, event_type){
if ( LRM_Pro.has_auto_trigger ) {
window.location.href = "/";
}
});
@max-kk
max-kk / redirect_all_no_logged_in_users.php
Last active April 23, 2019 11:45
LRM :: redirect_all_no_logged_in_users
<?php
// Copy After
// Add this to your child theme functions.php
add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
if ( ! is_page('login') && ! is_user_logged_in() ) {