Skip to content

Instantly share code, notes, and snippets.

View benallfree's full-sized avatar

Ben Allfree benallfree

  • Reno, NV
View GitHub Profile
@benallfree
benallfree / easy-theme-and-plugin-upgrades.diff
Created December 21, 2013 14:15
Zip files which do not contain a bare parent directory entry were not being detected correctly.
Index: modify-installer.php
===================================================================
--- modify-installer.php (revision 826618)
+++ modify-installer.php (working copy)
@@ -134,7 +134,7 @@
$contents = $archive->listContent();
foreach ( (array) $contents as $content ) {
- if ( preg_match( '|^([^/]+)/$|', $content['filename'], $matches ) ) {
+ if ( preg_match( '|^([^/]+)/|', $content['filename'], $matches ) ) {
@benallfree
benallfree / custom-post-type-ui.diff
Created December 13, 2013 12:47
Add import/export to CPT.
Index: custom-post-type-ui.php
===================================================================
--- custom-post-type-ui.php (revision 821057)
+++ custom-post-type-ui.php (working copy)
@@ -59,6 +59,7 @@
add_submenu_page( 'cpt_main_menu', __( 'Add New', 'cpt-plugin' ), __( 'Add New', 'cpt-plugin' ), 'manage_options', 'cpt_sub_add_new', 'cpt_add_new' );
add_submenu_page( 'cpt_main_menu', __( 'Manage Post Types', 'cpt-plugin' ), __( 'Manage Post Types', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_cpt', 'cpt_manage_cpt' );
add_submenu_page( 'cpt_main_menu', __( 'Manage Taxonomies', 'cpt-plugin' ), __( 'Manage Taxonomies', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_taxonomies', 'cpt_manage_taxonomies' );
+ add_submenu_page( 'cpt_main_menu', __( 'Import/Export', 'cpt-plugin' ), __( 'Import/Export', 'cpt-plugin' ), 'manage_options', 'cpt_sub_import_export', 'cpt_import_export' );
}
@benallfree
benallfree / nextend-facebook-connect.diff
Last active December 31, 2015 02:09
Patches nextend FB to use login_redirect filter
Index: nextend-facebook-connect.php
===================================================================
--- nextend-facebook-connect.php (revision 819180)
+++ nextend-facebook-connect.php (working copy)
@@ -132,13 +132,13 @@
AND type = \'fb\'', $user_info->ID));
set_site_transient($user_info->ID.'_new_fb_admin_notice',__('Your Facebook profile is successfully unlinked from your account.', 'nextend-facebook-connect'), 3600);
}
- new_fb_redirect();
+ new_fb_redirect($user_info);
@benallfree
benallfree / gist:5282099
Created March 31, 2013 21:37
Demo of WP media uploader in metabox
jQuery(function($) {
var element_clicked = false;
$('#my-button').click(function() {
formfield = jQuery('#my-button').attr('name');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
element_clicked = true;
return false;