Skip to content

Instantly share code, notes, and snippets.

@jonasnick
jonasnick / bca.php
Last active October 17, 2022 20:36
Blog Comments in Activity (bca) Shows blog post comments in buddypress' activity stream. Does currently not keep track of editing or removing comments.
<?php
/*
* Blog Comments in Buddypress Activity
* WARNING: Test thoroughly if it works in your environment before using in production code.
* LICENSE: Public domain
*/
/*
* When a new comment gets added to the database, add this comment to the
@KaineLabs
KaineLabs / yz_show_profile_comments_tab_if_user_has_comments.php
Created June 4, 2019 04:34
Display Profile Comment Tab Even If User Has No Comments
<?php
add_filter( 'yz_show_profile_comments_tab_if_user_has_comments', '__return_false' );
@KaineLabs
KaineLabs / yz-change-images-compression-quality.php
Created July 13, 2018 17:27
Change Images Compression Quality
<?php
/**
* Change Images Compression Quality
*/
function yzc_attachments_compression_quality( $quality ) {
// By default the quality is : 80.
return 80;
}
add_filter( 'yz_attachments_compression_quality', 'yzc_attachments_compression_quality' );
@KaineLabs
KaineLabs / yz-post-on-other-users-wall.php
Last active February 13, 2022 22:20
Post On Other Users Wall !
<?php
/**
* Display Posting Form In Friends Wall.
*/
add_action( 'bp_before_member_activity_post_form', 'yzc_add_posting_form_in_friends_wall' );
function yzc_add_posting_form_in_friends_wall() {
if ( is_user_logged_in() && ! bp_is_my_profile() && bp_is_user() ) {
add_filter( 'gettext', 'yzc_change_whats_new_msg', 10 );
@KaineLabs
KaineLabs / move-bp-comments-to-top.php
Last active February 13, 2022 21:31
BuddyPress move new commented activity stream to top
<?php
/**
* Sort last commented posts to the top of activity line
* Source: http://techiescircle.com/move-new-commented-activity-stream-to-top/
*/
function yzc_bp_activity_bump_comment_posted( $comment_id, $params ) {
global $bp, $wpdb;
@KaineLabs
KaineLabs / yzc_friends_and_groups_only_activity_args.php
Created May 25, 2019 06:05
Show Only Friends and Groups Activities
<?php
/**
* Show Only Friends and Groups Activities
*/
function yzc_friends_and_groups_only_activity_args( $args ) {
if( ! bp_is_activity_directory() || ! is_user_logged_in() ) {
return $args;
}
@KaineLabs
KaineLabs / yzc_display_like_button_count.php
Last active February 5, 2022 03:49
Display Like Button Count
<?php
/**
* Display Like Button Count
*/
function yzc_display_like_button_count( $button, $link ) {
$liked_users = yz_get_who_liked_activities( bp_get_activity_id() );
if ( ! empty( $liked_users ) ) {
$count = count( $liked_users );
@KaineLabs
KaineLabs / remove-yoast-meta-tags.php
Last active October 30, 2021 19:55
Youzify - BuddyPress Remove Yoast Meta Tags
<?php
/**
* Remove Yoast Meta Tags in profiles and groups pages.
*/
function remove_all_wpseo_og() {
if ( bp_is_user() || bp_is_group() ) {
$front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class );
remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 );
}
}
@KaineLabs
KaineLabs / yzc_sync_profile_about_me_widget.php
Last active January 22, 2021 05:03
Sync About Me Widget
<?php
/**
* Sync About Me Widget - Image.
*/
function yzc_sync_profile_about_me_widget_image( $photo_url = null, $user_id ) {
if ( ! empty( $photo_url ) || bp_is_current_component( 'widgets' ) ) {
return $photo_url;
}
@KaineLabs
KaineLabs / yzc_add_content_above_members_directory.php
Created April 17, 2019 18:29
Add Content Above Members Directory
<?php
/**
* Add Content Above Members Directory.
*/
function yzc_add_content_above_members_directory() {
// Add content here.
echo 'add content here';
}
add_action( 'bp_before_directory_members', 'yzc_add_content_above_members_directory' );