Search Results for 'bp_core_fetch_avatar'
-
Search Results
-
I’ve found only a few examples of using bp_get_group_avatar(). I can’t seem to get anything returned other then a blank image.
http://phpxref.ftwr.co.uk/buddypress/bp-groups/bp-groups-template.php.source.html#l380
So from this method, I’ve tried passing an item_id in the args array as the group ID and also bypassing this wrapper function by calling “bp_core_fetch_avatar()” but without much luck. It would be nice to throw an error or give some feedback other then an unexpected result.
I would be happy to fetch something from the database if it where there but my best guess without getting too far into the code is that when that fancy jquery cropper thing hands off the file somewhere, it saves it using an MD5 or similar. I’ve spent plenty of hours looking at this by now and if I can do this the right way, I would prefer that then hacking this the wrong way.
Could anyone give me some pointers? I have a group ID within a plugin I’m writing, I just want to have it return the avatar or even better yet a URL or filename. Using a method that echos an image tag in a loop is not very useful to me. I really need a method that returns something, not echo’ed
Thanks!
At line 163 in file bp-core-avatars.php we need to add checking of the file time in order to be sure we are getting the most recent uploaded avatar:
Add after:
`
// Check for array
if ( 0 < count( $avatar_files ) ) {
`
These 2 lines:
`
$avatar_file_time=0;
$avatar_home_path=str_replace($bp->root_domain,ABSPATH,$avatar_folder_url);
`
Modify the foreach loop that follows like this:
‘
// Check for current avatar
foreach( $avatar_files as $key => $value ) {
if ( strpos ( $value, $avatar_size )!== false ) {
if($avatar_file_time< ($t=filemtime($avatar_home_path . '/' . $value))) { //NEW
$avatar_file_time=$t; // THIS IS NEW
$avatar_url = $avatar_folder_url . ‘/’ . $avatar_files[$key];
}
}
}
‘I want to modify bp_core_fetch_avatar and use it for all components in my theme.
Currently, I use ` ‘object’ => $bp->current_component`
This gets correct avatar for all components but I need to use a javascript to do something on the avatars.
So, I want to change all “object” to the same name so that the javascript can recon the elements.My question is— What will happen is all components’ avatar use the same object name? Deos it matter?
Topic: Buddypress Avatars
Hey,
I have a folder of user images(2000+) and I’m looking to use these for the avatars of users in buddypress. I have buddypress sharing the wordpress user table and I have a plugin that picks up the users AD credentials and creates an account for them. I have a database that matches the AD credentials to the the users picture.
Not sure what the best way to go about this would be. Should I create a plugin that overrides the bp_core_fetch_avatar filter?
Any help would be appreciated.
Thanks
getting this message when i access site, i tried doing an update and it didnt work, i screwed up somewhere, this is the message…
Fatal error: Cannot redeclare hide_activity() (previously declared in /home/content/34/7811134/html/thesoldiersnetwork/wp-content/themes/facelook/functions.php:18) in /home/content/34/7811134/html/thesoldiersnetwork/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php on line 23
this is the functions.php currently in that folder….
<?php
define( ‘BP_DTHEME_DISABLE_CUSTOM_HEADER’, true );//
// Remove View links from activity items; most people use ‘Favorites’.
add_filter(‘bp_activity_permalink’, create_function(‘$a’, “return null;”));//
// Hide log-in error message from potential hackers.
add_filter(‘login_errors’, create_function(‘$a’, “return null;”));//
// Hide erm, what..? Useful though!
remove_action(‘wp_head’, ‘wp_generator’);//
// Hide last known logged-on time from non-members.
function hide_activity($content) {
if ( !is_user_logged_in() )
$content=’Log-in to contact this member!’;return $content;
}
add_filter(‘bp_member_last_active’, ‘hide_activity’, $last_activity);
add_filter(‘bp_last_activity’, ‘hide_activity’, $last_activity);// Only allow Send Private Message to friends
function is_my_own_friend( $friend_id = false) {
global $bp;if ( is_site_admin() )
return true;if ( !is_user_logged_in() )
return false;if (!$friend_id) {
$potential_friend_id = $bp->displayed_user->id;
} else {
$potential_friend_id = $friend_id;
}if ( $bp->loggedin_user->id == $potential_friend_id )
return false;if (friends_check_friendship_status($bp->loggedin_user->id, $potential_friend_id) == ‘is_friend’)
return true;return false;
}// Fix in case of empty avatar (gravatar.com fetch removed in core files).
function no_empty_avatar($avatar_link) {
if ( strpos( $avatar_link, “src=”” ) ) {
$avatar_link = str_replace(“src=””, “src='” . BP_AVATAR_DEFAULT . “‘”, $avatar_link );
}
return $avatar_link;
}
add_filter( ‘bp_core_fetch_avatar’, ‘no_empty_avatar’ );?>
help! thanks!
Hi,
I’m running BP 1.2.8 on WP 3.1 and I’ve created an AJAX/jQuery live search that’s a lot like Facebook’s. It works fine — however, no matter what I try, it seems to break every time I try to add avatars to the search results.
Here’s the code I’m trying:
$query_m = "SELECT ID, user_url, display_name FROM {$wpdb->prefix}_users WHERE display_name LIKE '%$keyword%' ORDER BY ID LIMIT 8"; $result_m = mysqli_query($dbc,$query_m); if($result_m){ if(mysqli_affected_rows($dbc)!=0){ echo '<span class="category">Members</span>'; while($row = mysqli_fetch_array($result_m,MYSQLI_ASSOC)){ if(strlen($row) > 35) { $row = substr($row, 0, 35) . "..."; } echo '<span class="searchheading"><a href="'.$row.'">'.$row.'</a></span>'; echo bp_core_fetch_avatar('item_id='.$row ); } }else { echo 'No Results for :"'.$_GET.'" in Members'; } }I’ve also tried calling the $bp global right before bp_core_fetch_avatar, but it doesn’t seem to make a difference.
Any help would be greatly appreciated!
