Forum Replies Created
-
You should try implementing it – I’d be curious to know how well it works.
In reply to: buddypress.org plugin groups not working properlySuck it up
In reply to: URL Encoding Abuse Attack AttemptFF4 for Mac – both sites loaded fine for me.
In reply to: Impossible to get avatars in a custom AJAX search?Exactly what is your AJAX returning? Is the first part (span.searchheading) coming through OK?
You might try (just for the heck of it) switching your argument structure to an array, something like this:
echo bp_core_fetch_avatar( array( 'item_id' => $row ) );Theoretically, it shouldn’t matter, but sometimes it does.
If you’re still having troubles, start dropping var_dump() statements into bp_core_fetch_avatar() itself. You can find that function in bp-core/bp-core-avatars.php.
This is not quite as straightforward as it ought to be (given that you want to keep the Log In button, which is rendered by the same function). Put the following in your plugins/bp-custom.php file:
function bbg_customize_adminbar_hooks() { remove_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 ); } add_action( 'bp_loaded', 'bbg_customize_adminbar_hooks', 999 ); function bbg_adminbar_login_menu() { global $bp; if ( is_user_logged_in() ) return false; echo '<li class="bp-login no-arrow"><a>root_domain . '/wp-login.php?redirect_to=' . urlencode( $bp->root_domain ) . '">' . __( 'Log In', 'buddypress' ) . '</a></li>'; } add_action( 'bp_adminbar_menus', 'bbg_adminbar_login_menu', 2 );Here’s a bit more about bp-custom.php, in case you haven’t used it before https://codex.buddypress.org/extending-buddypress/bp-custom-php/
In reply to: use bp_core_time_since() in blog pagesThis is just off the top of my head, but try `echo bp_core_time_since( strtotime( get_the_date() ) );`
In reply to: Affordable WordPress and BuddyPress pluginsCool, I’ll close it.
In reply to: Affordable WordPress and BuddyPress plugins`I can most assuredly say he did not rip off the premium one and stuff it in the repo.`
Correct. I spent many hours of my free time coding that plugin. If you don’t believe me, just ask my wife, who had to put up with my constant complaining about Ning’s crappy json files.
I don’t sell plugins myself, but I don’t have a problem with people who do. And I most certainly would not go out of my way to hurt those people financially, if their only “crime” is charging for their work. (Occasionally, there are other issues to be considered.)
It’s specious of you to argue that, on the one hand, the world needs more volunteers, and at the same time to pull this kind of stunt. Pulling the rug out from someone’s business will not make them “see the light” and start volunteering here. It will only make them angry.
I’ve never heard of this problem before.
In what sense are you unable to create new posts? Do you get an error message? Has the New Topic form disappeared?
In reply to: Mashable running BP?I can’t tell for sure. If so, they’ve totally rethemed it from the bottom up – I can find very few CSS selectors that match what you’d expect in bp-default. But much of the markup looks like it’s derived from bp-default, and certainly about 3/4 of what they’re doing can be done out of the box with BP, BP Followers, and Achievements.
@momotombopuro That sounds like a bug. BP is supposed to remove those blogs from all BP listings, including the admin bar. If you’re able to reproduce this behavior, you should open a ticket at trac.buddypress.org with the steps to reproduce.
It’s been useful for me too – thanks for bringing it up in this public forum. Please continue to share your reflections as you actually build the plugin. And let’s talk about the possibility of merging the BP Group Reviews plugin into what you’re doing – I don’t know if it’ll be possible given the way you’re structuring things, but there might be room for collaboration there.
`storing each rating as a custom post seems a bit weird. It is going to bloat the posts table, which will affect people backing up. `
This might be interpreted as a strength of the approach. Some backup solutions don’t account for custom tables. The custom post type approach guarantees that the rating data will be included in regular WP backups.
Why do you need to store dates in a custom field? Why not use post_date and post_modified?
That said, I know what you mean: it can seem funny to use what might seem like an arcane API to do something that could be accomplished with a simple call to the database. But using the API is doing a lot of hidden work: caching (as already discussed), security (proper query escaping, etc), compatibility with different database setups, post revisions, not to mention allowing you to use The Loop when displaying. So while it might be a bit more work on simple save/get methods, in exchange you are getting a lot of more advanced work done for you.
Yikes. Sorry

The cause has to do with the fact that ‘2.7’ and ‘2.8’ (some old WP version numbers) are part of ‘1.2.7’ and ‘1.2.8’. It is a silly strpos() issue. It will be fixed soon.
`this will not scale well because some objects have no meta table (such as images)`
How are the images being stored? If they are uploaded through the Media uploader, then they are just a post type of their own, right?
I guess that, if I knew that each rate-able content type would have a meta table, that I would store individual ratings in a post type, and store aggregate/average ratings in meta (updated each time a new rating is posted). That’s how I do it on the (admittedly imperfect) BP Group Reviews plugin. But if that won’t work, it wouldn’t be too complicated to have a second post type for average ratings. I don’t think this would introduce too much inefficiency, since there would be far fewer posts of this type (a max of one for each item) than individual ratings.
No matter where you store it, I would recommend storing the aggregate/average scores separately instead of calculating them on each page load (whether in PHP or MySQL). (Or maybe you’re not suggesting this?
)Derek – You’re right that the queries will be a bit more complex than if you stored your data in a single table, but here’s the thing: You won’t have to write those queries, since they’re all already part of the custom post type API. Or at least, as Paul says, if there are really complex things that can’t be handled by the API, there are adequate filters in place for you to modify the query. But I’d be very curious to hear what the queries might be that the API wouldn’t handle; it seems to me that the meta_query introduced in 3.1 is enough to handle just about anything, without your having to worry about the difference between the posts and the postmeta table.
Another big advantage of post types is that it’ll automatically use any caching solution that the installation has. So, even if the queries are, strictly speaking, more complex than they’d be in a custom table, this can be mostly mitigated by good caching.
You’ll probably have to write less code if you use custom post types. Also, using custom post types will make it easier for other developers to extend and customize the plugin. Using WP’s meta_query or tax_query will make it pretty straightforward to store and retrieve the data.
Your general idea about a ratings API is really smart. BP’s activity API might be a sort of model: BP provides bp_activity_add(), and components like groups have their own wrapper functions. Or a central ratings class that other plugins could extend. The details don’t matter that much.
Also, make sure you provide some flexible markup functions, so that it’s not only easy to retrieve the ratings themselves, but so there’s also a nice way for people to display them on arbitrary content types.
Looking forward to seeing what you come up with!
A simple workaround is to block access to that URL in .htaccess.
But that does not address the root issue. To the best of my knowledge, there is no file called login.php in either BP or WP. That means that you have a link somewhere in one of your files that is erroneously pointing to it, or you are getting hit by a bot that is guessing that is trying to hack your site by hitting login.php. If the former is the case, you can fix the problem by searching for ‘login.php’ in your installation. If it’s the latter, then something like an .htaccess rule is probably the only thing you can do.
In reply to: URGENT – How To Set Default Values?It sounds like whatever you did in your second post actually made my code not work. I haven’t really got time to debug this, but I would suggest that you reinstate my suggested code the way that it was previously, and then start working with some conditionals in order to make sure that the query string only gets modified when you are looking at the Activity tab. The function `bp_is_activity_component()` may be helpful here.
In reply to: URGENT – How To Set Default Values?It looks like you need to do two things.
1) Don’t do bp_ajax_querystring( ‘friends’ ). The function does not take arguments like ‘friends’. Just do bp_ajax_querystring() in the template file.
2) Here is a function that, when placed in wp-content/plugins/bp-custom.php, will do what you want:
`function bbg_my_friends_activity_default( $qs ) {
if ( is_user_logged_in() && empty( $qs ) && empty( $_POST ) ) {
$qs = ‘scope=friends’;
}return $qs;
}
add_filter( ‘bp_ajax_querystring’, ‘bbg_my_friends_activity_default’, 999 );`The problem is that this is almost certain not to work correctly with the function you have in your template file:
`function my_query_filter_new ( $query_string ) {
$query_string .= ‘&per_page=10’;
return $query_string; }
add_filter( ‘bp_ajax_querystring’, ‘my_query_filter_new’ );`If you need this latter functionality, I would try to do some work to combine the functions so that the query strings are added in the proper order.
I’m looking at the annotated revision log https://trac.buddypress.org/browser/branches/1.2/bp-blogs.php?annotate=blame&rev=4066 I can see why Subscriber blogs aren’t showing up. What I *can’t* see is why they ever should have been. It looks to me like the code has always intended for Subscriber blogs to be excluded. A recent change in WP blog role management must have made the code finally fulfill its intended purpose.
How to fix: You could write a short plugin that runs every time add_user_to_blog fires, and adds the blog to the BP user’s list using bp_blogs_record_blog(). Ideally there would be a more configurable way to make this work; it’s worth an enhancement ticket on trac.
The short plugin would work something like this. Totally untested.
`function bbg_add_subscriber_to_blog( $user_id, $role, $blog_id = false ) {
global $current_blog;if ( empty( $blog_id ) )
$blog_id = $current_blog->blog_id;if ( $role == ‘subscriber’ )
bp_blogs_record_blog( $blog_id, $user_id, true );
}
add_action( ‘add_user_to_blog’, ‘bbg_add_subscriber_to_blog’, 15, 3 );`The other part of the equation is to sync the whole shebang, which will have to be done once. Something like this (also untested) might work:
`function bbg_record_existing_blogs() {
global $bp, $wpdb;if ( !is_super_admin() )
return false;/* Truncate user blogs table and re-record. */
$wpdb->query( “TRUNCATE TABLE {$bp->blogs->table_name}” );$blog_ids = $wpdb->get_col( $wpdb->prepare( “SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0” ) );
if ( $blog_ids ) {
foreach( (array)$blog_ids as $blog_id ) {
$users = get_users_of_blog( $blog_id );if ( $users ) {
foreach ( (array)$users as $user ) {
$role = unserialize( $user->meta_value );bp_blogs_record_blog( $blog_id, $user->user_id, true );
}
}
}
}
}
add_action( ‘admin_init’, ‘bbg_record_existing_blogs’ );`Be forewarned that the latter function should only be run once; comment out the add_action() after it’s done its work. And it’ll only run if the Super Admin visits a Dashboard page. And it might be resource intensive, as it will recheck blog membership for every blog on the system. Use at your own risk.
Oh. It doesn’t pull posts at all. It uses a custom post type that has to be manually populated. However, you could pretty easily combine this with FeedWordPress, which can pull from any RSS feed (including tag/category feeds elsewhere on your WP network), and save them to the relevant custom post type on the main blog.
What does that question mean? You can have it on more than one site in a network.
Did you try the default theme? It’s possible that this is theme related. It could also be being caused by some other plugin you’re running.
Slider: https://wordpress.org/extend/plugins/post-gallery-widget/