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 / bp-required-profile-field.php
Created Aug 27, 2018
Fore completion of BuddyPress Required Field
View bp-required-profile-field.php
class BuddyDev_Profile_Field_Completion_Helper {
/**
* Show notice to user?
*
* @var bool
*/
private $show_notice = true;
@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 / xprofile-enhance
Created Sep 4, 2011
functions to show the field data or ask to fill it
View xprofile-enhance
//pass the field name as string
function show_or_ask_to_fill($field_name){
$data= xprofile_get_field_data($field_name, bp_loggedin_user_id());
if(empty($data)){
$field_id=xprofile_get_field_id_from_name($field_name);
$group_id=custom_get_group_from_field($field_id);
echo sprintf("Please click <a href='%s'>%s</a> to fill the data", bp_get_loggedin_user_link()."profile/edit/group/".$group_id."/#field_".$field_id,$field_name);
}
@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
You can’t perform that action at this time.