Бандерас
Пользователь
Используйте этот мод: Социальные сети в профиле
PHP:
##############################################################
## MOD Title: Телеграмм / Telegram
## MOD Author: http://tas-ix.net
## MOD Description: Мод даёт возможность указать аккаунт Telegram + выводит в топик и профиль.
## Installation Level: Easy
## Installation Time: ~2 Minutes
## MOD Compatibility: TorrentPier II
## Files To Edit:
## viewtopic.php
## includes/ucp/register.php
## includes/ucp/viewprofile.php
## ru/main.php
## templates/default/usercp_register.tpl
## templates/default/usercp_viewprofile.tpl
## templates/default/viewtopic.tpl
##
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `bb_users` ADD `user_telegr` VARCHAR( 100 ) NOT NULL DEFAULT '';
#
#-----[ OPEN ]------------------------------------------
#
ajax/edit_user_profile.php
#
#-----[ FIND ]------------------------------------------
#
case 'user_email':
require_once(INC_DIR .'functions_validate.php');
$value = htmlCHR($value);
if ($err = validate_email($value))
{
$this->ajax_die($err);
}
$this->response['new_value'] = $this->request['value'];
break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
case 'user_telegr':
if ($value && !preg_match("#^[a-zA-Z0-9_]{5,25}$#", $value))
{
$this->ajax_die($lang['TELEGR_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ] (два раза)------------------------------------------
#
, u.user_from
#
#-----[ AFTER, ADD ] ------------------------------------------
#
, u.user_telegr
#
#-----[ FIND ]------------------------------------------
#
$poster_from = ($postrow[$i]['user_from'] && $poster_id != GUEST_UID ) ? $postrow[$i]['user_from'] : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$poster_telegr = ($postrow[$i]['user_telegr'] != GUEST_UID) ? $postrow[$i]['user_telegr'] : '';
#
#-----[ FIND ]------------------------------------------
#
'EDITED_MESSAGE' => $l_edited_by,
#
#-----[ AFTER ADD ]------------------------------------------
#
'POSTER_TELEGR' => $poster_telegr,
#
#-----[ OPEN ]------------------------------------------
#
includes/ucp/register.php
#
#-----[ FIND ]------------------------------------------
#
'avatar_ext_id' => true,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'user_telegr' => true,
#
#-----[ FIND ]------------------------------------------
#
$tp_data['USER_OCC'] = $pr_data['user_occ'];
break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
/**
* Telegram
**/
case 'user_telegr':
$telegr = isset($_POST['user_telegr']) ? (string) $_POST['user_telegr'] : $pr_data['user_telegr'];
if ($submit && $telegr != $pr_data['user_telegr'])
{
if ($telegr != '' && !preg_match("#^[a-zA-Z0-9_]{5,25}$#", $telegr))
{
$errors[] = $lang['TELEGR_ERROR'];
}
$pr_data['user_telegr'] = $telegr;
$db_data['user_telegr'] = (string) $telegr;
}
$tp_data['USER_TELEGR'] = $pr_data['user_telegr'];
break;
#
#-----[ OPEN ]------------------------------------------
#
includes/ucp/viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$telegr = ($profiledata['user_telegr']) ? $profiledata['user_telegr'] : '';
#
#-----[ FIND ]------------------------------------------
#
'LOCATION' => $profiledata['user_from'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'TELEGR' => $telegr,
#
#-----[ OPEN ]------------------------------------------
#
ru/main.php
#
#-----[ ADD ]------------------------------------------
#
$lang['TELEGR'] = 'Telegram';
$lang['TELEGR_ERROR'] = 'Вы ввели некорректный логин Telegram';
#
#-----[ OPEN ]------------------------------------------
#
templates/default/usercp_register.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="prof-title">{L_TWITTER}:</td>
<td><input type="text" name="user_twitter" size="30" maxlength="15" value="{USER_TWITTER}" /></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="prof-title">{L_TELEGR}:</td>
<td><input type="text" name="user_telegr" size="30" maxlength="25" value="{USER_TELEGR}" /></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/default/usercp_viewprofile.tpl
#
#-----[ FIND ]------------------------------------------
#
<var class="ajax-params">{action: "edit_user_profile", id: "user_lastvisit"}</var>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<var class="ajax-params">{action: "edit_user_profile", id: "user_telegr"}</var>
#
#-----[ FIND ]------------------------------------------
#
<tr>
<th>{L_TWITTER}:</th>
<td class="tLeft med" id="user_twitter">
<span class="editable">
<a href="https://twitter.com/{TWITTER}" class="twitter-follow-button" data-show-count="false" data-lang="{USER_LANG}">{TWITTER}</a>
</span>
</td>
</tr>
<!-- ENDIF -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF TELEGR -->
<tr>
<th>{L_TELEGR}:</th>
<td class="tLeft med" id="user_telegr">
<a href="https://t.me/{TELEGR}" target="_blank"><span class="editable">{TELEGR}
</a>
</span>
</td>
</tr>
<!-- ENDIF -->
#
#-----[ OPEN ]------------------------------------------
#
templates/default/viewtopic.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- IF postrow.POSTER_FROM --><p class="from"><em>{L_LOCATION}:</em> {postrow.POSTER_FROM}</p><!-- ENDIF -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF postrow.POSTER_TELEGR --><p class="telegr"><em>{L_TELEGR}:</em> <a href="https://t.me/{postrow.POSTER_TELEGR}" target="_blank">{postrow.POSTER_TELEGR}</a></p><!-- ENDIF -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#