Our forums have been retired and are no longer being actively maintained or monitored. If you have a query, feel free to email us at [email protected]

Ultimate member wordpress plugin integration

edited July 2016 in CometChat PHP
HI, I have paid/full version of Comet chat (video, screen sharing etc) and Ultimate member. Comet chat is working fine but it shows gravatar images as user image. I am using ultimate member wordpress plugin. I want it to show user's profile image (uploaded via ultimate member) in comet chat page. Is it possible via some setting in comet chat? or do we have any hack available to achieve this? Thank you in advance!

Comments

  • Hello Swapnil, Please replace getAvatar() function in /cometchat/integration.php file with following: function getAvatar($data) { $cc_url = (defined('CC_SITE_URL') ? CC_SITE_URL : BASE_URL); if(!empty($data)) { $data = explode('|',$data); $id = $data[0]; if (is_dir(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'avatars' .DIRECTORY_SEPARATOR. $id)) { $files = ""; if ($handle = opendir(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'avatars' .DIRECTORY_SEPARATOR. $id)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(substr($file, -11, 7) == "bpthumb" ) { $files .= $file; } } } closedir($handle); } if (file_exists(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'avatars' .DIRECTORY_SEPARATOR. $id .DIRECTORY_SEPARATOR. $files)) { $cc_url = (defined('CC_SITE_URL') ? CC_SITE_URL : BASE_URL); return $cc_url.'../wp-content/uploads/avatars/'.$id.'/'.$files; } }elseif(is_dir(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'ultimatemember' .DIRECTORY_SEPARATOR. $id)){ $sql = ("select meta_value from ".TABLE_PREFIX."usermeta where user_id = ".mysqli_real_escape_string($GLOBALS['dbh'],$id)." and meta_key = 'profile_photo'"); $result = mysqli_query($GLOBALS['dbh'],$sql); $row = mysqli_fetch_assoc($result); $img = $row['meta_value']; $img = explode(".", $img); $ext = $img[1]; return $cc_url."../wp-content/uploads/ultimatemember/".$id."/profile_photo-190.".$ext; }elseif(!empty($data[2])){ return $data[2]; }else{ return '//www.gravatar.com/avatar/'.md5($data[1]).'?d=wavatar&s=80'; } } else { return BASE_URL.'images/noavatar.png'; } } Regards, CometChat
  • Hi, which integrates best with comet chat. Ultimate member or buddypress?? I want to set up friend to friend chat. Thanks
Sign In or Register to comment.