Skip to content

Instantly share code, notes, and snippets.

@Wp1stop
Wp1stop / gist:8798d3ee3c7ebbcaf41c923a2d73f478
Created October 29, 2025 14:26
Basic Singleton Plugin structure
<?php
/**
* Main Singleton class for My Awesome Plugin.
*
* @package My_Awesome_Plugin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
<?php
/**
* Plugin Name: AI Accessibility Analyzer
* Plugin URI: https://yoursite.com/ai-accessibility-analyzer
* Description: Analyzes web accessibility issues using AI, displays errors in a floating popup with stacked messages, and includes PDF export option.
* Version: 1.2.8
* Author: Your Name
* License: GPL v2 or later
* Text Domain: ai-accessibility-analyzer
*/
function import_users_from_emails() {
global $wpdb;
// List of emails from your updated list
$emails = [
'p&p@familie-schmitt-online.de',
'diagus@t-online.de',
'melanie@familie-gebert.de',
'marcokollmann@t-online.de',
'dagmar.richter26@web.de',
function generate_pmpro_memberships_inserts_shortcode($atts) {
global $wpdb;
// Initialize output
$output = '';
$values = [];
$missing_emails = [];
// Query wp_xhvvxzqhmz_pmpro_memberships_users
$results = $wpdb->get_results("
function update_pmpro_subscriptions_shortcode($atts) {
global $wpdb;
// Initialize arrays
$mappings = [];
$unmatched = [];
// Step 1: Build mappings array
$subscriptions = $wpdb->get_results("
SELECT id, user_id
function update_pmpro_membership_orders_shortcode($atts) {
global $wpdb;
// Initialize arrays
$mappings = [];
$unmatched = [];
// Step 1: Build mappings array from wp_xhvvxzqhmz_pmpro_membership_orders
$orders = $wpdb->get_results("
SELECT id, user_id
@Wp1stop
Wp1stop / gist:08dcfaa383663c4a7099278aaac22324
Created March 6, 2025 03:17
Add user to member level pmpro
function display_user_membership_levels_shortcode($atts) {
global $wpdb;
// Shortcode attributes with default user_id as current user
$atts = shortcode_atts(array(
'user_id' => get_current_user_id(), // Defaults to logged-in user
), $atts, 'user_membership_levels');
$user_id = intval($atts['user_id']);
@Wp1stop
Wp1stop / gist:6cd97e62d32e851cc81ad79cf6dbcea9
Created March 6, 2025 03:17
Check and assign user level pmpro
function check_active_membership_levels_shortcode($atts) {
global $wpdb;
// Step 1: Get active user_ids from wp_pmpro_subscriptions where status = 'active'
$active_users = $wpdb->get_col("
SELECT DISTINCT user_id
FROM {$wpdb->prefix}pmpro_subscriptions
WHERE status = 'active'
");
@Wp1stop
Wp1stop / gist:142d797b27fd274aaa241381971ad811
Created March 6, 2025 03:16
Remove membership by email
function remove_membership_by_emails_shortcode($atts) {
global $wpdb;
// List of 661 emails to process
$emails_to_remove = array(
'a.baechle@icloud.com', 'a.hliscs@web.de', 'a.johns@outlook.de', 'a.lombardo@online.de', 'a.luetschen@me.com',
'a.waschke@web.de', 'aaronluithle@posteo.de', 'abarloi@drbarloi.de', 'abie.vanwyk@gmail.com', 'achim.engel@gmx.de',
'adafreese@gmx.net', 'adiehl@gmx.net', 'aileenaltmann@web.de', 'ajakobljevich@web.de', 'ak.sports@gmx.de',
'akutschki@icloud.com', 'alexander.jobst@gmx.com', 'alexander.leckbandt@gmx.de', 'alexander.sorge@gmail.com',
'alexanderdaum84@gmx.net', 'alexanderjerlitschka@gmail.com', 'alexandra.hebbe@gmail.com', 'alexniclas.peters@yahoo.de',
<script>
jQuery(document).ready(function() {
// Disable options that contain "limit" in the text (both methods for Safari compatibility)
jQuery('#input_13_34 option').each(function() {
if (jQuery(this).text().toLowerCase().includes("limit")) {
jQuery(this)
.attr("disabled", "true") // Standard way
.attr("disabled", "disabled") // Alternative way
.prop("disabled", true); // Safari compatibility