Skip to content

Instantly share code, notes, and snippets.

View paulgibbs's full-sized avatar

Paul Wong-Gibbs paulgibbs

View GitHub Profile
[31-Mar-2014 20:07:13 UTC] PHP Fatal error: Call to undefined function bp_get_groups_slug() in /Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/bp-activity/bp-activity-loader.php on line 314
diff --git a/bp-xprofile/bp-xprofile-filters.php b/bp-xprofile/bp-xprofile-filters.php
index cfac474..c049194 100644
--- a/bp-xprofile/bp-xprofile-filters.php
+++ b/bp-xprofile/bp-xprofile-filters.php
@@ -73,8 +73,6 @@ function xprofile_filter_kses( $content ) {
}
/**
- * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
- *
<?php
//bp-xprofile/admin/js/admin.js
function hide( id ) {
if ( !document.getElementById( id ) ) return false;
document.getElementById( id ).style.display = "none";
// the field id is [fieldtype]option[iterator] and not [fieldtype]div[iterator]
field_id = id.replace( 'div', 'option' );
document.getElementById( field_id ).value = '';
$ phpunit
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Installing BuddyPress...
Not running ajax tests... To execute these, use --group ajax.
PHPUnit 3.8-g5efcfe5 by Sebastian Bergmann.
Configuration read from /Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/tests/phpunit.xml
............................................................... 63 / 401 ( 15%)
<?php
// .com/achievements/
function fravaccaro_root_slug( $slug ) {
return 'biscuits';
}
add_filter( 'dpa_get_root_slug', 'fravaccaro_root_slug' );
// .com/achievement/my_achievement/
function fravaccaro_singular_root_slug( $slug ) {
return 'biscuit';
<?php
// Based on Achievements' DPA_Available_Achievements_Widget widget. Built in about 45 minutes, so YMMV.
add_action( 'dpa_ready', 'md_widget_wrapper', 200 );
function md_widget_wrapper() {
class MD_Unlocked_Achievements_Widget_Grid extends DPA_Available_Achievements_Widget {
/**
* Constructor
<?php
function md_change_achievements_slug() {
return 'badges';
}
add_filter( 'dpa_get_root_slug', 'md_change_achievements_slug' );
<?php
function jetpack_buddypress_tweaks() {
if ( ! bp_is_user_change_avatar() && ! bp_is_group_admin_page( 'group-avatar' ) )
return;
add_filter( 'jetpack_photon_override_image_downsize', '__return_true' );
}
// This action is called by BuddyPress on "wp" at priority 10. If it's called, you can assume BP is loaded, but remember that a particular component might not be loaded -- you need to check if anything else is added here in the future.
add_action( 'bp_ready', 'jetpack_buddypress_tweaks' );
@paulgibbs
paulgibbs / gist:8188490
Created December 30, 2013 21:31
hack of WordPress' https://develop.svn.wordpress.org/trunk/tools/i18n/extract.php to find gettext strings without a textdomain
<?php
function extract_from_code( $code, $file_name ) {
$translations = new Translations;
$function_calls = $this->find_function_calls( array_keys( $this->rules ), $code );
foreach( $function_calls as $call ) {
// These lines!
if ( in_array( 'buddypress', $call['args'] ) ) {
continue;
}
diff --git a/bp-notifications/bp-notifications-classes.php b/bp-notifications/bp-notifications-classes.php
index 3aed496..4556c07 100644
--- a/bp-notifications/bp-notifications-classes.php
+++ b/bp-notifications/bp-notifications-classes.php
@@ -317,7 +317,7 @@ class BP_Notifications_Notification {
// is_new
if ( ! empty( $args['is_new'] ) ) {
$where_conditions['is_new'] = "is_new = 1";
- } elseif ( ( 0 === $args['is_new'] ) || ( false === $args['is_new'] ) ) {
+ } elseif ( isset( $args['is_new'] ) && ( 0 === $args['is_new'] || false === $args['is_new'] ) ) {