Skip to content

Instantly share code, notes, and snippets.

View yzc_redirect_tab.php
<?php
/**
* Redirect Custom Tab
**/
function yzc_redirect_tab() {
if ( ! is_user_logged_in() || bp_current_component() != 'visitors' ) {
return;
}
@KaineLabs
KaineLabs / yzc_hide_md_cards_meta.php
Created Jan 20, 2023
Youzify - Hide BuddyPress Members Directory Default Meta
View yzc_hide_md_cards_meta.php
<?php
// Youzify - Hide BuddyPress Members Directory Default Meta
function yzc_hide_md_cards_meta() {
return '';
}
add_filter( 'youzify_members_directory_user_default_meta', 'yzc_hide_md_cards_meta' );
@KaineLabs
KaineLabs / yzc_show_hidden_groups_for_members.php
Created Jan 16, 2023
Youzify - BuddyPress Show Hidden Groups for Joined Members.
View yzc_show_hidden_groups_for_members.php
<?php
/**
* Youzify - BuddyPress Show Hidden Groups for Joined Members.
*/
function yzc_show_hidden_groups_for_members( $loop ) {
if ( ! is_user_logged_in() ) {
return $loop;
}
@KaineLabs
KaineLabs / yzc_sort_by_favorites.php
Created Dec 27, 2022
Youzify - BuddyPress Sort Activity by Favorites
View yzc_sort_by_favorites.php
<?php
class BP_Loop_Filters {
/**
* Constructor
*/
public function __construct() {
$this->setup_actions();
$this->setup_filters();
}
@KaineLabs
KaineLabs / yzc_add_members_directory_ratings_filter.php
Created Dec 27, 2022
Youzify - Sort Members Directory by Ratings
View yzc_add_members_directory_ratings_filter.php
<?php
// Add a "By ratings" option to the sorting dropdown menu
function yzc_add_members_directory_ratings_filter() {
echo '<option value="youzify_user_ratings_total">' . __( 'By ratings', 'youzer' ) . '</option>';
}
add_action( 'bp_members_directory_order_options', 'yzc_add_members_directory_ratings_filter' );
// Modify the query to sort the members by the number of ratings in descending order
function yzc_sort_members_youzify_user_ratings_total( $query ) {
@KaineLabs
KaineLabs / yzc_letters_restrictions.php
Created Dec 13, 2022
Youzify - BuddyPress Activity Posts & Comments Letters Restrictions
View yzc_letters_restrictions.php
<?php
/**
* Youzify - Activity Posts & Comments Letters Restrictions
*/
add_action( 'bp_activity_before_save', 'yzc_letters_restrictions', 10 );
function yzc_letters_restrictions( $activity ) {
$error_msg = 'Sorry, you have added too many letters.';
@KaineLabs
KaineLabs / yzc_reorder_group_tabs.php
Created Nov 19, 2022
Youzify - BuddyPress Reorder Group Tabs
View yzc_reorder_group_tabs.php
<?php
function yzc_reorder_group_tabs() {
global $bp;
if ( isset( $bp->groups->current_group->slug ) && $bp->groups->current_group->slug == $bp->current_item ) {
$bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['position'] = 10;
$bp->bp_options_nav[$bp->groups->current_group->slug]['home']['position'] = 20;
$bp->bp_options_nav[$bp->groups->current_group->slug]['info']['position'] = 30;
$bp->bp_options_nav[$bp->groups->current_group->slug]['members']['position'] = 40;
$bp->bp_options_nav[$bp->groups->current_group->slug]['media']['position'] = 50;
}
View youzify_profile_header_show_member_type_meta.php
<?php
add_filter( 'youzify_profile_header_show_member_type_meta', '_return_false' );
@KaineLabs
KaineLabs / bp_activities_sync_favorites.php
Last active Sep 19, 2022
BuddyPress Sync Activities Favourite with Activities Reactions.
View bp_activities_sync_favorites.php
<?php
/**
* BuddyPress Sync Activities Favourite with Activities Reactions.
* */
add_action( 'bp_init', function() {
if ( ! function_exists( 'yzar_option' ) ) {
return;
}
@KaineLabs
KaineLabs / yzc_add_update_group_cache.php
Last active Jul 20, 2022
yzc_add_update_group_cache.php
View yzc_add_update_group_cache.php
<?php
/*
* BuddyPress - Update Members Status & Update Groups Cache
*/
function yzc_add_update_group_cache() {
$members = get_users( 'fields=ID' );
foreach ( $members as $user_id ) {
bp_update_user_last_activity( $user_id, bp_core_current_time() );