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 / user-report-message-thread.php
Created Feb 19, 2019
Add user report button in message thread.
View user-report-message-thread.php
/**
* Add block/unblock button on single message thread.
*/
function buddydev_show_user_report_button_on_message_thread() {
// only message involving single user can be blocked.
if ( ! function_exists( 'bpmts_report_button' ) || ! bp_is_my_profile() ) {
return;
}
@sbrajesh
sbrajesh / gist:42843929a5b89c3065ee2ae6b1e6a904
Created Dec 11, 2018
Use a text field as a way to link to other users profile on BuddyPress
View gist:42843929a5b89c3065ee2ae6b1e6a904
class BP_Other_User_As_Profile_Field {
/**
* Field id, replace with actual field id.
*
* @var string
*/
private $field_id = 25; // Chang it with actual field id.
@sbrajesh
sbrajesh / hv2.php
Created Nov 5, 2018
Featured Member Expiration based on role
View hv2.php
/**
* Class BP_Featured_Member_Expirable_Membership
*
* @author Ravi Sharma
*/
class BP_Featured_Member_Expirable_Membership{
/**
* Singleton Instance
@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 / 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.