Skip to content

Instantly share code, notes, and snippets.

View toluaddy's full-sized avatar
💭
I may be slow to respond.

toluaddy

💭
I may be slow to respond.
View GitHub Profile
@raviousprime
raviousprime / bulk-group-user-join.php
Created August 29, 2019 14:10
Bulk join user of certain role to BuddyPress group when created
<?php
add_action( 'groups_create_group', function( $group_id ) {
// Get users of certain roles.
$user_ids = get_users(
array(
'role' => array( 'subscriber' ),
'fields' => 'ID',
)
@KaineLabs
KaineLabs / left-sidebar.css
Created August 26, 2019 16:17
Set Left Wall and Groups Sidebar
.yz-sidebar-column {
float: left;
}
.yz-horizontal-layout .yz-main-column {
float: right;
}
.yz-horizontal-layout .yz-sidebar-column .yz-column-content {
margin-left: 0;
margin-right: 17.5px;
}
@KaineLabs
KaineLabs / yzc_disable_profile_wall_form.php
Created August 25, 2019 01:37
Disable Posting form on Profile Page.
<?php
/**
* Disable Posting form on Profile Page.
*/
function yzc_disable_profile_wall_form( $enable ) {
if ( bp_is_active( 'activity' ) && bp_is_my_profile() ) {
return false;
}
@KaineLabs
KaineLabs / yzc_add_choose_group_box.php
Created August 12, 2019 23:18
Add Choose Group Box.
<?php
/**
* Add Choose Group Box.
*/
function yzc_add_choose_group_box() {
if ( bp_is_active( 'activity' ) && ! bp_is_activity_directory() ) {
return;
}
@KaineLabs
KaineLabs / yzc_disable_activity_stream_wall_form.php
Last active August 11, 2022 21:34
Youzify - BuddyPress Disable Posting form on Global Activity Stream.
<?php
/**
* Youzify - BuddyPress Disable Posting form on Global Activity Stream.
*/
function yzc_disable_activity_stream_wall_form( $enable ) {
if ( bp_is_active( 'activity' ) && bp_is_activity_directory() ) {
return false;
}
@sbrajesh
sbrajesh / bp-user-redirect.php
Created August 11, 2019 21:56
Redirect BuddyPress User to their activity instead of home page
/**
* Redirect users to login if not not logged, otherwise, redirect to user activity.
*/
function buddydev_custom_user_home_page() {
if ( ! is_user_logged_in() ) {
bp_core_redirect( wp_login_url( site_url( '/' ) ) );
}
@MaximeCulea
MaximeCulea / bp-read-all-notifications.php
Created August 6, 2019 09:01
BuddyPress - Read all notifications buton
<?php
/**
* Class MC_BP_Notifications
* Handle the read all notifications without post / get method, based on unread notifications
*
* To be used in HTML : <a href="<?php echo Wide_Notifications::mark_notifications_as_read_url(); ?>">Read all notifications</a>
*
* @author Maxime CULEA
*/
@KaineLabs
KaineLabs / yzc_allow_ajax_on_members_type_tab.php
Last active January 25, 2020 10:38
Allow Ajax on Members types Directory Tab
<?php
/**
* Allow Ajax on Members types Directory Tab.
*/
function yzc_allow_ajax_on_members_type_tab() {
if ( ! bp_is_members_directory() ) {
return;
}
@KaineLabs
KaineLabs / yzc_get_custom_post_type_by_blog.php
Last active January 25, 2020 10:39
Get Custom Post Type By Blog
<?php
/**
* Add tree Post Image.
**/
function yzc_get_custom_post_type_by_blog() {
global $activities_template;
// Get Activity.
$activity = $activities_template->activity;
@imath
imath / bp-custom.php
Created July 12, 2019 14:17
Registering REST Fields for the BP REST API
<?php
// Registers a REST field for the Activity Endpoints.
function example_register_activity_rest_field() {
bp_rest_register_field(
'activity', // Id of the BuddyPress component the REST field is about
'example_field', // Used into the REST response/request
array(
'get_callback' => 'example_get_rest_field_callback', // The function to use to get the value of the REST Field
'update_callback' => 'example_update_rest_field_callback', // The function to use to update the value of the REST Field