Skip to content

Instantly share code, notes, and snippets.

@onwp
onwp / simple.ses.php
Created August 6, 2021 14:49 — forked from xeoncross/simple.ses.php
Simple SendEmail wrapper for Amazon SES API (does not support SendRawEmail)
<?php
class SES
{
public $accessKey = NULL;
public $accessKeyID = NULL;
public $host = 'https://email.us-east-1.amazonaws.com/';
public $userAgent = 'Test SES Class / v1.0';
public $data = array();
@onwp
onwp / inspect.php
Created July 31, 2021 22:39 — forked from X-Raym/inspect.php
WordPress inspect styles and scripts
<?php
function inspect_scripts() {
if (!is_admin()) {
global $wp_scripts, $wp_styles;
echo '<h1>Scripts</h1>';
echo '<ol>';
foreach( $wp_scripts->queue as $handle ) :
echo '<li>' . $handle . '</li>';
endforeach;
echo '</ol>';
<?php
define( 'WP_USE_THEMES', false );
require( 'wp-blog-header.php' );
$usermeta = get_user_meta( 354, '_sfwd-quizzes', true );
$new = array();
foreach ($usermeta as $key => $value) {
if ( $value['time'] < 1476545002 )
array_push($new, $value);
@onwp
onwp / custom results table
Created July 29, 2021 12:14 — forked from peppiekos/custom results table
Custom results table
/*------------------Group leader frontpage table------------------------*/
function group_leader_data() {
ob_start();
$user = wp_get_current_user();
if ( in_array( 'group_leader', (array) $user->roles ) || in_array( 'administrator', (array) $user->roles )) {
$group_leader_id = $user->ID;
$user_group_ids = learndash_get_administrators_group_ids( $group_leader_id, true );
@onwp
onwp / sample-learndash-query.sql
Created July 28, 2021 08:54 — forked from korynorthrop/sample-learndash-query.sql
Inactive LearnDash user SQL query
SELECT u.user_email,
um.meta_key AS "login_type",
from_unixtime(um.meta_value,'%c/%e/%y') AS "login_date",
GROUP_CONCAT(p.post_title) AS "courses"
FROM nPJeAgtL_users u
INNER JOIN nPJeAgtL_usermeta um ON um.user_id = u.id AND um.meta_key = 'learndash-last-login'
LEFT JOIN nPJeAgtL_learndash_user_activity lua ON lua.user_id = u.id AND lua.activity_type = 'course'
LEFT JOIN nPJeAgtL_posts p ON lua.course_id = p.id
WHERE from_unixtime(um.meta_value) < '2019-03-01 00:00:00' AND p.id IN (1947,1938,7694,1932)
GROUP BY u.user_login