So my idea here is, if you have a pending friend request with someone, and you mouse over their avatar, you should get an "accept friendship" instead of a "befriend" button.
I have the following mod that accomplishes this.
add the following langauge key
_acceptFriendship = Accept Frendship
templates/base/scripts/BxBaseProfileView.php
around line 440 you'll find
$p_arr['cpt_fave'] = _t('_Fave');
$p_arr['cpt_befriend'] = _t('_Befriend');
ADD THIS
###
#SteveSoft
#05-15-2012
#
$p_arr['cpt_acceptfriend'] = _t('_acceptFriendship');
#
around line 468 find
$p_arr['cpt_fave'] = '';
$p_arr['cpt_befriend'] = '';
ADD THIS
##
#SteveSoft
#05-15-2012
#
$p_arr['cpt_acceptfriend'] = '';
#
in the file short_profile_info.php
around line 54 find
$aProfileInfo['cpt_fave'] = _t('_Fave');
$aProfileInfo['cpt_befriend'] = _t('_Befriend');
ADD THIS
###
#SteveSoft
#05-15-2012
#
$aProfileInfo['cpt_acceptfriend'] = _t('_acceptFriendship');
#
around line 81 find
$aProfileInfo['cpt_fave'] = '';
$aProfileInfo['cpt_befriend'] = '';
ADD THIS
###
#SteveSoft
#05-15-2012
#
$aProfileInfo['cpt_acceptfriend'] = '';
#
in inc/utils.inc.php
around line 134 find
$cnt = db_arr("SELECT SUM(`Check`) AS 'cnt' FROM `sys_friend_list` WHERE `ID`='{$id1}' AND `Profile`='{$id2}' OR `ID`='{$id2}' AND `Profile`='{$id1}'");
return ($cnt['cnt'] > 0 ? true : false);
}
ADD THIS
###
#SteveSoft
#05-15-2012
#
/*
* check for friend request
*/
function is_friendRequest($id1, $id2) {
$id1 = (int)$id1;
$id2 = (int)$id2;
if ($id1 == 0 || $id2 == 0)
return;
$aCheck = db_arr("SELECT COUNT(*) as count FROM `sys_friend_list` WHERE `ID` = '{$id1}' AND `Profile`='{$id2}' AND `Check` = '0'");
return ($aCheck['count'] > 0 ? true : false );
}
finally... in phpmyadmin or your favorite database editor run this query
SELECT *
FROM `sys_objects_actions`
WHERE `Caption`
REGEXP 'friend'
LIMIT 0 , 300
you will find a record with a field that says {cpt_befreind}
edit that and look at the field Eval
ONLY edit the 1st line! Leave the rest alone!
if ({ID} == {member_id} OR is_friends({ID} , {member_id}) ) return;
replace it with this
if ({ID} == {member_id} OR is_friends({ID} , {member_id}) OR is_friendRequest({ID} , {member_id})) return;
then run this query replacing YOURDATABASE with yourdatabasename
INSERT INTO `YOURDATABASE`.`sys_objects_actions` (`ID`, `Caption`, `Icon`, `Url`, `Script`, `Eval`, `Order`, `Type`, `bDisplayInSubMenuHeader`) VALUES (NULL, '{cpt_acceptfriend}', 'action_friends.png', '', '{evalResult}', 'if ({ID} == {member_id} OR !is_friendRequest({ID} , {member_id})) return;
return "$.post(''list_pop.php?action=friend'', { ID: ''{ID}'' }, function(sData){ $(''#ajaxy_popup_result_div_{ID}'').html(sData) } );
$(''#short_profile_info'').fadeOut(5000, function(){location.reload()});
return false;";', '1', 'Profile', '0');
You will now have a button called "Accept Friendship" only when you mouse over members that have requested your friendship.
You will also see the "Accept Friendship" when you view their profile, instead of the befriend button as well.
Also, if you have a pending friend request you will NOT get the befriend button
The only thing I don't like right now is if you are the requester, it still shows the befriend button. I will work on that on my day off.
As always, BACKUP your modified files!
backup your database before attempting this mod!