This file contains hidden or 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
//fix the nav default | |
function bpcom_fix_nav(){ | |
global $bp; | |
if(!bp_is_my_profile()) | |
return; | |
if ( $bp->current_component == BP_ACTIVITY_SLUG && $bp->current_action=="just-me" ) { | |
$action=bpcom_get_current_actual_action(); | |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
/* | |
Plugin Name: BP Redirect to Profile for Buddypress | |
Description:Redirect user to their profile when they login | |
Version: 1.1.1 | |
Requires at least: BuddyPress 1.1 | |
Tested up to: BuddyPress 1.2.8+WordPress 3.1 | |
License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html | |
Author: Brajesh Singh | |
Author URI: http://buddydev.com |
This file contains hidden or 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
add_action("bppg_background_uploaded","bppg_record_activity"); | |
function bppg_record_activity( $bg_image ) { | |
global $bp; | |
if ( !function_exists( 'bp_activity_add' ) ) | |
return false; | |
$r = array( | |
'user_id' => $bp->loggedin_user->id, | |
'content' =>false , | |
'action'=>sprintf("%s changed their profile background",bp_core_get_userlink( $bp->loggedin_user->id )), |
This file contains hidden or 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 hidden or 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
remove_action("bp_after_member_header","visitors_show_my_recent_visitor");//remove hook | |
add_action("bp_after_member_header","visitors_show_everyone_recent_visitor");//add custom view | |
function visitors_show_everyone_recent_visitor(){ | |
global $bp; | |
$recent_visitors=visitors_get_recent_visitors(); | |
if(empty($recent_visitors)) | |
return;//if no visists yest, do not show at all |
This file contains hidden or 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 hidden or 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
/** | |
* Get Age from BuddyPress date of Birth | |
* @param string $dob_field_name :name of the DOB field in xprofile, like Dob or Date of Birth | |
* @param int $user_id : the user for which you want to retrieve the age | |
* @param string $format: the way you want to print the difference, look t <http://php.net/manual/en/dateinterval.format.php> for the acceptable agrs | |
* @return string :the formatted age in year/month | |
*/ | |
function bpdev_get_age_from_dob($dob_field_name,$user_id=false,$format="%y Years, %m Month(s), %d days"){ | |
if(!$user_id) |
OlderNewer