Help
Ask questions about how to do or fix things in Arrowchat
User avatar
fja3omega
Free
 
Posts: 3
Joined: 05 Nov 2012, 11:18

 

by fja3omega 14 Nov 2012, 06:40

How do I integrate the wordpress avatar into the arrowchat.
I know that the I have to work with arrowchat>includes>integration.php and arrowchat>external.php
But everytime I edit something in the code arrowchat stops working.
Can someone point me in the right direction of editing the code.

I have been trying to edit this function but it doesnt seem to work

function get_avatar($image, $user_id)
{
return "http://www.gravatar.com/avatar/" . md5($image) . "?d=identicon";
}
User avatar
Jason
Customer
 
Posts: 2356
Joined: 12 Dec 2009, 16:06

 

by Jason 14 Nov 2012, 10:52

You only need to edit the get_avatar function and it depends what plugin your using and where the avatars are stored.
User avatar
fja3omega
Free
 
Posts: 3
Joined: 05 Nov 2012, 11:18

 

by fja3omega 15 Nov 2012, 08:02

okay
I edited the code for get_avatar function
function get_avatar($image, $user_id)
{
/* return "http://www.gravatar.com/avatar/" . md5($image) . "?d=identicon"; */
$avatar_file = "";
$avatar_avatar = "http://mysite.com";
$avatar_fsub = "";
$avatar_file = glob("../wp-content/uploads/avatars/" . $user_id . "/*bpthumb.jpg");
$avatar_fvalue = $avatar_file['0'];
$avatar_fsub = substr($avatar_fvalue, 3);
if($avatar_fsub==""){
$avatar_avatar .= $avatar_fvalue;
}
else {
$avatar_avatar .= $avatar_fsub;
}
return $avatar_avatar;
}
The id of the main user is found and the image shows up
The only problem I have is that its not getting the other chat users id
Can someone get me a heads up how to get it
User avatar
fja3omega
Free
 
Posts: 3
Joined: 05 Nov 2012, 11:18

 

by fja3omega 15 Nov 2012, 10:00

im an idiot... either that or im blind...
i just found a buddypress code in the arrowchat>includes>functions>integrations for buddypress...
function get_avatar($image, $user_id)
{
global $base_url;

$avatar_folder_dir = $_SERVER{'DOCUMENT_ROOT'} . $base_url . "../wp-content/uploads/avatars/" . $user_id . "/";

$avatar_name = ('full' == $type) ? '-bpfull' : '-bpthumb';
$legacy_user_avatar_name = ('full' == $type) ? '-avatar2' : '-avatar1';
$legacy_group_avatar_name = ('full' == $type) ? '-groupavatar-full' : '-groupavatar-thumb';

if (file_exists($avatar_folder_dir))
{
if ($av_dir = opendir($avatar_folder_dir))
{
while (false !== ($avatar_file = readdir($av_dir)))
{
if (preg_match("/{$avatar_name}/", $avatar_file ) OR preg_match("/{$legacy_user_avatar_name}/", $avatar_file) OR preg_match("/{$legacy_group_avatar_name}/", $avatar_file))
{
$avatar_url = $avatar_folder_url . '/' . $avatar_file;
}
}
}

closedir($av_dir);

if ($avatar_url)
{
return $base_url . "../wp-content/uploads/avatars/" . $user_id . "/" . $avatar_url;
}
else
{
return "http://www.gravatar.com/avatar/" . md5($image) . "?d=wavatar&s=50";
}
}
}
User avatar
Staff Bot
ArrowChat Team
 
Posts: 8996
Joined: 07 Nov 2012, 13:41

 

by Staff Bot 16 Dec 2014, 00:26

[b]This thread has been locked because the last post is greater than six months old. There is a good chance that the information in this thread is outdated. Please open a new topic if you wish to discuss this further.[/b]