Просмотр юзером лайков, которые он же и выдал. Ну типа закладок как-бы... - Автор: madv1ch
Работает функция так же как и обычный просмотр симпатий, но результат выдает другой.
Начнем же, мучить файл \engine\bullet_energy\action\site\user.phpНайти
case 'like':
Выше добавить
case 'user_like':
return $this->_user_like() ;
break;
Найти
private function _like()
Выше добавить
private function _user_like()
{
$option['joinAprove'] = parent::$helper->ckeckModulesConfig('be_moder_moder_view') ? '' : "AND post.message_approve = 1" ;
$row = parent::$db->super_query("SELECT count( * ) AS count FROM " . PREFIX . "_be_thanks AS thanks WHERE thanks.thanks_id_user = {$this->user['user_id']}") ;
$pag = parent::$helper->setPaginator(array(
'unreadCount' => $row['count'],
'name_user' => $this->user['name'],
'linck' => parent::$link->user_Like($this->user['name']))) ;
parent::$db->query("SELECT thanks.thanks_date, post.message_text, post.id AS post_id, post.id_topic, user.user_id, user.name,user.foto, topic.title FROM " . PREFIX . "_be_thanks AS thanks LEFT JOIN " . PREFIX . "_be_message AS post ON thanks.thanks_msg_id = post.id LEFT JOIN " . PREFIX . "_users AS user ON thanks.thanks_id_user = user.user_id LEFT JOIN " . PREFIX . "_be_topic AS topic ON topic.id = post.id_topic WHERE thanks.thanks_id_user = {$this->user['user_id']} {$option['joinAprove']} LIMIT {$pag['start']},{$pag['nums']}") ;
if(!parent::$db->num_rows()) {
if(parent::$ajax) {
return parent::$helper->getJson(array('param' => 0, 'data' => parent::$bullet_energy_lang['like_8'])) ;
} else {
return parent::$helper->setTplMainBlock($this->setTplViewFullTopic(array('message' => parent::$helper->setTplError(parent::$bullet_energy_lang['user_6'], parent::$bullet_energy_lang['like_8']))), array("Сообщения понравившиеся мне"), array('spedbar' => array('titlAction' => "Сообщения понравившиеся мне"))) ;
}
} else {
while ($row = parent::$db->get_row()) {
parent::$tpl->load_template('user.tpl') ;
parent::$tpl->set_block("'\\[msg\\](.*?)\\[/msg\\]'si", "") ;
parent::$tpl->set_block("'\\[like\\](.*?)\\[/like\\]'si", "") ;
parent::$tpl->set_block("'\\[topic\\](.*?)\\[/topic\\]'si", "") ;
parent::$tpl->set('[user_Like]', '') ;
parent::$tpl->set('[/user_Like]', '') ;
parent::$tpl->set('{userLiked}', $row['name']) ;
parent::$tpl->set('[popupUserLikedCard]', parent::$link->card_user(array($row['name'], $row['user_id']))) ;
parent::$tpl->set('[/popupUserLikedCard]', '</a>') ;
parent::$tpl->set('[profileUserLiked]', parent::$link->linckUserSiteProfile($row['name'])) ;
parent::$tpl->set('[/profileUserLiked]', '</a>') ;
parent::$tpl->set('{titleTopic}', stripslashes($row['title'])) ;
parent::$tpl->set('[linckTopic]', parent::$link->topic_linck($row['id_topic'], totranslit($row['title'], true, true))) ;
parent::$tpl->set('[/linckTopic]', '</a>') ;
parent::$tpl->set('{fotoUserLiked}', parent::$helper->isAvatarUser($row['foto'])) ;
parent::$tpl->set('{likedDate}', parent::$helper->setDate($row['thanks_date'])) ;
if(parent::$helper->ckeckModulesConfig('be_access_hide')) {
$row['message_text'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['message_text'])) ;
} else {
$row['message_text'] = preg_replace("#\[hide\](.+?)\[/hide\]#ims", "<div class=\"HideNo\">" . parent::$bullet_energy_lang['msg_11'] . "</div>", $row['message_text']) ;
}
parent::$tpl->set('[linckMessage]', '<a href="' . parent::$link->postLinck($row['id_topic'], $row['post_id'], totranslit($row['title'], true, true)) . '">') ;
parent::$tpl->set('[/linckMessage]', '</a>') ; parent::$tpl->set('{messageText}', $row['message_text']) ;
parent::$tpl->compile('user') ;
}
return parent::$helper->setTplMainBlock($this->setTplViewFullTopic(array('message' => parent::$tpl->result['user'], 'paginator' => $pag['paginator'])), array("Сообщения понравившиеся мне"), array('spedbar' => array('titlAction' => "Сообщения понравившиеся мне"))) ;
}
}
Найти
parent::$tpl->set('[like]', '') ;
Выше добавить
parent::$tpl->set_block("'\\[user_Like\\](.*?)\\[/user_Like\\]'si", "") ;
Найти
parent::$tpl->set('[topic]', '') ;
Выше добавить
parent::$tpl->set_block("'\\[user_Like\\](.*?)\\[/user_Like\\]'si", "") ;
Найти
parent::$tpl->set('[msg]', '') ;
Выше добавить
parent::$tpl->set_block("'\\[user_Like\\](.*?)\\[/user_Like\\]'si", "") ;
Теперь открываем \engine\bullet_energy\classes\link.class.phpНайти
public function userLike($userName = '')
Выше добавить
public function user_Like($userName = '')
{
return $this->cpu ? "{$this->root}user/" . urlencode($userName) . "/user_like{$this->endLinckSymbol}" : "{$this->root}?do={$this->router['main']}&action=like_user&name=" . urlencode($userName) ;
}
Так, далее открываем .htaccess в корне сайта и после RewriteEngine On добавляемRewriteRule ^user/([^/]*)/user_like(/?)+$ index.php?do=forum&action=user&name=$1¶m=user_like [L]
RewriteRule ^user/([^/]*)/user_like/page-([0-9]+)(/?)+$ index.php?do=forum&action=user&name=$1&page=$2¶m=user_like [L]
Открываем \www\templates\ЧТО_ТО_ТАМ\bullet_energy\user.tpl и в самый конец добавить[user_Like]
<li class="msg userPost">
<div class="avatarBoxPostAction">[popupUserLikedCard][img]{fotoUserLiked}[/img][/popupUserLikedCard]</div>
<div class="contentPostUser">
<h3>Понравилось сообщение в теме [linckMessage]{titleTopic}[/linckMessage].</h3>
<div class="infoPostMsgUser"><span title="Выразил симпатию {likedDate}">{likedDate}</span></div>
<div class="postUserBox">{messageText}</div>
</div>
</li>
[/user_Like]
Открываем \engine\modules\profile.php находим$tpl->set( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );
Ниже добавить
if($is_logged and ($member_id['user_id'] == $row['user_id'])) {
$tpl->set('[user_Like]', '<a href="' . $apiBullet->link->user_Like($row['name']) . '">') ;
$tpl->set('[/user_Like]', '</a>') ;
} else {
$tpl->set_block("'\\[user_Like\\](.*?)\\[/user_Like\\]'si", "") ;
}
Теперь в userinfo.tpl шаблона вставляем что-то вроде этого[user_Like]Сообщения понравившиеся мне[/user_Like]
В файле: actions/site/search.phpНайти:
parent::$tpl->set_block("'\\[like\\](.*?)\\[
;/like\\]'si", "") ;
Заменить на:
parent::$tpl->set_block("'\\[like\\](.*?)\\[
;/like\\]'si", "") ;
// fix rdn team
parent::$tpl->set_block("'\\[user_Like\\](.*?)\
[/user_Like\\]'si", "") ;
//
В файле site.lng найти
'like_8' => '',
И присвоить ей значение:
'like_8' => 'Вы ещё ничего не помечали.',
Строка "Полученные пользователем симпатии" меняется по такому же принципу, меняем "like_7", на "like_9", задаём нужный текст.
Для отображения понравившихся в навбаре:В файле: /engine/bullet_energy/helper/primary.phpНайти:
$navigate .= '<li><a href="' . parent::$link->watchedLinck() . '">' . parent::$bullet_energy_lang['topicVis'] . '</a></li>' ;
Добавить ниже:
$navigate .= '<li><a href="/user/' . urlencode(parent::$member_id['name']) . '/user_like/">Понравившиеся</a></li>' ;
Вот и всё. Вроде ничего не забыл, кажется...
Посторонние ссылку не будут видеть в профиле.
, , нравится это сообщение.
Сообщение отредактировал 4 сентября 2017 - 07:50