Замена стандартной ссылки профиля на свою
Заменяет ссылку профиля site.ru/user/test/ на site.ru/journal/test/
Для начала редактируем ЧПУ:
1. Открываем .htaccess
Найти:
# вывод для отдельного юзера
RewriteRule ^user/([^/]*)/rss.xml$ engine/rss.php?subaction=allnews&user=$1 [L]
RewriteRule ^user/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$1 [L]
RewriteRule ^user/([^/]*)/page/([0-9]+)(/?)+$ index.php?subaction=userinfo&user=$1&cstart=$2 [L]
RewriteRule ^user/([^/]*)/news(/?)+$ index.php?subaction=allnews&user=$1 [L]
RewriteRule ^user/([^/]*)/news/page/([0-9]+)(/?)+$ index.php?subaction=allnews&user=$1&cstart=$2 [L]
RewriteRule ^user/([^/]*)/news/rss.xml(/?)+$ engine/rss.php?subaction=allnews&user=$1 [L]
Заменить на (в вашем случае):
# вывод для отдельного юзера
RewriteRule ^journal/([^/]*)/rss.xml$ engine/rss.php?subaction=allnews&user=$1 [L]
RewriteRule ^journal/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$1 [L]
RewriteRule ^journal/([^/]*)/page/([0-9]+)(/?)+$ index.php?subaction=userinfo&user=$1&cstart=$2 [L]
RewriteRule ^journal/([^/]*)/news(/?)+$ index.php?subaction=allnews&user=$1 [L]
RewriteRule ^journal/([^/]*)/news/page/([0-9]+)(/?)+$ index.php?subaction=allnews&user=$1&cstart=$2 [L]
RewriteRule ^journal/([^/]*)/news/rss.xml(/?)+$ engine/rss.php?subaction=allnews&user=$1 [L]
2. Меняем ссылки.
2.1 engine.php
Найти:
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user );
Заменить на:
$url_page = $config['http_home_url'] . "journal/" . urlencode ( $user );
Найти:
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user ) . "/news";
Заменить на:
$url_page = $config['http_home_url'] . "journal/" . urlencode ( $user ) . "/news";
Найти:
$rss_url = $config['http_home_url'] . "user/" . urlencode ( $user ) . "/" . "rss.xml";
Заменить на:
$rss_url = $config['http_home_url'] . "journal/" . urlencode ( $user ) . "/" . "rss.xml";
2.2 engine/init.php
Найти:
$tpl->set( '{profile-link}', $config['http_home_url'] . "user/" . urlencode ( $member_id['name'] ) . "/" );
Заменить на:
$url_page = $config['http_home_url'] . "journal/" . urlencode ( $user );
2.3 engine/classes/comments.class.php
Найти:
$go_page = $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/";
$tpl->set( '[profile]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/\">" );
Заменить на:
$go_page = $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/";
$tpl->set( '[profile]', "<a href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/\">" );
Найти:
if( $config['allow_alt_url'] == "yes" ) $tpl->set( '{author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/\">" . $row['name'] . "</a>" );
Заменить на:
if( $config['allow_alt_url'] == "yes" ) $tpl->set( '{author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/\">" . $row['name'] . "</a>" );
2.3 engine/modules/pm.php
Найти (2 раза):
$user_from = $config['http_home_url'] . "user/" . urlencode( $row['user_from'] ) . "/";
Заменить на (2 раза):
$user_from = $config['http_home_url'] . "journal/" . urlencode( $row['user_from'] ) . "/";
Найти (2 раза):
$tpl->set( '{author}', "<a {$user_from} class=\"pm_list\" href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['user_from'] ) . "/\">" . $row['user_from'] . "</a>");
Заменить на (2 раза):
$tpl->set( '{author}', "<a {$user_from} class=\"pm_list\" href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['user_from'] ) . "/\">" . $row['user_from'] . "</a>");
2.4 engine/modules/profile.php
Найти:
$user_name = $config['http_home_url'] . "user/" . urlencode( $temp_row['user_from'] ) . "/";
Заменить на:
$user_name = $config['http_home_url'] . "journal/" . urlencode( $temp_row['user_from'] ) . "/";
Найти:
$user_name = "<a {$user_name} class=\"pm_list\" href=\"" . $config['http_home_url'] . "user/" . urlencode( $temp_row['user_from'] ) . "/\">" . $temp_row['user_from'] . "</a>";
Заменить на:
$user_name = "<a {$user_name} class=\"pm_list\" href=\"" . $config['http_home_url'] . "journal/" . urlencode( $temp_row['user_from'] ) . "/\">" . $temp_row['user_from'] . "</a>";
Найти:
if( $config['allow_alt_url'] == "yes" ) $link_profile = $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/";
Заменить на:
if( $config['allow_alt_url'] == "yes" ) $link_profile = $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/";
Найти:
$tpl->set( '{news}', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/news/" . "\">" . $lang['all_user_news'] . "</a>" );
$tpl->set( '[rss]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/rss.xml" . "\" title=\"" . $lang['rss_user'] . "\">" );
Заменить на:
$tpl->set( '{news}', "<a href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/news/" . "\">" . $lang['all_user_news'] . "</a>" );
$tpl->set( '[rss]', "<a href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/rss.xml" . "\" title=\"" . $lang['rss_user'] . "\">" );
2.5 engine/modules/search.php
Найти (2 раза):
if( $config['allow_alt_url'] == "yes" ) $tpl->set( '{result-author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/\">" . $row['autor'] . "</a>" );
Заменить на (2 раза):
if( $config['allow_alt_url'] == "yes" ) $tpl->set( '{result-author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['autor'] ) . "/\">" . $row['autor'] . "</a>" );
2.6 engine/ajax/profile.php
Найти:
$tpl->set( '{news}', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/news/" . "\">" . $lang['all_user_news'] . "</a>" );
$tpl->set( '[rss]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/rss.xml" . "\" title=\"" . $lang['rss_user'] . "\">" );
Заменить на:
$tpl->set( '{news}', "<a href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/news/" . "\">" . $lang['all_user_news'] . "</a>" );
$tpl->set( '[rss]', "<a href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/rss.xml" . "\" title=\"" . $lang['rss_user'] . "\">" );
2.7 engine/modules/show.(short|full|custom).php
Найти:
$go_page = $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/";
Заменить на:
$go_page = $config['http_home_url'] . "journal/" . urlencode( $row['autor'] ) . "/";
2.8 На последок engine/modules/stats.php
Найти:
$user_name = $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/";
Заменить на:
$user_name = $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/";
Найти:
$user_name = "<a {$user_name} class=\"pm_list\" href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/\">" . $row['name'] . "</a>";
Заменить на:
$user_name = "<a {$user_name} class=\"pm_list\" href=\"" . $config['http_home_url'] . "journal/" . urlencode( $row['name'] ) . "/\">" . $row['name'] . "</a>";
Комментариев 0