Skip to content

Instantly share code, notes, and snippets.

View Lonsdale201's full-sized avatar

Soczó Lonsdale201

View GitHub Profile
@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 / 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: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: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: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: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:7a9642c64e9950fafcce14f6405111ab
Last active November 28, 2023 22:10
JetEngine - Learndash - Dynamic visibility - Current user current course purchased
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Go to the Elementor Course single template
// Select your widget, or container whatever.
// Go to the advanced tab, select the JetEngine Dynamic visibility
// Scroll down under the list, where you find a new Learndash Category.
// Select the Current user purchased this course option
// Setup your logic: Show or hide
// So, this condition, based on the fact that the current user has purchased the course they are on.
@Lonsdale201
Lonsdale201 / gist:3f1fa827344b87e987df104237b43dbf
Created November 28, 2023 21:06
Custom Macro - Learndash - Current user courses with selectable progress
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new Post Query in the Query builder. Select the post type: Course
// Go to the Meta Query section
// click the Add new button
// in the VALUE field choose the Dynamic tag icon, and select LD Current User Courses and status
// Choose what type of progress you want to show
// In the operator field select the "in the list" option
// HELP IMAGE : https://prnt.sc/sIGKdV44yi51
// DONE
@Lonsdale201
Lonsdale201 / gist:0e23048f1ff1597087e1a396bd41a66b
Created November 28, 2023 19:16
JetEngine - Custom Macro - Learndash - Current user all purchased courses
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new Post Query in the Query builder. Select the post type: Course
// Go to the Meta Query section
// click the Add new button
// in the VALUE field choose the Dynamic tag icon, and select LD User Courses Access
// In the operator field select the "in the list" option
// HELP IMAGE : https://prnt.sc/3g_INGSx_yNb
// DONE
@Lonsdale201
Lonsdale201 / gist:c708544e74429ff2d6abb43d3fd8f84e
Created November 28, 2023 13:19
JetEngine - Custom Macro - User Purchased Any Product
// place the code in the child theme functions.php or a custom code snippets plugin.
// This macro will return the users who are purchased any product on your website (and can select the order status)
// how to use
// Create a new User Query in the Query builder.
// Go to the Include/exclude section
// Click the Dynamic tag icon, and select the WC User Purchased Any Product macro. In the select field choose the order status, or use the "All" option
// This macro will return the selected user id