Results 1 to 10 of 21
-
14th Jan 2012, 03:23 AM #1OPMember
Need to fix MyBB Profile Buddies
Hello guys,
I have installed this plugin in my forum:
http://mods.mybb.com/view/profile-buddies
And I think that I found a "little" bug, take a look here:
Some users are using same avatar... How can I fix that?
I contacted the plugin author but he is not replying me...
PHP Code:<?php
/*
Profile Buddies Plugin for MyBB
Copyright (C) 2010 Sebastian Wunderlich
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if(!defined('IN_MYBB'))
{
die();
}
$plugins->add_hook('member_profile_end','profilebuddies');
$plugins->add_hook('usercp_do_editlists_end','profilebuddies_message');
function profilebuddies_info()
{
return array
(
'name'=>'Profile Buddies',
'description'=>'Enhances the profile of all members with a list of their own buddies.',
'website'=>'http://mods.mybboard.net/view/profile-buddies',
'author'=>'Sebastian Wunderlich',
'version'=>'1.4.1',
'guid'=>'1d7ed75d036a35f3d1f658f89dbca19f',
'compatibility'=>'14*,16*',
'codename'=>'profilebuddies'
);
}
function profilebuddies_activate()
{
global $db;
$info=profilebuddies_info();
$setting_group_array=array
(
'name'=>$info['codename'],
'title'=>$info['name'],
'description'=>'Here you can edit '.$info['name'].' settings.',
'disporder'=>1,
'isdefault'=>0
);
$db->insert_query('settinggroups',$setting_group_array);
$group=$db->insert_id();
$settings=array
(
'profilebuddies_limit'=>array
(
'Limit Buddies',
'Limits the number of buddies that will be displayed in profile.',
'text',
10
),
'profilebuddies_limit_overwrite'=>array
(
'Show All Buddies?',
'Do you want to give your members the possibility to view all buddies without limitation?',
'yesno',
0
),
'profilebuddies_order_by'=>array
(
'Sort Field',
'Select the field that you want buddies to be sorted.',
'select
username=Username
regdate=Registration date
lastvisit=Last visit
postnum=Post count
RAND()=Random',
'username'
),
'profilebuddies_order_dir'=>array
(
'Sort Order',
'Select the order that you want buddies to be sorted.',
'select
ASC=Ascending
DESC=Descending',
'ASC'
),
'profilebuddies_quicklinks'=>array
(
'Show Quick Links?',
'Do you want to display quick links for adding or removing a buddy?',
'yesno',
0
),
'profilebuddies_email'=>array
(
'Email Notification',
'If you active this setting your members will get an email notification when someone adds them to buddy list.',
'onoff',
0
),
'profilebuddies_pm'=>array
(
'Private Message Notification',
'If you active this setting your members will get a private message notification when someone adds them to buddy list.',
'onoff',
0
)
);
$i=1;
foreach($settings as $name=>$sinfo){
$insert_array=array
(
'name'=>$name,
'title'=>$db->escape_string($sinfo[0]),
'description'=>$db->escape_string($sinfo[1]),
'optionscode'=>$db->escape_string($sinfo[2]),
'value'=>$db->escape_string($sinfo[3]),
'gid'=>$group,
'disporder'=>$i,
'isdefault'=>0
);
$db->insert_query('settings',$insert_array);
$i++;
}
rebuild_settings();
require_once MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets('member_profile','#<br />{\$buddylist}#i','',0);
find_replace_templatesets('member_profile','#{\$buddylist}#i','',0);
find_replace_templatesets('member_profile','#{\$modoptions}#i','<br />{$buddylist}{$modoptions}');
}
function profilebuddies_deactivate()
{
global $db;
$info=profilebuddies_info();
$result=$db->simple_select('settinggroups','gid','name="'.$info['codename'].'"',array('limit'=>1));
$group=$db->fetch_array($result);
if(!empty($group['gid']))
{
$db->delete_query('settinggroups','gid="'.$group['gid'].'"');
$db->delete_query('settings','gid="'.$group['gid'].'"');
rebuild_settings();
}
require_once MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets('member_profile','#<br />{\$buddylist}#i','',0);
find_replace_templatesets('member_profile','#{\$buddylist}#i','',0);
}
function profilebuddies_lang()
{
global $lang;
$lang->load('profilebuddies',false,true);
$l['profilebuddies_title']='Amigos de {1}';
$l['profilebuddies_title_all']='Mostrar todos os amigos de {1}';
$l['profilebuddies_no_buddies']='{1} ainda não adicionou nenhum amigo.';
$l['profilebuddies_add_buddy']='Adicione {1} à sua lista de amigos!';
$l['profilebuddies_remove_buddy']='Remova {1} da sua lista de amigos!';
$l['profilebuddies_email_subject']='Alguem adicionou voce a lista de amigos no {1}';
$l['profilebuddies_email_message']='{1},
O membro {2} do {3} adicionou-o a sua lista de amigos. Para ver o perfil de {2}, visite o seguinte link:
{4}/{5}
Obrigado,
Staff {3}
{4}';
$l['profilebuddies_pm_subject']='Eu adicionei-lhe a minha lista de amigos';
$l['profilebuddies_pm_message']='Ola {1},
Eu adicionei-lhe a minha lista de amigos. Clique [url={2}]aqui[/url] para ver o meu perfil.
Com os melhores cumprimentos,
{3}';
foreach($l as $key=>$val)
{
if(!$lang->$key)
{
$lang->$key=$val;
}
}
}
function profilebuddies()
{
global $mybb,$lang,$db,$theme,$memprofile,$buddylist;
profilebuddies_lang();
if(!empty($memprofile['buddylist']))
{
$options=array
(
'order_by'=>$mybb->settings['profilebuddies_order_by'],
'order_dir'=>$mybb->settings['profilebuddies_order_dir']
);
$buddies_full=explode(',',$memprofile['buddylist']);
$buddies_count=count($buddies_full);
if($mybb->settings['profilebuddies_limit_overwrite']==0)
{
$options['limit']=$mybb->settings['profilebuddies_limit'];
}
elseif(intval($mybb->input['buddies'])==1)
{
$options['limit']=$buddies_count;
}
else
{
$options['limit']=$mybb->settings['profilebuddies_limit'];
if($buddies_count>$mybb->settings['profilebuddies_limit'])
{
$showall=$lang->sprintf($lang->profilebuddies_title_all,$buddies_count);
}
}
$query=$db->simple_select('users','uid,username,avatar,avatardimensions,usergroup,displaygroup','uid IN('.$memprofile['buddylist'].')',$options);
list($max_width,$max_height)=explode('x',my_strtolower($mybb->settings['postmaxavatarsize']));
require_once MYBB_ROOT.'inc/functions_image.php';
while($buddy=$db->fetch_array($query))
{
$avatar_default='';
if(!($buddy['avatar']))
{
$buddy['avatar']=$theme['imgdir'].'/default_avatar.gif';
$buddy['avatardimensions']='44|44';
$avatar_default='style="border:1px solid #cccccc;" ';
}
$buddy['avatar']=htmlspecialchars_uni($buddy['avatar']);
$avatar_dimensions=explode('|',$buddy['avatardimensions']);
if($avatar_dimensions[0]&&$avatar_dimensions[1])
{
if($avatar_dimensions[0]>$max_width||$avatar_dimensions[1]>$max_height)
{
$scaled_dimensions=scale_image($avatar_dimensions[0],$avatar_dimensions[1],$max_width,$max_height);
$avatar_width_height='width="'.$scaled_dimensions['width'].'" height="'.$scaled_dimensions['height'].'"';
}
else
{
$avatar_width_height='width="'.$avatar_dimensions[0].'" height="'.$avatar_dimensions[1].'"';
}
$buddy_avatar='<a href="'.get_profile_link($buddy['uid']).'"><img src="'.$buddy['avatar'].'" alt="'.htmlspecialchars_uni($buddy['username']).'" '.$avatar_width_height.' '.$avatar_default.'/></a>';
}
$buddy_name=format_name($buddy['username'],$buddy['usergroup'],$buddy['displaygroup']);
$buddy_link='<span>'.build_profile_link($buddy_name,$buddy['uid']).'</span>';
$buddies.='<li style="display:inline-block;padding:10px;text-align:center;">'.$buddy_avatar.'<br />'.$buddy_link.'</li>';
}
$buddies='<ul style="margin:0;padding:0;">'.$buddies.'</ul>';
}
else
{
$buddies=$lang->sprintf($lang->profilebuddies_no_buddies,htmlspecialchars_uni($memprofile['username']));
}
if($mybb->user['uid']!=0&&$mybb->settings['profilebuddies_quicklinks']==1&&$mybb->user['uid']!=$memprofile['uid'])
{
$user_buddys=explode(',',$mybb->user['buddylist']);
if(in_array($memprofile['uid'],$user_buddys))
{
$addremove='<tr><td class="trow2"><a href="'.$mybb->settings['bburl'].'/usercp.php?action=do_editlists&delete='.$memprofile['uid'].'&my_post_key='.$mybb->post_code.'">'.$lang->sprintf($lang->profilebuddies_remove_buddy,htmlspecialchars_uni($memprofile['username'])).'</a></td></tr>';
}
else
{
$addremove='<tr><td class="trow2"><a href="'.$mybb->settings['bburl'].'/usercp.php?action=do_editlists&add_username='.htmlspecialchars_uni($memprofile['username']).'&my_post_key='.$mybb->post_code.'">'.$lang->sprintf($lang->profilebuddies_add_buddy,htmlspecialchars_uni($memprofile['username'])).'</a></td></tr>';
}
}
$title='<strong>'.$lang->sprintf($lang->profilebuddies_title,htmlspecialchars_uni($memprofile['username'])).'</strong>';
if($showall)
{
$link=get_profile_link($memprofile['uid']);
if(my_strpos($link,'?'))
{
$link=$link.'&buddies=1';
}
else
{
$link=$link.'?buddies=1';
}
$title='<div class="float_right"><a href="'.$link.'">'.$showall.'</a></div><div>'.$title.'</div>';
}
$buddylist='<table border="0" cellspacing="'.$theme['borderwidth'].'" cellpadding="'.$theme['tablespace'].'" class="tborder"><tbody><tr><td class="thead">'.$title.'</td></tr><tr><td class="trow1 smalltext">'.$buddies.'</td></tr>'.$addremove.'</tbody></table>';
}
function profilebuddies_message()
{
global $mybb,$lang,$message,$error_message,$db,$users;
profilebuddies_lang();
if($mybb->settings['profilebuddies_email']==1||$mybb->settings['profilebuddies_pm']==1)
{
if($message==$lang->users_added_to_buddy_list&&empty($error_message))
{
require_once MYBB_ROOT.'inc/datahandlers/pm.php';
foreach($users as $user)
{
$query=$db->simple_select('users','uid,email','username="'.$user.'"');
$result=$db->fetch_array($query);
if($mybb->settings['profilebuddies_email']==1)
{
$subject=$lang->sprintf($lang->profilebuddies_email_subject,$mybb->settings['bbname']);
$body=$lang->sprintf($lang->profilebuddies_email_message,$user,$mybb->user['username'],$mybb->settings['bbname'],$mybb->settings['bburl'],get_profile_link($mybb->user['uid']));
my_mail($result['email'],$subject,$body);
}
if($mybb->settings['profilebuddies_pm']==1)
{
$subject=$lang->sprintf($lang->profilebuddies_pm_subject);
$body=$lang->sprintf($lang->profilebuddies_pm_message,$user,$mybb->settings['bburl'].'/'.htmlspecialchars_decode(get_profile_link($mybb->user['uid'])),$mybb->user['username']);
$pmhandler=new PMDataHandler();
$pm=array(
'subject'=>$subject,
'message'=>$body,
'toid'=>array($result['uid']),
'options'=>array
(
'savecopy'=>0
),
'fromid'=>$mybb->user['uid']
);
$pmhandler->admin_override=true;
$pmhandler->set_data($pm);
$pmhandler->validate_pm();
$pmhandler->insert_pm();
}
}
}
}
}
?>
PHP Code:$avatar_default='';
PHP Code:$buddy_avatar=$avatar_default='';
Note: The avatars that appeared was the ones that the avatar was uploaded to the server... the other members avatars are remote urls.
Any suggestion? Help pleaseDivvy Reviewed by Divvy on . Need to fix MyBB Profile Buddies Hello guys, I have installed this plugin in my forum: http://mods.mybb.com/view/profile-buddies And I think that I found a "little" bug, take a look here: http://i.imgur.com/pHKob.png Some users are using same avatar... How can I fix that? I contacted the plugin author but he is not replying me... Rating: 5
-
14th Jan 2012, 07:34 PM #2OPMember
Please, someone? Any ideas?
-
15th Jan 2012, 04:11 AM #3Member
Hello
The reason that the avatars are all the same is because thats what the code its responding to. You have it set to the default avatar.
Regards, Michael
-
15th Jan 2012, 09:36 AM #4OPMember
Any code suggestion?
-
15th Jan 2012, 11:26 AM #5MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.comadd this line of code
PHP Code:var_dump($buddy['avatar']);
PHP Code:if(!($buddy['avatar']))
JokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
-
15th Jan 2012, 11:43 AM #6OPMember
Thank you jokerhacker, for trying to help me again
Here goes the result that appeared in the top of the page:
string(51) "./uploads/avatars/avatar_29.jpg?dateline=1326068710" string(61) "http://graph.facebook.com/100003128149855/picture?type=normal" string(61) "http://graph.facebook.com/100000805771683/picture?type=normal" string(56) "http://graph.facebook.com/1824072431/picture?type=normal" string(61) "http://graph.facebook.com/100000621611020/picture?type=normal" string(61) "http://graph.facebook.com/100000482021193/picture?type=normal" string(61) "http://graph.facebook.com/100000237822357/picture?type=normal" string(34) "./images/avatars/defaultavatar.png" string(61) "http://graph.facebook.com/100001257951838/picture?type=normal" string(96) "http://profile.ak.fbcdn.net/hprofile-ak-snc4/23141_100000886113496_464_s.jpg?dateline=132636682 0"
-
15th Jan 2012, 02:07 PM #7MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.comgood, now same var_dump but this time with $buddy['avatardimensions']
i think i partially understood the problem, give me results of the modification above and i'll confirm thatJokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
-
15th Jan 2012, 03:06 PM #8OPMember
Done:
string(6) "71|100" string(0) "" string(0) "" string(0) "" string(0) "" string(0) "" string(0) "" string(0) "" string(0) "" string(6) "100|87"
-
15th Jan 2012, 04:22 PM #9MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.combefore
PHP Code:$buddy['avatar']=htmlspecialchars_uni($buddy['avatar']);
PHP Code:if($buddy['avatardimensions'] == '') $buddy['avatardimensions'] = '100|100';
JokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
-
15th Jan 2012, 05:28 PM #10OPMember
It works Thank you my friend, for the 2nd time you was my lifesaver
Btw, I got the exactly same issue in the cometchat that I have in the forum, take a look:
Can you please check If this code helps to find the issue and apply the same fix?
/public_html/cometchat/integration.php file:
PHP Code:<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ADVANCED */
define('SET_SESSION_NAME',''); // Session name
define('DO_NOT_START_SESSION','0'); // Set to 1 if you have already started the session
define('DO_NOT_DESTROY_SESSION','0'); // Set to 1 if you do not want to destroy session on logout
define('SWITCH_ENABLED','0');
define('INCLUDE_JQUERY','1');
define('FORCE_MAGIC_QUOTES','0');
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* DATABASE */
include_once(dirname(dirname(__FILE__))).'/inc/config.php';
define('DB_SERVER', $config['database']['hostname'] );
define('DB_PORT', '3306' );
define('DB_USERNAME', $config['database']['username'] );
define('DB_PASSWORD', $config['database']['password'] );
define('DB_NAME', $config['database']['database'] );
define('TABLE_PREFIX', $config['database']['table_prefix'] );
define('DB_USERTABLE', 'users' );
define('DB_USERTABLE_NAME', 'username' );
define('DB_USERTABLE_USERID', 'uid' );
define('DB_USERTABLE_LASTACTIVITY', 'lastactive' );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* FUNCTIONS */
function getUserID() {
$userid = 0;
if (!empty($_COOKIE['mybbuser'])) {
$udata = explode('_',$_COOKIE['mybbuser']);
$userid = $udata[0];
}
return $userid;
}
function getFriendsList($userid,$time) {
$query = mysql_query("select buddylist from ".TABLE_PREFIX.DB_USERTABLE." where uid = '".mysql_real_escape_string($userid)."'");
$result = mysql_fetch_array($query);
$sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity,".TABLE_PREFIX.DB_USERTABLE.".avatar avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.'.'.DB_USERTABLE_USERID." IN (".$result[0].") order by username asc");
if (defined('DISPLAY_ALL_USERS') && DISPLAY_ALL_USERS == 1) {
$sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".avatar avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." <> '".mysql_real_escape_string($userid)."' and ('".mysql_real_escape_string($time)."'-".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." < '".((ONLINE_TIMEOUT)*2)."') and (cometchat_status.status IS NULL OR cometchat_status.status <> 'invisible' OR cometchat_status.status <> 'offline') order by username asc");
}
return $sql;
}
function getUserDetails($userid) {
$sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, ".TABLE_PREFIX.DB_USERTABLE.".avatar avatar, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function updateLastActivity($userid) {
$sql = ("update `".TABLE_PREFIX.DB_USERTABLE."` set ".DB_USERTABLE_LASTACTIVITY." = '".getTimeStamp()."' where ".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function getUserStatus($userid) {
$sql = ("select cometchat_status.message, cometchat_status.status from cometchat_status where userid = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function getLink($link) {
return BASE_URL.'../member.php?action=profile&uid='.$link;
}
function getAvatar($image) {
if(!empty($image)) {
return BASE_URL.'.'.$image;
} else {
return BASE_URL.'../images/default_avatar.gif';
}
}
function getTimeStamp() {
return time();
}
function processTime($time) {
return $time;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* HOOKS */
function hooks_statusupdate($userid,$statusmessage) {
}
function hooks_forcefriends() {
}
function hooks_activityupdate($userid,$status) {
}
function hooks_message($userid,$unsanitizedmessage) {
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* LICENSE */
include_once(dirname(__FILE__).'/license.php');
$x="\x62a\x73\x656\x34\x5fd\x65c\157\144\x65";
eval($x('JHI9ZXhwbG9kZSgnLScsJGxpY2Vuc2VrZXkpOyRwXz0wO2lmKCFlbXB0eSgkclsyXSkpJHBfPWludHZhbChwcmVnX3JlcGxhY2UoIi9bXjAtOV0vIiwnJywkclsyXSkpOw'));
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] Profile Link Building - 120+ PR 4 - PR 9 Profile Links - Grab It Now
By Faizann20 in forum ServicesReplies: 1Last Post: 10th Sep 2012, 11:55 AM -
Hi,Buddies
By BobJoy in forum IntroductionsReplies: 1Last Post: 16th Jan 2012, 02:34 PM -
[MyBB] Adding nofollow to profile links
By Pirate in forum Web Application/Script SupportReplies: 1Last Post: 27th Mar 2011, 09:18 AM -
hello buddies
By fonky in forum IntroductionsReplies: 2Last Post: 13th Feb 2011, 03:06 PM -
From Profile to Edit User Profile Problem
By pspuser007 in forum vBulletinReplies: 4Last Post: 24th Mar 2009, 03:18 PM
themaRegister - register to forums...
Version 3.39 released. Open older version (or...