Skip to content

Instantly share code, notes, and snippets.

Barry Hughes barryhughes

Block or report user

Report or block barryhughes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nextcloud.sample-nginx-remediation.CVE-2019-11043.patch
location / {
- rewrite ^ /index.php$request_uri;
+ rewrite ^ /index.php;
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
+ try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPTFILENAME $document_root$fastcgi_script_name;
barryhughes / plain-textify-html-links.php
Created Oct 10, 2019
Inelegant but handy and regex-free way of swapping out HTML links with a plain text equivalent.
View plain-textify-html-links.php
barryhughes / users-by-total-subscriptions.sql
Created Sep 18, 2019
Build a list of user IDs, ordered by the number of known (WooCommerce) subscriptions each user is associated with.
View users-by-total-subscriptions.sql
SELECT meta_value AS user_id,
COUNT(*) AS subscription_count
FROM wp_posts
JOIN wp_postmeta ON ID = post_id
WHERE post_type = 'shop_subscription'
AND meta_key = '_customer_user'
GROUP BY meta_value
ORDER BY subscription_count DESC
View ecp-all-view.hide-past-recurring-events.php
* Hide 'expired' events from the /all/ recurring events view.
* This snippet is best added to a custom (mu-)plugin, for instance:
* wp-content/mu-plugins/ecp-customizations.php
* It is only intended as a temporary shim until a future version
* of The Events Calendar or Events Calendar PRO resolves things;
View 50-fake-users-as-csv.php
* Simple script to generate a bunch of randomish names, email addresses
* etc. Outputs CSV which can be piped into a file, etc.
* Adapt and modify as needed...remember there are more powerful tools out
* there for this sort of thing if you have more complicated needs:
* @see
* @see
View bbpress-add-date-created-on.php
add_action( 'bbp_theme_after_topic_started_by', function() {
$topic = bbp_get_topic( bbp_get_topic_id() );
if ( ! $topic || ! is_a( $topic, 'WP_Post' ) ) {
try {
$date_created = date_create( $topic->post_date )->format( get_option( 'date_format' ) );
View ce-use-12hr-clock.php
function community_events_12hr_time() {
return 'g:i a';
function setup_time_option_filter() {
add_action( 'pre_option_time_format', 'community_events_12hr_time' );
function teardown_time_option_filter() {
View events-default-comment-status.php
* Set the default comment status for events to 'closed'.
* Could easily be adapted to target all post types or a different
* post type.
add_filter( 'get_default_comment_status', function( $status, $post_type ) {
if ( 'tribe_events' !== $post_type ) {
return $status;
View on-forum-post-status-transition.php
function on_forum_post_status_transition( $new_status, $old_status, $post ) {
// If we are not looking at a reply or a topic, bail!
if ( ! bbp_is_topic( $post ) && ! bbp_is_reply( $post ) ) {
$forum_id = bbp_get_forum_id( $post );
$author_id = bbp_is_topic( $post )
? bbp_get_topic_author_id( $post )
barryhughes / category-links-below-event-search-bar.php
Created Nov 16, 2018
Adds a list of clickable category links below the main event search bar (sometimes referred to as the "Tribe Bar"). Tested with TEC 4.6.26.
View category-links-below-event-search-bar.php
You can’t perform that action at this time.