Skip to content

Instantly share code, notes, and snippets.

Brajesh Singh sbrajesh

Block or report user

Report or block sbrajesh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sbrajesh
sbrajesh / record-last-activity-time-for-all-users.php
Created Aug 20, 2018
Add last_activity time for all non active members on BuddyPress
View record-last-activity-time-for-all-users.php
INSERT INTO wp_bp_activity(user_id, component, type, action, content, primary_link, item_id, date_recorded ) select ID, 'members', 'last_activity', '', '', '', 0, NOW() FROM wp_users WHERE ID NOT IN (SELECT user_id FROM `wp_bp_activity` WHERE type="last_activity" )
@sbrajesh
sbrajesh / buddypress-user-contact-form-extend.php
Created Jun 26, 2018
Extend BuddyPress User Contact Form
View buddypress-user-contact-form-extend.php
/**
* BuddyPress User Contact Form extension.
*/
class BPUCF_Custom_Extend {
public function __construct() {
$this->setup();
}
@sbrajesh
sbrajesh / gist:e10452da07ab0a68b1cf457b87a3ec66
Created Jun 17, 2018
Set User account inactive when they verify/activate their BuddyPress Account
View gist:e10452da07ab0a68b1cf457b87a3ec66
/**
* Mark account status as inactive when they activate their BuddyPress account after signup.
*
* @param int $user_id user id.
*/
function buddydev_custom_keep_user_inactive( $user_id ) {
if ( ! function_exists( 'bp_account_deactivator' ) ) {
return;
}
@sbrajesh
sbrajesh / wordpress-latest-post-content-fetch.php
Last active May 13, 2018
Efficient WordPress Latest Post content fetch for a user
View wordpress-latest-post-content-fetch.php
/**
* Fetch of Latest Post content of a user by post type.
*
* @param array $atts shortcode atts.
* @param string $content n/a
*
* @return mixed|string
*/
function buddydev_user_last_post_shortcode( $atts, $content = '' ) {
@sbrajesh
sbrajesh / buddydev-bp-bradcrumb.php
Created Mar 22, 2018
Add breadcrumb trail compatibility for BuddyPress
View buddydev-bp-bradcrumb.php
/**
* Helper class for adding the trail items to breadcrumb trail
*
* @copyright 2018, Brajesh Singh.
*/
class BuddyDev_BP_Breadcrumb {
/**
* Add BuddyPress User/group specific trail items
@sbrajesh
sbrajesh / profile-completion-buddypress.php
Last active Mar 19, 2018
Specific use case for Herve for profile completion.
View profile-completion-buddypress.php
class BuddyDev_Profile_Field_Completion_Helper {
/**
* Which member type should be set? PLease change it.
*
* @var string
*/
private $member_type = 'YOUR_MEMBER_TYPE'; // Please Change it.
/**
@sbrajesh
sbrajesh / enable-wire-upload-with-mediapress.php
Last active Dec 18, 2017
Enable activity as wire upload with MediaPress
View enable-wire-upload-with-mediapress.php
/**
* Enable activity wire upload with MediaPress.
*
* @param bool $can allow upload or not.
*
* @return bool
*/
function buddydev_enable_activity_wire_upload( $can ) {
View mpp-limit-gallery-media-by-user.php
@sbrajesh
sbrajesh / mpp-bp-reshare.php
Created May 30, 2017
MediaPress media support for BP reshare plugin
View mpp-bp-reshare.php
// For reshare, add mpp_media_upload type.
add_filter( 'buddyreshare_activity_types', function( $types ) {
$types[] = 'mpp_media_upload';
return $types;
});
// Filter the action string for the shared media activity
add_filter( 'buddyreshare_prepare_reshare_activity', function( $action_string, $activity ) {
if ( 'mpp_media_upload' !== $activity->type ) {
@sbrajesh
sbrajesh / mpp-display-gallery-media-owner-name.php
Created Jan 28, 2017
Add the gallery creator and media uploaders name to mediapress gallery/media.
View mpp-display-gallery-media-owner-name.php
You can’t perform that action at this time.