Skip to content

Instantly share code, notes, and snippets.

@Qubadi
Qubadi / gist:c413c2dfec5f5227100392bc99756ce5
Last active January 6, 2025 11:41
User approval system for Wordpress
Description:
This code implements a secure user approval system for WordPress, allowing administrators to manage user access based on approval status.
New users are marked as “pending approval” by default, preventing any login until they are approved.
When a user is approved by an administrator, they automatically receive an email containing their login URL and further instructions.
Administrators can approve or unapprove users directly from the admin panel, with real-time session termination for unapproved accounts.
The system is compatible with all login methods, employs nonce-based security for critical actions, and excludes administrators
from approval workflows.
These two lines need to be updated with your own URLs:
@Qubadi
Qubadi / gist:7b559c26a4442373b942664dc4c38ff3
Last active February 25, 2025 18:20
Dynamic posts per page adjustment for JetEngine Query Builder's Posts Query based on device type
As we know, JetEngine Query Builder's Posts Query Posts Per Page doesn’t have an option to set different posts per page
based on the device, like tablet and phone. Now we have developed a custom code to achieve it, allowing dynamic
adjustments based on the user’s device type.
The code only works for Posts Query and must be implemented correctly within
JetEngine Query Builder, it works whether the Cache Query toggle is on or off.
How to do it:
1. Go to Query Builder, create a new query, and select Query Type: Posts Query.
@Qubadi
Qubadi / gist:3c12e21d4572ca9fae05670169e8a455
Last active August 11, 2025 17:00
JetFormBuilder form validation with disabled submit button
UPDATED: 11.08.2025
It checks to see if a JetFormBuilder form has all required fields filled.
If any of them are missing, the submit button is disabled, and this prevents their submission.
The button activates again when all fields are complete.
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
________________________________________
@Qubadi
Qubadi / gist:2ec33798ddeed715b3060c47ba498ee2
Last active December 16, 2024 15:50
JetEngine Listing grid title
We have developed a custom code that adds a new feature to the default JetEngine Listing Grid widget in Elementor.
This enhancement allows users to easily add a title or label directly from Elementor's controls. With full styling options,
including alignment, typography, colors, and spacing, the label integrates seamlessly with the existing widget for a dynamic
and customizable experience.
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
________________________________________
@Qubadi
Qubadi / gist:b918070aaf15f1e48b0b2ad9baeeb117
Last active September 25, 2025 06:55
JetFormBuilder that allows users to crop images with some great new functionality
UPDATED: 29.09.2024
Copy the following HTML code and create a HTML snippet using your snippet plugins.
Paste the code into the plugin and save it.
I’ve developed a new custom feature for JetFormBuilder that allows users to crop images with some great new functionality.
Here’s a quick rundown of what it does:
JetFormBuilder integration: This custom code integrates seamlessly with JetFormBuilder’s file upload system, making the image
inputs interactive and ready for cropping, all through a custom action hook.
@Qubadi
Qubadi / gist:5793d9bd3fbc996fb35cee7e50031f33
Last active May 22, 2025 14:04
Jetformbuilder customize the Choose File and drag-and-drop of images
UPDATED: 04.11.2024
Copy the following HTML code and create a HTML snippet using your snippet plugins.
Paste the code into the plugin and save it.
Don't forget to add MIME types (image formats), for example, PNG and JPEG, in the media field where it shows 'Allow MIME types.
______________________________________________________
<style>
/* Custom styles for the file upload field */
.jet-form-builder__field-wrap.jet-form-builder-file-upload {
@Qubadi
Qubadi / gist:e2ce7959b1400379d596a59c259ec8c0
Last active March 16, 2025 12:45
Randomized thank you page redirect with unique slug
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Changes page ids: function add_specific_rewrite_rule_for_thank_you_page() {
// Get the post ID for your thank-you page
$thank_you_page_id = YOUR PAGE ID;
and: function handle_thank_you_page_redirection() {
// Define the post ID for your thank-you page
$thank_you_page_id = YOUR PAGE ID;
@Qubadi
Qubadi / gist:b9a61f5c43a9f4a3f787d97e53107c60
Created August 30, 2024 23:10
Jetformbuilder: Contact form, Jetbooking and Jetappointment, hide labels or titles when fields are empty
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Hide labels or titles when fields are empty ( Send email action - content )
Add this shortcode name to Send email post action ( content )
[display_if_not_empty field="%your field name%" label="Your label name:"]
Repeat this process until all the fields
and the respective labels have been entered in each shortcode name. You may include as many as you want.
________________________________________
@Qubadi
Qubadi / gist:291ae99b98b11a563df881b906e401e7
Created August 24, 2024 18:32
Visitor tracker in WordPress with real-time only visible for admins
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Visitor tracker in WordPress with real-time updates and a smooth pop-up for admins.
___________________________________-
// Hook to add the visitor tracking and popup for admins
add_action('wp_footer', 'admin_visitor_tracker');
@Qubadi
Qubadi / gist:ecc4e8db265ef2f2e642120bac2a8ef2
Last active September 5, 2024 12:01
JetEngine profilebuilder, profile view counter
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Add the [user_profile_view_count] shortcode to your profile single page
Custom JetEngine code that shows the view count of every profile in ProfileBuilder.
______________________________________