Skip to content

Instantly share code, notes, and snippets.

View pento's full-sized avatar
💖
Hello, friend. 🙂

Gary Pendergast pento

💖
Hello, friend. 🙂
View GitHub Profile
@pento
pento / hunter2.php
Last active December 28, 2015 06:48
Prevent password leaks in WordPress comments
<?php
function hunter2( $comment_text, $comment ) {
if ( get_current_user_id() !== $comment->user_id ) {
$comment_text = str_replace( 'hunter2', '*******', $comment_text );
}
return $comment_text;
}
add_filter( 'get_comment_text', 'hunter2', 1, 2 );
@pento
pento / backup-scheduler.php
Last active December 27, 2015 12:59
Backup scheduler for WordPress Automatic Updates
<?php
function my_backup_scheduler( $event ) {
// 'wp_maybe_auto_update' is the cron hook for the auto update process
if ( 'wp_maybe_auto_update' !== $event['hook'] )
return;
wp_schedule_single_event( $event['timestamp'] - 5 * MINUTE_IN_SECONDS, 'my_backup' );
}
add_filter( 'schedule_event', 'my_backup_scheduler', 10, 1 );
@pento
pento / commercial-client.php
Created July 2, 2013 12:29
Sample Commercial Plugin update server and client
<?php
/*
* Plugin Name: Commercial Client
* Plugin URI: http://pento.net/
* Description: A sample client plugin for showing updates for non-WordPress.org plugins
* Author: pento
* Version: 0.1
* Author URI: http://pento.net/
* License: GPL2+
*/