Skip to content

Instantly share code, notes, and snippets.

View Lonsdale201's full-sized avatar

Soczó Lonsdale201

View GitHub Profile
@Lonsdale201
Lonsdale201 / gist:94447d2a662c3dffbaa9903a1f9c6808
Created December 2, 2023 11:39
JetEngine - WooCommerce Memberships - Dynamic visibility - Memberships Access
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Elementor ONLY
// Select your element in the elementor editor (container, widget etc..whatever), and go to the advanced tab, enable dynamic visibility option.
// Scroll down in the list, until you see the new category: wc_membership
// select the Access memberships
// Choose you logic, hide or show
// in the Memberships select field you can choose the memberships (one or more), this relation always "AND"
// Status always only the Active
// This visibility always check the current logged in user
@Lonsdale201
Lonsdale201 / gist:fc0e520e5ca642cb9ca27f2302e7c30d
Last active December 22, 2023 14:41
JetEngine Dynamic Visibility modul - WooCommerce Points and rewards
// place the code in the child theme functions.php or a custom code snippets plugin.
// Dont forget! This code is for the WooCommerce Points and Rewards plugin, so if it is not installed and activated,
// you will not be able to use this condition!
// https://woo.com/products/woocommerce-points-and-rewards/
// Go to you block, widget container etc, open the Dynamic Visibility modul, and scroll down in the list,
// you will see a new category: Woo Points and Rewards
// this visibility only work for logged-in users. Will Check if the points is more than 0
@Lonsdale201
Lonsdale201 / gist:fc843375b9a811255c7de0ff3a4255b6
Last active December 22, 2023 20:43
JetEngine Dynamic Visibility modul - WooCommerce Points and rewards - Equal or greater
// place the code in the child theme functions.php or a custom code snippets plugin.
// Dont forget! This code is for the WooCommerce Points and Rewards plugin, so if it is not installed and activated,
// you will not be able to use this condition!
// https://woo.com/products/woocommerce-points-and-rewards/
// Go to you block, widget container etc, open the Dynamic Visibility modul, and scroll down in the list,
// you will see a new category: Woo Points and Rewards
// this visibility only work for logged-in users. You can use the value field, to define the points.
// example : select the new Current user Equal or greater condition
// in the value field Enter the point amount. This visibility will check if the current user points equal or greater
@Lonsdale201
Lonsdale201 / gist:bad663ce80cca8a751e54aadeb552763
Created December 23, 2023 15:34
JetEngine - Dynamic Visibility - Jetreviews condition (Current user reviewed)
// place the code in the child theme functions.php or a custom code snippets plugin.
// This conditions required the JetReview plugin to be installed and activated on your site. This Conditions only work with
// LOGGED IN USERS, Not supported GUESTS
// Only check the Review, and not the Comments.
// This conditions check if the current user already submitted a review (and approved) in the current source (eg: cpt current-post)
add_action( 'jet-engine/modules/dynamic-visibility/conditions/register', function( $conditions_manager ) {
@Lonsdale201
Lonsdale201 / gist:a31c9eb8156c9cd87da2c861a83afb3a
Created December 23, 2023 15:36
JetEngine - Dynamic Visibility - Jetreviews condition (Current user review awaiting moderation)
// place the code in the child theme functions.php or a custom code snippets plugin.
// This conditions required the JetReview plugin to be installed and activated on your site. This Conditions only work with
// LOGGED IN USERS, Not supported GUESTS
// Only check the Review, and not the Comments.
// This conditions check if the current user submitted a review and its still awaiting moderation (so only this status) in the current source (eg: cpt current-post)
add_action( 'jet-engine/modules/dynamic-visibility/conditions/register', function( $conditions_manager ) {
class JE_Review_Awaiting_Moderation extends \Jet_Engine\Modules\Dynamic_Visibility\Conditions\Base {
@Lonsdale201
Lonsdale201 / gist:a2818bca6dabcbfc812bbcebe059bf1d
Last active March 20, 2024 15:46
JetEngine - Dynamic Visibility - Woo Subscriptions (current user any active sub)
// place the code in the child theme functions.php or a custom code snippets plugin.
// This conditions required the Woo Subscriptions plugin to be installed and activated on your site. This Conditions only work with
// LOGGED IN USERS
// https://woo.com/products/woocommerce-subscriptions/
// This is the code to see if the current logged in user has any subscriptions that are active.
add_action( 'jet-engine/modules/dynamic-visibility/conditions/register', function( $conditions_manager ) {
class Woo_Subscriptions_Active_Subscription extends \Jet_Engine\Modules\Dynamic_Visibility\Conditions\Base {
@Lonsdale201
Lonsdale201 / jetformbuilder
Last active January 3, 2024 14:03
JetFormBuilder - Checkbox field limit based on user role or guest
// Reference by default https://gist.github.com/Crocoblock/d8bcacb6c851ae670bc0514f2f9173d6
// In the jetformbuilder checkbox field - use the Advanced section - Class field name, and add: check-limit
// place the code in the child theme functions.php or a custom code snippets plugin.
// You can define if the user not logged in how many checkbox can check. This is the : 'guest' => 1,
// HOW TO
// In the $limits = [ add your role name like 'mycustomrole" => 4, where the "mycustomrole" is your role cap name, and the "4" is the limit
// Dont forget to target your checkbox field, in the form gutenberg editor like the image: https://prnt.sc/FjqDLNL_q78m
// CSS Class name: check-limit
@Lonsdale201
Lonsdale201 / jetformbuilder
Last active May 9, 2024 08:26
JetFormBuilder - Select field (multiple) limit based on user role or guest
// Reference by default https://gist.github.com/Crocoblock/25125c7db9b19c60b1043061015556d0
// In the jetformbuilder Select field - use the Advanced section - Class field name, and add: select-limit
// Dont forget to enable the multiple option
// place the code in the child theme functions.php or a custom code snippets plugin.
// You can define if the user not logged in how many select item can check. This is the : 'guest' => 1,
// HOW TO
// In the $limits = [ add your role name like 'mycustomrole" => 4, where the "mycustomrole" is your role cap name, and the "4" is the limit
// Dont forget to target your select field, in the form gutenberg editor like the image: https://prnt.sc/Q4fqdpj3vgTH
@Lonsdale201
Lonsdale201 / gist:35b668c05fa4cb0a340481eb1ab7bcee
Last active January 18, 2024 21:16
JetEngine - Dynamic Visibility - Fluent CRM Lists
// place the code in the child theme functions.php or a custom code snippets plugin like Fluent Snippts etc..
// This conditions required the FluentCRM plugin to be installed and activated on your site. This Conditions only work with
// LOGGED IN USERS + user need to Contant in your CRM
// https://fluentcrm.com/
// https://wordpress.org/plugins/fluent-crm/
// Only Elementor
// HOW TO
// Go to your , widget container etc, open the Dynamic Visibility modul, and scroll down and select the Fluent CRM Lists option
// In the next select field, choose one or more Lists (Internal operator OR)
// don't see any listings? That's because you haven't created them yet.
@Lonsdale201
Lonsdale201 / gist:24ede06b773d1e9a53c25c5354bf9442
Created February 13, 2024 21:34
Learndash - programatically course enroll with wp registration
// copy this code in the child theme functions.php or a specific code plugin like FluentSnippets
add_action( 'user_register', 'auto_enroll_user_to_course', 10, 1 );
function auto_enroll_user_to_course( $user_id ) {
if ( ! is_wp_error( $user_id ) ) {
$course_ids = array( 131 ); // Course ID, or ID's user separate comme if you want to add multiple id.
if ( !is_array( $course_ids ) ) {
$course_ids = array( $course_ids );
}