Author Topic: Link to a user's profile  (Read 6258 times)

0 Members and 1 Guest are viewing this topic.

Offline k1lljoy

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Razruha.Ru
Link to a user's profile
« on: February 24, 2010, 01:03:32 PM »
Hi!
Is it possible to put a link to a user's profile (/member.php?action=showprofile&user_id=XX) into user_logininfo.html ?
Or maybe even direct link to all his photos (/search.htm?search_user=user_name) or comments (/member.php?action=showcomments&user_id=XX) ?
So that every user could easily see his profile, as it is seen by the others (without modifying),  photos uploaded by him, and his own comments  :)

For right now the user has to find his post firstly, and then find and click on the link to his profile, which is not so easy and visible for unexpirienced users...

I tried adding {user_name_link} tag into user_logininfo.html , but after that I get link to a profile of random image author, and not mine  :D


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Link to a user's profile
« Reply #1 on: February 24, 2010, 02:56:32 PM »
in includes/page_header.php find:
  "url_home" => $site_sess->url(ROOT_PATH."index.php"),

insert below:
//user links
  
"url_user_profile" => ($user_info['user_level'] != GUEST) ? ((!empty($url_show_profile)) ? str_replace("{user_id}"$user_info['user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&" URL_USER_ID "=" $user_info['user_id'])) : "",
  
"url_user_images" => ($user_info['user_level'] != GUEST) ? $site_sess->url(ROOT_PATH."search.php?search_user=" urlencode($user_info['user_name'])) : "",
  
"url_user_comments" => ($user_info['user_level'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showcomments&" URL_USER_ID "=" $user_info['user_id']) : "",
  
"lang_user_profile" => $lang['user_profile'],
  
"lang_user_images" => $lang['user_images'],
  
"lang_user_comments" => $lang['user_comments'],
//end user links


In lang/<your language>/main.php add:
$lang['user_profile'] = "My profile";
$lang['user_images'] = "My images";
$lang['user_comments'] = "My comments";


in templates use {url_user_profile}, {url_user_images}, {url_user_comments} for urls and {lang_user_profile}, {lang_user_images} and {lang_user_comments} for text.
i.e.
Code: (HTML template) [Select]
{if url_user_profile}<a href="{url_user_profile}">{lang_user_profile}</a>{endif url_user_profile}
{if url_user_images}<a href="{url_user_images}">{lang_user_images}</a>{endif url_user_images}
{if url_user_comments}<a href="{url_user_comments}">{lang_user_comments}</a>{endif url_user_comments}

P.S.
the user comments page requires [Mod] Show user's comments from his profile
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline k1lljoy

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Razruha.Ru
Re: Link to a user's profile
« Reply #2 on: February 25, 2010, 11:54:05 AM »
It now works just fine!
Enormous thanx, V@no!  :D



Offline SweD

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Link to a user's profile
« Reply #3 on: April 27, 2012, 10:08:29 AM »
Tnx V@no
really nice mod