Skip to content

Instantly share code, notes, and snippets.

@patrickatwsrn
patrickatwsrn / export-users-with-meta.sql
Created August 25, 2026 17:53 — forked from nicomollet/export-users-with-meta.sql
Export WordPress users with meta
SELECT
t1.ID, t1.user_email,
MAX(CASE WHEN t2.meta_key = 'first_name' THEN meta_value END) AS first_name,
MAX(CASE WHEN t2.meta_key = 'last_name' THEN meta_value END) AS last_name,
MAX(CASE WHEN t2.meta_key = 'paying_customer' THEN meta_value END) AS paying_customer,
MAX(CASE WHEN t2.meta_key = 'billing_title' THEN meta_value END) AS billing_title
FROM th_users AS t1
INNER JOIN th_usermeta AS t2 ON t1.ID = t2.user_id
GROUP BY t1.ID, t1.user_email
@patrickatwsrn
patrickatwsrn / .htaccess
Created July 17, 2026 09:37 — forked from heiswayi/.htaccess
Common .htaccess Redirects
# 301 Redirects for .htaccess
# ===========================
# Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
# Redirect an entire site:
Redirect 301 / http://www.domain.com/
# Redirect an entire site to a subfolder
@patrickatwsrn
patrickatwsrn / 01.thumbx3.readme.md
Last active March 31, 2026 11:02
Thumb3x – Dokumentation - German

Intro

thumbx3 ist eine Leistungsstarke Thumbnaillösung für MODX3.

In einem Test wurde komplexe Aufgaben wie ein Blur Filter etwa in der hälte der Zeit umgesetzt. Ob das immer so ist muß ich irgendwann mal testen.

Voraussetzungen

In der Doku habe ich keine Infos dazu gefunden. Bei mir hat es bislang keine Probleme gegeben (Hetzner + Ubuntu 24.04 + PLESK)

@patrickatwsrn
patrickatwsrn / parentRedirect.snippet.php
Last active April 29, 2025 06:00
MODX: Redirect to parent resource
<?php
/*
Purpose: Redirect a child resource that is only used to structure content of its parent.
Usage: Add this snippet to your child template
[[!parentRedirect?
&parent=`[[*parent]]`
&alias=`[[*alias]]`
<?php
/*
snippet: spamFilter
purpose: Check message of email for chinese/russian characters and badwords
usage: add snippet to validate rules and customValidator property
&validate=`message:email:spamFilter:required`
&customValidators=`spamFilter`
*/
@patrickatwsrn
patrickatwsrn / xpdo-where
Created October 11, 2023 20:49 — forked from davidpede/xpdo-where
pdoResources where examples
&where=`{ "template:IN" : [ 1,2,3 ] }
&where=`{ "template:NOT IN" : [ 1,2,3 ] }
&where=`[{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}]`
@patrickatwsrn
patrickatwsrn / current-user-role.php
Created July 18, 2023 10:05
wordpress - check user role of current user
<?php
/*
https://developer.wordpress.org/reference/functions/current_user_can/#comment-4083
Contributed by Ahir Hemant(Woo-Expert)
*/
$user = wp_get_current_user();
$allowed_roles = array( 'editor', 'administrator', 'author' );
if ( array_intersect( $allowed_roles, $user->roles ) ) {
@patrickatwsrn
patrickatwsrn / acf-fieldgroup_allergene.json
Last active April 4, 2023 10:57
ACF Allergene und Zusatzstoffe für WooCommerce.
[
{
"key": "group_61e968f1031de",
"title": "Allergene",
"fields": [
{
"show_column_filter": false,
"allow_bulkedit": false,
"allow_quickedit": false,
"show_column": false,
@patrickatwsrn
patrickatwsrn / acf-opening-hours.json
Last active April 4, 2023 10:52
Wordpress ACF Opening hours
/* exported from acf pro */
[
{
"key": "group_642af70225c29",
"title": "Öffnungszeiten",
"fields": [
{
"show_column_filter": false,
"allow_bulkedit": 0,
"allow_quickedit": 0,
<?php
echo dirname(__FILE__)."<br>";
$locales = ["af_NA", "af_ZA", "af", "ak_GH", "ak", "sq_AL", "sq", "am_ET", "am", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SD", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "ar", "hy_AM", "hy", "as_IN", "as", "asa_TZ", "asa", "az_Cyrl", "az_Cyrl_AZ", "az_Latn", "az_Latn_AZ", "az", "bm_ML", "bm", "eu_ES", "eu", "be_BY", "be", "bem_ZM", "bem", "bez_TZ", "bez", "bn_BD", "bn_IN", "bn", "bs_BA", "bs", "bg_BG", "bg", "my_MM", "my", "ca_ES", "ca", "tzm_Latn", "tzm_Latn_MA", "tzm", "chr_US", "chr", "cgg_UG", "cgg", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zh", "kw_GB", "kw", "hr_HR", "hr", "cs_CZ", "cs", "da_DK", "da", "nl_BE", "nl_NL", "nl", "ebu_KE", "ebu", "en_AS", "en_AU", "en_BE", "en_BZ", "en_BW", "en_CA", "en_GU", "en_HK", "en_IN", "en_IE", "en_JM", "en_MT", "en_MH", "en_MU", "en_NA", "en_NZ", "en_MP", "en_PK", "en_PH", "en_SG", "en_Z