bp_activity_filter_kses function
-
All throughout my site I have some hidden groups, and if you are a member of them I use the groups_is_user_member snippet to do certain things. For example if you’re a member of the “Verified” group you have a verified icon by your name on profile and in the activity feed.
I’m encountering a problem with that method though and it’s probably out of silly human error.I am trying to give premium members access to different HTML tags than regular members. I removed this script from the BuddyPress source code and placed it in bp-custom.php. It wasn’t working so I echoed $id and it was 0, so I’m guessing bp-custom.php has no idea user’s are logged in and probably can’t access groups_is_user_member either? It didn’t work when it was in bp-activity/bp-activity-filters.php either.
If I remove the group IF statement I can use all the HTML tags so that isn’t the problem. The problem is that the IF statement has no idea if I’m logged in or a member of the group.
<?php $id = get_current_user_id(); $premium_group_id = 13; function bp_activity_filter_kses($content) { global $allowedtags; $activity_allowedtags = $allowedtags; if (groups_is_user_member($id, $premium_group_id)) { $activity_allowedtags['a']['href'] = array(); $activity_allowedtags['b'] = array(); $activity_allowedtags['i'] = array(); $activity_allowedtags['darkblue'] = array(); $activity_allowedtags['darkgreen'] = array(); $activity_allowedtags['darkaqua'] = array(); $activity_allowedtags['darkred'] = array(); $activity_allowedtags['darkpurple'] = array(); $activity_allowedtags['gold'] = array(); $activity_allowedtags['gray'] = array(); $activity_allowedtags['darkgray'] = array(); $activity_allowedtags['blue'] = array(); $activity_allowedtags['green'] = array(); $activity_allowedtags['aqua'] = array(); $activity_allowedtags['red'] = array(); $activity_allowedtags['lightpurple'] = array(); $activity_allowedtags['yellow'] = array(); $activity_allowedtags['a']['href'] = array(); } else { $activity_allowedtags['a']['href'] = array(); } $activity_allowedtags = apply_filters('bp_activity_allowed_tags', $activity_allowedtags); return wp_kses($content, $activity_allowedtags); } ?>
- You must be logged in to reply to this topic.