Показать сообщение отдельно
Старый 22.11.2011, 11:18 Вверх   #23
Уважаемая личность
 
Аватар для Heon
Heon вне форума
Доп. информация
По умолчанию Отдельная страница для редактирования профиля пользователя

Отдельная страница для редактирования профиля пользователя

1. .htaccess
После:
PHP код:
RewriteRule ^user/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$[L
Добавить:
PHP код:
RewriteRule ^user/([^/]*)/settings(/?)+$ index.php?subaction=userinfo&user=$1&a=settings [L
2. engine/modules/profile.php
Найти:
PHP код:
 $tpl->set'{hidemail}'"<input type=\"checkbox\" name=\"allow_mail\" value=\"1\" " $mailbox " /> " $lang['news_noamail'] );
    
$tpl->set'{usertitle}'stripslashes$row['name'] ) );
    
$tpl->set'{fullname}'stripslashes$row['fullname'] ) ); 
Ниже добавить:
PHP код:
 if ($_REQUEST['a'] == 'settings') {
    
$tpl->set'[settings]'"" );
    
$tpl->set'[/settings]'"" );
    
$tpl->set_block"'\\[profile\\](.*?)\\[/profile\\]'si""" );
    } else {
    
$tpl->set'[profile]'"" );
    
$tpl->set'[/profile]'"" );
    
$tpl->set_block"'\\[settings\\](.*?)\\[/settings\\]'si""" );
    } 
Найти:
PHP код:
if($is_logged and ($member_id['user_id'] == $row['user_id'] or $member_id['user_group'] == 1)) {
        
$tpl->copy_template "<form  method=\"post\" name=\"userinfo\" id=\"userinfo\" enctype=\"multipart/form-data\" action=\"\">" $tpl->copy_template "
        <input type=\"hidden\" name=\"doaction\" value=\"adduserinfo\" />
        <input type=\"hidden\" name=\"id\" value=\"
{$row['user_id']}\" />
        <input type=\"hidden\" name=\"dle_allow_hash\" value=\"
{$dle_login_hash}\" />
        </form>"
;
    } 
Добавить в IF условие
PHP код:
AND ($_REQUEST['a'] == "settings"
Вот что должно получиться:
PHP код:
 if( $is_logged and ($member_id['user_id'] == $row['user_id'] or $member_id['user_group'] == 1) and ($_REQUEST['a'] == "settings") ) {
        
$tpl->copy_template "<form  method=\"post\" name=\"userinfo\" id=\"userinfo\" enctype=\"multipart/form-data\" action=\"\">" $tpl->copy_template "
        <input type=\"hidden\" name=\"doaction\" value=\"adduserinfo\" />
        <input type=\"hidden\" name=\"id\" value=\"
{$row['user_id']}\" />
        <input type=\"hidden\" name=\"dle_allow_hash\" value=\"
{$dle_login_hash}\" />
        </form>"
;
    } 
3. templates/{THEME}/userinfo.tpl
Заключить код профиля в теги [profile] и [/profile], а найстройки в [settings] и [/settings]

4.в profile.php редактировать тег ))

PHP код:
if( $is_logged and ($member_id['user_id'] == $row['user_id'] or $member_id['user_group'] == 1) ) {
        
$tpl->set'{edituser}'"<a href=\"".$config['http_home_url']."user/".urlencode($row['name'])."/settings/\">" $lang['news_option'] . "</a> " );
    } else
        
$tpl->set'{edituser}'"" ); 

Автор:promax
  Ответить с цитированием
2 пользователя(ей) сказали cпасибо:
 
Время генерации страницы 0.08062 секунды с 10 запросами