[buddypress-trac] [BuddyPress Trac] #7580: PHP Warning: Illegal offset type in wp-content/plugins/buddypress/bp-activity/bp-activity-functions.php on line 734
buddypress-trac
noreply at wordpress.org
Tue Oct 17 16:04:08 UTC 2017
#7580: PHP Warning: Illegal offset type in wp-content/plugins/buddypress/bp-
activity/bp-activity-functions.php on line 734
-------------------------------+----------------------
Reporter: magland | Owner:
Type: defect (bug) | Status: closed
Priority: low | Milestone:
Component: Activity | Version:
Severity: minor | Resolution: invalid
Keywords: reporter-feedback |
-------------------------------+----------------------
Comment (by magland):
Hi I believe it may be due to the fact I am filtering activity types out
of the sitewide activity with the following code:
{{{#!php
<?php
function my_custom_bp_activity_types( $retval ) {
// only filter stuff from the main timeline...
if( ! bp_is_activity_directory()) {
return $retval;
}
// get all registered activity types including custom ones
$allArray = bp_activity_get_types();
$allKeys = array();
foreach($allArray as $key => $value) {
array_push($allKeys, $key);
}
// an array of things we want to exclude
$excludeArray = array(
'new_member',
'new_avatar',
'updated_profile',
'friendship_accepted',
'friendship_created',
'joined_group',
'compliment_sent',
'compliment_received'
);
// remove the array we want to exclude using array_diff
$diff = array_diff($allKeys, $excludeArray);
// set the action to our new $diff array
$retval['action'] = $diff;
// make sure to return it!
return $retval;
}
add_filter( 'bp_after_has_activities_parse_args',
'my_custom_bp_activity_types' );
}}}
with that filter in place I get an array of allowed activity types
returned if I do this:
{{{#!php
<?php
function bp_activity_post_type_get_tracking_arg( $activity_type, $arg = ''
) {
print '<pre>';
print_r($activity_type);
print '</pre>';
exit;
}}}
Any pointers on how to resolve?
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7580#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list