Forum Replies Created
-
I’m no longer using BuddyPRess or bbPress. I switched to BuddyBoss and gave up on trying to get BuddyPress to work the way I wanted.
@emaralive @vapvarun thank you for the information, I can try editing and looking into other solutions when I get a chance but this one seems like a warranted challenge for the BuddyPress Programming team.
@thinlizzie it might be a waste of time at this point until the code is revised to take into account other CONSTANTS and the issue with high resolution avatars, cover photos and group profile photos getting discarded after upload. On one hand, that is nice to save server resources, but on the other hand, it’s frustrating because the images look lousy. It cheapens the look of BuddyPress to be honest.The BuddyPress also needs more design customization options especially the social feed, it’s convenient to have it generate the “Social Feed” page automatically but that is causing me trouble. I’d love to be able to put that Social Feed as a WordPress Widget or in a shortcode to embed on any page template I want. This way, I can customize the background, add a custom title or whatever else I want. BuddyPress has a lot of Widgets available but I want the Social Feed as well with customization options.
Correct, I’m still working on adjusting that php code as it doesn’t seem to be impacting the Group Profile images and for me as I’m pretty picky, it doesn’t seem to be keeping the images at 100% quality as of yet. Go ahead and try it in your environment but please use caution. If you use the snippets plugin you can use the following line to put Snippets plugin into safe mode to get back into your site if it throws a fatal error.
define(‘CODE_SNIPPETS_SAFE_MODE’, true);
It get’s pasted just before this line in wp-config.php….
/* That’s all, stop editing! Happy publishing. */
Then once you gain access back to the admin you can change it to false like this…
define(‘CODE_SNIPPETS_SAFE_MODE’, false);
Just in case, during development it comes in handy.
@thinlizzie No, I didn’t want to include that in the scripting because you can use the regenerate thumbnails plugin for that. Here’s one: https://wordpress.org/plugins/force-regenerate-thumbnails/ You can try that plugin on a few images from the media library first and then run it for your whole site if you find it to be successful. Just use caution.
This is what I came up with and I think it worked to fix the Avatar quality, however, it won’t impact the Profile images for Groups and Group cover photos. Can you point me in the correct direction for the Constants that work with those two?
Here’s my code:
// Set the BP_AVATAR_ORIGINAL_MAX_WIDTH to a higher value if ( ! defined( 'BP_AVATAR_ORIGINAL_MAX_WIDTH' ) ) { define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 1024 ); // Set to match your largest expected upload size } // Adjust the quality of the avatar resizing process function custom_bp_avatar_quality( $args ) { $args['quality'] = 100; // Set to the highest quality return $args; } add_filter( 'bp_core_avatar_resize_args', 'custom_bp_avatar_quality' ); add_filter( 'bp_core_avatar_thumb_resize_args', 'custom_bp_avatar_quality' ); add_filter( 'bp_core_group_avatar_resize_args', 'custom_bp_avatar_quality' ); add_filter( 'bp_core_group_avatar_thumb_resize_args', 'custom_bp_avatar_quality' ); // Adjust JPEG quality for all images in WordPress add_filter( 'jpeg_quality', function() { return 100; // Set to the highest quality }); // Ensure high-resolution images are used in the HTML output function custom_bp_use_full_size_avatar( $html, $params ) { if ( isset( $params['object'] ) && in_array( $params['object'], array( 'user', 'group' ) ) ) { // Get the full-size avatar URL $full_avatar_url = bp_core_fetch_avatar( array( 'item_id' => $params['item_id'], 'object' => $params['object'], 'type' => 'full', 'html' => false, )); // Construct the new img tag with the full-size avatar URL $html = sprintf( '<img src="%s" class="%s" alt="%s" width="%d" height="%d"/>', esc_url( $full_avatar_url ), esc_attr( $params['class'] ), esc_attr( $params['alt'] ), (int) $params['width'], (int) $params['height'] ); } return $html; } add_filter( 'bp_core_fetch_avatar', 'custom_bp_use_full_size_avatar', 10, 2 ); // Add custom CSS to scale down the avatars function custom_bp_add_avatar_css() { $custom_css = " .avatar, .group-avatar img { width: 150px; height: 150px; object-fit: cover; /* Ensures the image covers the element's entire area */ } "; wp_add_inline_style( 'bp-parent-css', $custom_css ); // Adjust 'bp-parent-css' to match your theme's main stylesheet handle if necessary } add_action( 'wp_enqueue_scripts', 'custom_bp_add_avatar_css' );
What I mean is, I’m uploading a perfectly crisp image that is 610×610 pixels in size and BuddyPress optimizes it and/or scales it down to fit the predefined image size, which is fine, however, in the process makes it look bad/blurry. I want the profile images to look better. Plain and simple.
I don’t want the images to be 610×610 because they are profile images but at the same time I don’t want them looking low res. I think if BuddyPress is setting them as ‘thumbnail’ size then it’s using WordPress built-in optimized image which those are typically horribly blurry.
Will do! That sounds great. I feel like BuddyPress has so many features and is great but lacks more UI and setting options so web designers/developers can customize easier to help clients.
Perhaps I need to create a new post for this or find the relevant one, but the Avatar and Cover images are showing blurry. I tried adding this code to my functions file (via snippets plugin) and it did nothing. I need to change the quality of the images to 100% not be so blurry. How do I tell BuddyPress to use the full image and just scale it down to fit the image size vs. using the thumbnail size, since typically in WordPress those images are horribly blurry.
Here’s the code I added which only alters the image sizes not QUALITY.
<?php // Define Buddypress Avatars Dimensions. if ( ! defined( 'BP_AVATAR_THUMB_WIDTH' ) ) { define( 'BP_AVATAR_THUMB_WIDTH', 50 ); } if ( ! defined( 'BP_AVATAR_THUMB_HEIGHT' ) ) { define( 'BP_AVATAR_THUMB_HEIGHT', 50 ); } if ( ! defined( 'BP_AVATAR_FULL_WIDTH' ) ) { define( 'BP_AVATAR_FULL_WIDTH', 150 ); } if ( ! defined( 'BP_AVATAR_FULL_HEIGHT' ) ) { define( 'BP_AVATAR_FULL_HEIGHT', 150 ); } @whynotadv Comment
Thanks Venutius, I spent some time using your code along with ChatGPT and this seems to have worked for me, all the feeds are gone….maybe this will help someone else!
function disable_all_rss_feeds() { // Disable all WordPress feeds function disable_all_feeds() { wp_die(__('No feed available, please visit the <a href="'. get_bloginfo('url') .'">homepage</a>!')); } add_action('do_feed', 'disable_all_feeds', 1); add_action('do_feed_rdf', 'disable_all_feeds', 1); add_action('do_feed_rss', 'disable_all_feeds', 1); add_action('do_feed_rss2', 'disable_all_feeds', 1); add_action('do_feed_atom', 'disable_all_feeds', 1); add_action('do_feed_rss2_comments', 'disable_all_feeds', 1); add_action('do_feed_atom_comments', 'disable_all_feeds', 1); // Remove RSS feed links from the header remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); // Disable BuddyPress feeds remove_action('bp_activity_feed', 'bp_activity_action_sitewide_feed'); remove_action('bp_activity_sitewide_feed', 'bp_activity_action_sitewide_feed'); remove_action('bp_member_activity_feed', 'bp_activity_action_sitewide_feed'); remove_action('bp_group_activity_feed', 'bp_activity_action_sitewide_feed'); remove_action('bp_member_feed', 'bp_dtheme_activity_feed'); remove_action('bp_group_feed', 'bp_dtheme_group_activity_feed'); // BuddyPress Nouveau template pack feed removals remove_action('bp_nouveau_group_header_meta', 'bp_nouveau_group_meta', 50); remove_action('bp_nouveau_group_header_meta', 'bp_nouveau_group_meta', 50); remove_action('bp_nouveau_action_activity_content', 'bp_nouveau_activity_feed', 5); // Disable BuddyPress members feeds remove_action('bp_members_directory_members_feed', 'bp_members_feed'); // Disable BuddyPress groups feeds remove_action('bp_groups_directory_groups_feed', 'bp_groups_feed'); remove_action('bp_group_activity_feed', 'bp_group_activity_custom_feed'); // Disable BuddyPress blogs feeds remove_action('bp_blogs_directory_blogs_feed', 'bp_blogs_feed'); remove_action('bp_blog_comments_feed', 'bp_blog_comments_custom_feed'); // Disable BuddyPress forums feeds remove_action('bp_forums_directory_topics_feed', 'bp_forums_feed'); remove_action('bp_forums_topic_feed', 'bp_forum_topic_custom_feed'); } add_action('bp_init', 'disable_all_rss_feeds', 1); // Disable BuddyPress Nouveau feeds function disable_buddypress_nouveau_feeds() { remove_action('bp_nouveau_activity_feed', 'bp_nouveau_activity_feed'); remove_action('bp_nouveau_group_feed', 'bp_nouveau_group_feed'); } add_action('bp_init', 'disable_buddypress_nouveau_feeds', 1); // Disable pingbacks and trackbacks for privacy add_filter('xmlrpc_methods', function($methods) { unset($methods['pingback.ping']); return $methods; }); add_filter('wp_headers', function($headers) { unset($headers['X-Pingback']); return $headers; }); add_filter('pings_open', '__return_false', 10, 2); // Remove RSS feed div by ID and class using jQuery function remove_rss_feed_div() { if (is_buddypress()) { ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('#activity-rss-feed.feed').remove(); }); </script> <?php } } add_action('wp_footer', 'remove_rss_feed_div'); add_filter( 'bp_rest_api_is_available', '__return_false' );
Did you ever solve this? I’m looking to do the same thing! I can’t believe more people don’t have this same problem.