Друзья

Друзья 1.0.0

Нет прав для скачивания
Совместимость
не проверялся на совместимость
Изменения в БД
требуются
Автор
Pherum
Общественное достояние
да
Описание: добавляет возможность пользователям указывать других пользователей как друзей.

Возможности:
  • Добавление друзей
  • Удаление друзей
  • Работа на AJAX без перезагрузки страницы
Инструкция по установке
PHP:
В БД добавить:

Код:
CREATE TABLE IF NOT EXISTS `bb_friends` (
  `user_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `friends_id` mediumint(8) unsigned NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

и

Код:
INSERT INTO `bb_friends` VALUES (`user_id`, `friends_id`);

Закинуть файл:

friends.php (в папку /ajax)
***************Открыть ajax.php*****************

Найти:
'change_tor_status' => array('user'),

После вставить:
'friends'           => array('user'),

Найти:
function index_data()
    {
        require(AJAX_DIR .'index_data.php');
    }
  
После вставить:
function friends()
    {
        require(AJAX_DIR .'friends.php');
    }
  


***************Открыть usercp_viewprofile.php*****************
Найти:
$template->assign_vars(array(
        'EDITABLE_TPLS'    => true,
        'AJAX_USER_OPT'    => $ajax_user_opt,
        'EMAIL_ADDRESS'    => htmlCHR($profiledata['user_email']),
    ));
}

После вставить:
if($bb_cfg['friends'])
{
    $count = DB()->fetch_row("SELECT COUNT(friends_id) AS friends FROM bb_friends WHERE user_id = ". $profiledata['user_id']);
    if($profile_user_id) $friends = DB()->fetch_row("SELECT * FROM bb_friends WHERE user_id = ". $userdata['user_id'] ." AND friends_id = ". $profiledata['user_id']);

    $template->assign_vars(array(
        'FRIENDS'   => $count['friends'],
        'MY_FRIEND' => $friends,
    ));
}




***************Открыть usercp_viewprofile.tpl*****************


Найти:
ajax.callback.index_data = function(data) {
    $('#traf-stats-tbl').html(data.html);
    $('#bt_user_ratio').html(data.user_ratio);
    $('#traf-stats-span').hide();
    $('#traf-stats-tbl').show();
    $('#bt_user_ratio').show();
}
</script>
<!-- ENDIF -->

После вставить:
<script type="text/javascript">
ajax.friends = function(mode) {
    ajax.exec({
        action  : 'friends',
        mode    : mode,
        user_id : {PROFILE_USER_ID}
    });
}
ajax.callback.friends = function(data) {
    $('#friends').html(data.html);
}
</script>

  
Найти:
<tr id="ratio-expl" style="display: none;">
        <td colspan="2" class="med tCenter">
        ( {L_UPLOADED} <b class="seedmed">{UP_TOTAL}</b> + {L_RELEASED} <b class="seedmed">{RELEASED}</b> + {L_BONUS} <b class="seedmed">{UP_BONUS}</b> ) / {L_DOWNLOADED} <b class="leechmed">{DOWN_TOTAL}</b>
        </td>
</tr>

После вставить:
<!-- IF $bb_cfg['friends'] -->
    <tr>
        <th class="vBottom"></th>
        <td>
        <b><a class="gen" href="#" onclick="ajax.friends('list'); return false;"></a></b>
        <span id="friends"></span>
        </td>              
    </tr>          
<!-- ENDIF -->

В нужное для Вас место ставим вывод количества друзей:
<tr>
        <th>Друзей:</th>
        <td id="u_thanks" class="gen">
        <b>{FRIENDS}</b>
        </td>
</tr>

В нужное для Вас место ставим кнопки для добавления в друзья:

<a class="med" href="#" onclick="ajax.friends('list'); return false;"><input type="submit" value="Список друзей" class="main gen" /></a>
        <!-- IF MY_FRIEND -->
<a class="med" href="#" onclick="ajax.friends('del'); return false;"><input type="submit" value="Удалить из друзей" class="main gen" /></a>
        <!-- ELSE -->
<a class="med" href="#" onclick="ajax.friends('add'); return false;"><input type="submit" value="Добавить в друзья" class="main gen" /></a>
         <!-- ENDIF -->
       
         В main.css
       
       
.xenOverlay {  display: none; width: 690px; z-index: 10000; }
.xenOverlay > .section, .xenOverlay > .sectionMain {  background: transparent; margin: 0px; }
.xenOverlay .section, .xenOverlay .sectionMain { border: 10px solid rgba(64, 64, 64, 0.506); border-radius: 5px;
  box-shadow: 0px 15px 20px rgba(0, 0, 0, 0.506);
  padding: 0px;
}
.xenOverlay .section .heading, .xenOverlay .sectionMain .heading {  border-radius: 0px; margin-bottom: 0px; }
.heading { color: #F0F7FC; margin: 0px; }
.heading, .xenForm .formHeader {
  background-color: #000000;
  color: #EFEFEF;
  font-size: 11pt;
  font-weight: 700;
  margin-bottom: 3px;
  padding: 5px 10px;
}
.xenOverlay .section .subHeading, .xenOverlay .sectionMain .subHeading { margin-top: 0px; }
.subHeading {
  background: url("http://tracker/templates/default/images/category-23px-light.png") 50% 0% repeat-x #EAEAEA;
  border-bottom: 1px solid #E4E4E4;
  border-top: 1px solid #E4E4E4;
  color: #6D3F03;
  font-size: 11px;
  margin: 3px auto 0px;
  padding: 5px 10px;
}
.pairsInline dl, .pairsInline dt, .pairsInline dd { display: inline; }
.pairs dt, .pairsInline dt, .pairsJustified dt { color: #969696; }
.pairsInline dl, .pairsInline dt, .pairsInline dd { display: inline; }
dl, dt, dd, ol, li { margin: 0px; padding: 0px;}
.subHeading a { color: #6D3F03; font-size: 11px; line-height: 1.27; }
.xenOverlay .overlayScroll { max-height: 400px; overflow: auto; }
.memberListItem { overflow: hidden; }
.primaryContent { background-color: #EFEFEF; border-bottom: 1px solid #E4E4E4; padding: 10px; }
.memberListItem .avatars, .memberListItem .icon { float: left; }
.avatars .img {
  background-position: 2px 2px;
  background-repeat: no-repeat;
  display: block;
  overflow: hidden;
  text-indent: 1000px;
  white-space: nowrap;
  word-wrap: normal;
}
.avatars .img.s {  height: 48px; width: 48px; }
.memberListItem .extra { float: right; font-size: 11px; }
.memberListItem .member { margin-left: 65px; }
.memberListItem h3.username { font-weight: 700; margin-bottom: 3px; }
.memberListItem .userInfo { font-size: 11px; margin-bottom: 3px; }
.dimmed, a.dimmed, .dimmed a {color: #646464; }
.sectionFooter { overflow: hidden; }
.sectionFooter {
  background-color: #000000;
  color: #000000;
  font-size: 11px;
  line-height: 16px;
  padding: 4px 10px;
}
.xenOverlay .overlayOnly { display: block !important; }
.xenOverlay .sectionFooter .button, .xenOverlay .sectionFooter .buttonContainer { float: right; }
.button {
  cursor: pointer;
  display: inline-block;
  font-style: normal;
  line-height: 13px;
}
       
       
         В config.php
       
         $bb_cfg['friends'] = true;
  • Снимок.PNG
    Снимок.PNG
    119.4 KB · Просмотры: 182
  • Мне нравится
Реакции: boko и zxc
Автор
Exile
Скачивания
60
Просмотры
143
Первый выпуск
Обновление
Оценка
5.00 звёзд 1 оценок

Другие ресурсы пользователя Exile

Сверху