Skip to content

Instantly share code, notes, and snippets.

View Lonsdale201's full-sized avatar

Soczó Lonsdale201

View GitHub Profile
@Lonsdale201
Lonsdale201 / code
Created March 18, 2025 21:24
JetEngine Custom macro- Current user role
// place the code in the child theme functions.php or a custom code snippets plugin like FluentSnippets
// Query builder example image: https://prnt.sc/68m85yjVSLYE
// Always return the current user role slug
add_action( 'jet-engine/register-macros', function() {
class Current_User_Role_Macro extends \Jet_Engine_Base_Macros {
public function macros_tag() {
return 'current_user_role';
@Lonsdale201
Lonsdale201 / code
Created February 22, 2025 16:39
FluentCRM List + programmed download link for woocommerce (Download myaccount section)
// place the code in the child theme functions.php or a custom code snippets plugin like Fluent Snippts etc..
// This code programmed for the user in the woocomemrce downloads page will add 1 (or more if you want) file
// that ppls can download, this differs in that he does not have to buy the product, in return the link does not
// point to the link in the woocommerce folder.
// if ($list->id == 5) { -> changen the ID with your own list id (fluentcrm)
add_filter( 'woocommerce_customer_get_downloadable_products', function( $downloads ) {
if ( ! is_user_logged_in() || ! function_exists( 'FluentCrmApi' ) ) {
@Lonsdale201
Lonsdale201 / code
Last active March 20, 2025 02:30
JetFormBuilder - Formless Action success reload jetengine lisitng grid with ajax
(function($) {
'use strict';
/**
* Developer note:
* This code use the native "fetch" function to intercept AJAX calls
* for the 'remoovehouuse' endpoint. When it detects a successful (HTTP 200)
* response with `{"code":"success"}`, it automatically reloads all Listing Grids
* that have the class ".formless-ajax.elementor-widget-jet-listing-grid".
* Change the .formless-ajax if you want to use different class target
@Lonsdale201
Lonsdale201 / code
Created December 14, 2024 15:39
JetEngine - FluentCRM - SQL Query - All list, All tags
// This SQl Query will retrive all your fluent crm list | secound code will retive all your fluent crm tags
// Create a new JetEngine Query, with the Query builder. Set the Query type to SQL/AI Query
// Turn on the Advanced/AI mode switcher
// in the SQL Query Area, paste the code
// In the Cast result to instance of object -- Keep stdClass
SELECT *
FROM {prefix}fc_lists
@Lonsdale201
Lonsdale201 / code
Created December 7, 2024 00:33
JetFormBuilder - Call webhook - Call Chatgpt
// place the code in the child theme functions.php or a custom code snippets plugin like Fluent Snippts etc..
// You need to add two key in your wp-config.php
// first open your wp-config.php and define( 'OPENAI_API_KEY', 'My_Chatgpt_API');
// add a new line with your auth token: define( 'CUSTOM_API_TOKEN', 'My_auth_token');
// example token define( 'CUSTOM_API_TOKEN', 'a3f9c74d2b69a7e1bcd15e2e4fc98a6c4ed12e9985bcae439f6ad5db95f17c23');
// in the Custom api token you can enter anything
// open your functions.php or fluentsnippets and paste the code which you can find below
// open your jetformbuilder add a new webhook submission and paste your wesbite domain name like
// https://mywebsite.com/wp-json/custom-webhooks/v1/chatgpt-handler?api_token=CUSTOM_API_TOKEN
@Lonsdale201
Lonsdale201 / code
Last active December 6, 2024 15:00
JetEngine - Dynamic Visibility - Get user registration date condition
// place the code in the child theme functions.php or a custom code snippets plugin like Fluent Snippts etc..
// This conditions only work with logged in useres
// How to work & what is it
// With this condition, you can configure whether an element becomes visible to a user after a
// specified amount of time (hours or days) has passed since the current user's registration, or conversely, to hide it.
// Choose whether you want to specify the time in days or hours, then provide the value in the input field.
// Finally, set whether the element should be shown or hidden based on the condition relative to the current user's registration date.
// The condition is named User Registered Date and can be found under the User category.
@Lonsdale201
Lonsdale201 / code
Created November 11, 2024 10:30
JetEngine - FluentBoards - Tasks - SQL Query
// This SQl Query For the user who is logged in, it will retrieve all tasks to which it is assigned.
// Create a new JetEngine Query, with the Query builder. Set the Query type to SQL/AI Query
// Turn on the Advanced/AI mode switcher
// in the SQL Query Area, paste the code
// In the Cast result to instance of object -- Keep stdClass
// You can use the results like jetformbuilder etc..
SELECT tasks.*
FROM {prefix}fbs_tasks AS tasks
JOIN {prefix}fbs_relations AS relations ON tasks.id = relations.object_id
@Lonsdale201
Lonsdale201 / code
Created November 10, 2024 11:47
JetEngine - FluentBoards - SQL Query
// This SQl Query For the user who is logged in, it will retrieve all the Boards to which it is assigned.
// Create a new JetEngine Query, with the Query builder. Set the Query type to SQL/AI Query
// Turn on the Advanced/AI mode switcher
// in the SQL Query Area, paste the code
// In the Cast result to instance of object -- Keep stdClass
// You can use the results like jetformbuilder etc..
SELECT fbs_boards.*
FROM {prefix}fbs_boards AS fbs_boards
JOIN {prefix}fbs_relations AS relations ON fbs_boards.id = relations.object_id
@Lonsdale201
Lonsdale201 / code
Created November 7, 2024 10:13
JetEngine - ACF Date Picker custom callback
// place the code in the child theme functions.php or a custom code snippets plugin, like FluentSnippets
// This code work very well with the ACF Date Picker field type. Will return the corrected date format
// You will see the new ACF Date option in the Filter Callback list
// You need to overwrite the date output format in the code
// https://www.advancedcustomfields.com
add_filter( 'jet-engine/listings/allowed-callbacks', 'add_acf_date_callback' );
add_filter( 'jet-engine/listing/dynamic-field/callback-args', 'add_acf_date_callback_args', 10, 3 );
@Lonsdale201
Lonsdale201 / code
Created November 5, 2024 13:48
Basic Membership for WordPress
// place the code in the child theme functions.php or a custom code snippets plugin, like FluentSnippets
// Only define the $GLOBALS with your details only
// Default global settings
$GLOBALS['membership_protected_pages'] = [25, 2, 3]; // page IDs, specify the pages that can be accessed by just logging in
$GLOBALS['membership_redirect_url'] = '/login'; // Redirect URL if logged out user try to open a protected page
$GLOBALS['membership_hide_elements'] = ['.elementor-location-header', '.xyz', '#asd']; // Classes and IDs use comma separate, this will hide (display none), from those who have not logged in
$GLOBALS['membership_hide_blog'] = true; // Hide the entire blog, blog post, and archives from not logged in users set to false to disable this function