This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 = '' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enable activity wire upload with MediaPress. | |
* | |
* @param bool $can allow upload or not. | |
* | |
* @return bool | |
*/ | |
function buddydev_enable_activity_wire_upload( $can ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter on the gallery creation permission. | |
* | |
* @param bool $can can create. | |
* @param string $component component name. | |
* @param string $component_id component id. | |
* | |
* @return bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter("bppg_iwilldo_it_myself","__return_true");//stop the plugin to inject css | |
//now we can write our own css | |
add_action("wp_head","my_css_for_profile_bg"); | |
function my_css_for_profile_bg(){ | |
$image_url=bppg_get_image(); | |
if(!$image_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//redirect non logged in users to homepage | |
function bp_guest_redirect() { | |
global $bp; | |
if(!is_user_logged_in()&&!(bp_is_page(BP_REGISTER_SLUG)||bp_is_page(BP_ACTIVATION_SLUG)||is_front_page())) { // not logged in user | |
wp_safe_redirect( bp_get_root_domain());//make sure page exists exist slug welcome | |
exit(0);//no further execution | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display the name of the creator of the gallery below gallery cover | |
* | |
*/ | |
function mpp_custom_display_gallery_owner_name() { | |
$gallery = mpp_get_gallery(); | |
if ( ! $gallery ) { | |
return ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Copy PNG files from the Source Directory( and its child directories) to destination as specified | |
* | |
* I use it to move all the png files from the extracted subtle patterns directories to another directory | |
* | |
* @param string $path the directory which contains our subdirectories | |
* @param string $destination_dir the absolute path to directory where files will be moved | |
*/ | |
function copy_png_files( $path, $destination_dir ) { |