Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
KaineLabs / yzc_disable_bp_registration.
Created June 14, 2019 00:00
Disable Buddypress Registration
<?php
/**
* Disable Buddypress Registration
*/
function yzc_disable_bp_registration() {
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );
remove_action( 'bp_screens', 'bp_core_screen_signup' );
}
add_action( 'bp_loaded', 'yzc_disable_bp_registration' );
@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 / 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 / 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_add_md_my_profile_link.php
Created April 30, 2019 02:59
Add My Member Directory My Profile Link.
@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' );
@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_change_lost_password_link.php
Created April 10, 2019 03:11
Change Lost Password Page Link.
@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;
}
<?php
/**
* Change Cover Image Size.
*/
function yzc_attachments_get_cover_image_dimensions( $wh ) {
return array( 'width' => 1350, 'height' => 350 );
}
add_filter( 'bp_attachments_get_cover_image_dimensions', 'yzc_attachments_get_cover_image_dimensions', 99 );