Forum Replies Created
-
Either into your child theme’s functions.php file, or into a file in your plugin directory called bp-custom.php
It is indeed for something else, but it gives you the strategy. A function like
function my_custom_query_filter( $query_string ) {
$query_string .= '&per_page=35';
return $query_string;
}
add_filter( 'bp_dtheme_ajax_querystring', 'my_custom_query_filter' );does something pretty close to what you want.
You’ll have to filter the output of bp_ajax_querystring. See some of the discussion on this page: https://buddypress.org/forums/topic/how-can-i-set-show-newblogposts-as-default-on-acitivity-stream
In reply to: Images on Latest Posts vs. BlogsThe problem is that the src path is relative. On your blog, the path is relative to the correct place. Once the item has been republished, the reference is no longer valid.
I suppose you could write a filter for bp_activity_content that would detect this kind of code, call up the correct URL of the blog, and rewrite the src path as an absolute path. Not sure how consistent it would be across different blogs, though.
In reply to: New version of Forum Attachments for BuddyPressHey stwc – Very strange about the differences on a local vs live install. The inner workings of the plugin are in places a bit mysterious to me (the upload mechanisms in particular are pretty much 100% _ck_’s work). I too experienced some difficulties on different kinds of setups. But I’m glad you’ve got it working on the live install – that’s where it really counts
Anything you don’t want to appear to non-logged in visitors you should wrap in
<?php if ( is_user_logged_in() ) : ?>and
<?php endif; ?>In reply to: Plugin Hall of Shame! 🙂 Plugin Devs Please ReadOK, you can take me off the Shame List. I’ve just put new versions of Group Forum Subscription and Enhanced BuddyPress Widgets into the repo that use the loader method. HIGH FIVE FOR MYSELF!!
In reply to: Editing Forum heat map (tag cloud) settingssnark – You don’t need to hack the core files. (Though, admittedly, this would be a lot easier if the tag cloud were filterable before it was converted into HTML. The method I used is clunky at best.) The following two functions in functions.php should rearrange all tag clouds to be in alphabetical order:
function bbg_compare_alphabetical($a, $b) {
return strCmp($a['name'], $b['name']);
}
function bbg_alphabetical_tag_cloud_filter( $a, $b ) {
$tags = explode( "\\n", $a );
$tags_new = array();
foreach( $tags as $key => $tag ) {
$tag_split = explode( '</a>', $tag );
$cut = strrpos( $tag_split[0], '>' );
$tag_name = substr( $tag_split[0], $cut + 1 );
$tag_new = array( 'name' => $tag_name, 'html' => $tag );
$tags_new[] = $tag_new;
}
usort( $tags_new, "bbg_compare_alphabetical" );
$tags_sorted = array();
foreach( $tags_new as $tag ) {
$tags_sorted[] = $tag['html'];
}
$tags_sorted = implode( "\\n", $tags_sorted );
return $tags_sorted;
}
add_filter( 'tag_heat_map', 'bbg_alphabetical_tag_cloud_filter', 10, 1 );In reply to: Are these Plugins Update-Friendly?I can speak to the ones I’ve written here.
Update friendly: BP Group Management, Enhanced BuddyPress Widgets (as long as you’re using the most recent version), Invite Anyone.
Not necessarily update friendly: Group Forum Subscription, which I haven’t updated for BP 1.2 so is use-at-your-own risk at the moment (I recommend https://wordpress.org/extend/plugins/buddypress-group-activity-stream-subscription/ instead).
In reply to: plugin not workingThe “Are you sure” message usually means you’re having a nonce error. If you’re submitting a post or comment or some other data with your plugin, check the core code that usually handles that data and see if there’s a check admin referer in there. Google wordpress nonce to learn about how that works.
In reply to: Forum hacking tip (and a plea to BP developers)I’d be curious to hear more about what people miss about the bbPress admin panel. If it’s about activating plugins, I’m afraid that access to bb-admin.php won’t do any good. If the plugin is compatible with BP, then you should be able to put it in the WP plugin dir and activate it. But chances are good that it won’t be, as BP and bbPress are very different at the level of the template. bbPress plugins, at least the ones that have big surface effects, need to be rewritten to some extent to be compatible.
If the purpose is group-independent forums, then I think that a far, far better solution is to rig up a way to have some groups “unlisted”, so that their forums, while still attached to groups, would seem group-free. Not entirely trivial, but easy enough, and far, far less overhead than an entirely separate installation of bbPress that has to be separately themed, etc.
Or is there something else about the bbPress admin panel I’m forgetting? I suppose it would be kinda nice to have a place to see all topics at a glance from the admin panel.
You’ve more or less got the structure correct.
– I don’t believe “title” is a valid attribute for li and ul tags. If your goal is to display the word “Community”, you’ll have to put it outside the tag like so:
<li>Community...– I assume that your purpose is to make the Community submenu (Activity, Members, etc) a dropdown menu that is invisible except when you hover over the header Community. That’s a CSS issue. I recommend you find a WordPress theme (or any website, really) that has such a feature, look at the source code and especially the CSS, and emulate the necessary rules. You could also check out a tutorial, like the “horizontal” menu bar described here: http://www.seoconsultants.com/css/menus/tutorial/.
Good luck!
In reply to: question about Group filteringThis works for me.
function filter_groups_by_type_private( $a, $b ) {
$groups = $b->groups;
foreach( $groups as $key => $group ) {
if ( $group->status != 'private' ) {
unset( $groups[$key] );
$b->group_count = $b->group_count - 1;
}
}
$groups = array_values( $groups );
$b->groups = $groups;
return $b;
}
add_filter( 'bp_has_groups', 'filter_groups_by_type_private', 10, 2 );Play around with the value ‘private’ to change what the function does.
It’s not perfect, because the pagination is not adjusted accordingly. You’d probably have to rebuild the core function in order to make pagination happen, since per_page gets passed right along to the database function. That’s why I say you might do well to write an enhancement ticket and submit it to trac.buddypress.org. In the meantime, though, this will set you in the right direction.
In reply to: Editing Forum heat map (tag cloud) settingsYou’ll have to dig pretty deep into the bbPress code to make this work right. bp_forums_tag_heat_map uses bb_tag_heat_map to create the cloud, and it doesn’t take order or order_by as an argument. bb_tag_heat_map then goes to bb_get_tag_heat_map. If you were going to make the reordering happen (without a lot of funny business) it might best happen at the level of bb_tag_heat_map (or a custom version of that function). The list of tags is created like this (see buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php):
$tags = bb_get_top_tags( array( 'number' => $limit ) );which returns an array. You could then try using usort to sort by $tags[‘count’] before sending $tags to bb_get_tag_heat_map().
In reply to: New version of Forum Attachments for BuddyPressstwc – It’s very strange that downloads would work for you but not inline images, as I’m using almost exactly the same code for both features. When you view the source of an attachments section, do you see an image tag? What happens if you try to visit a URL like http://example.com/wp-content/plugins/forum-attachments-for-buddypress/image.php?filenum=9, where example.com is your site, wp-content is your path to wp-content, and 9 is the index of a file you know to be an image (check out the bb_attachments table to see the ids)?
Thanks for the notes on the edit page. I don’t think I’ve made any effort to make those work
It’s next on my list.
In reply to: Issue with default groups widgetI don’t know how WidgetLogic works, but you should be able to use something like:
global $bp;
if ( $bp->current_component == $bp->profile->slug ||
( $bp->current_component == $bp->activity->slug && $bp->current_action == 'just-me' ) )
{ /* Do your stuff here */ }In reply to: Issue with default groups widgetTry feeding a blank ‘user_id’ argument into bp_has_groups in the widget to see if it fixes the problem.
In reply to: question about Group filteringI would start by hooking a filter to bp_has_groups. The filter should loop through the results and unset the ones you don’t want to display, depending on what page you’re on. Thus, if you’re on a page where you only want to show public groups (as determined by, for instance, the content of $bp->current_action or $bp->action_variables, you would unset each member of the groups array for which bp_get_group_type() returned ‘public’.
Making group type an argument for bp_has_groups is a good idea for an enhancement.
In reply to: Ajax Missing, CSS issuesWe are all idiots in our own special way
In reply to: Ajax Missing, CSS issuesWhat’s the AJAX conflict? The member filter is working fine for me. Or is there some other ajax on the page?
In reply to: [New Plugin] BuddyPress Group Forum ExtrasDang it, rich, you beat me to posting here! I found this error about 5 minutes ago and checked a new version into the repo.
Thanks so much for following up!
Boone
In reply to: [New Plugin] BuddyPress Group Forum ExtrasI was finally able to reproduce some of the redirect conflict issues raised here and elsewhere.
The problem (or at least the problem chembro303 describes) arises when Forum Attachments (0.2.1) and Forum Extras (0.1.5) are installed and you click on the Groups tab in bp-default. If you comment out line 26 in bp-forum-extras.php
do_action( 'bbpress_init');then the conflict no longer happens. Unfortunately, that doesn’t help much – tons of things are hooked to bbpress_init, so it’s kind of tough to narrow them down. I’ll keep thinking about this, but Rich, hopefully this little bit of info will spark an idea on your part!
In reply to: New version of Forum Attachments for BuddyPresskriskl – I assume you’re talking about the ajax quote plugin that’s part of https://wordpress.org/extend/plugins/buddypress-group-forum-extras/other_notes/. I just tried it and they seem to be working fine together on my installation. Can you be more specific about what is “breaking”?
avi-m – I installed the widgetized theme and I didn’t have any redirect problems. I wonder if the problem is arising from a combination of theme + my plugin + some other plugin. I don’t suppose you could turn off all other BP dependent plugins for a second to test that theory? Or perhaps give me a list of the plugins you’re running so I can try it myself?
You can filter the activity stream on a certain page with something like this:
function bp_no_blog_comment_filter( $a, $activities ) {
global $bp;
/* Only run the filter on activity streams where you want blog comments filtered out. For example, the following will only filter them on the sitewide activity tab: */
if ( $bp->current_component != $bp->activity->slug )
return $activities;
/* Then filter out all the blog comments */
foreach( $activities->activities as $key => $activity ) {
if ( $activity->type == 'new_blog_comment' ) {
unset( $activities->activities[$key] );
$activities->total_activity_count = $activities->total_activity_count - 1;
$activities->activity_count = $activities->activity_count - 1;
}
}
/* Renumber the array keys to account for missing items */
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( 'bp_has_activities', 'bp_no_blog_comment_filter', 10, 2 );Obviously you may want to tweak some of the details, but that’s the basic idea – the comments are still recorded to the stream, and still appear on the individual member streams.
No, there is no simple way. If you’ve just set it up, the best bet is to export the blog content you’ve created so far, reinstall WPMU (selecting subdirectory during the new installation), and import the blog information.