Author Topic: "View Your Profile" option?  (Read 5494 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
"View Your Profile" option?
« on: January 29, 2006, 01:52:02 PM »
I know, that maybe sounds very simple, but i can't get it work. All i want is a link in the userbox, "View your profile", for the normal users. so the userbox looks like:

Album (the lightbox)
Edit Profile (control panel)
View Profile (The profile of that user account) The same way it looks like an other user click on that username
Exit (Logoff)
etc.


Whats the link for that option, ot have i to edit the member.php etc?

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "View Your Profile" option?
« Reply #1 on: January 29, 2006, 02:17:49 PM »
I'm glad you asked since I did it for my site a while ago actually. In order to accomplish this,

Version A

go to your

includes/page_header.php file,

find :

Quote

"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(ROOT_PATH."member.php?action=editprofile"),


add below :

Code: [Select]

"url_show_profile" => (!empty($url_show_profile)) ? $site_sess->url($url_show_profile) : $site_sess->url(ROOT_PATH."member.php?".URL_USER_ID."=".$user_info['user_id']."&action=showprofile"),


Then, find :

Quote

"lang_control_panel" => $lang['control_panel'],


add below :

Code: [Select]

"lang_show_profile" => $lang['show_profile'],


Then, in your lang/english/main.php file,

add above the '?>' tag :

Code: [Select]

$lang['show_profile'] = "View my profile";


Then, in your templates/<your_template>/user_logininfo.html file,

find :

Quote

&raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />


add below :

Code: [Select]

&raquo; <a href="{url_show_profile}">{lang_show_profile}</a><br />


Then, try your link from the user box window. This should definitely work. ;)

Version B

Also, you might be interested to know I also did the following for another user recently (but forgot to post here) - so - still

in your includes/page_header.php file (backup of the file is recommended),

find :

Quote

//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
if ($user_info['user_level'] >= USER) {
  $site_template->register_vars("lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", $user_info['user_name'], $lang['lang_loggedin_msg']));
  $user_box = $site_template->parse_template("user_logininfo");
  $site_template->register_vars(array(
    "user_box" => $user_box,
    "user_loggedin" => 1,
    "user_loggedout" => 0,
    "is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0
  ));
  $site_template->un_register_vars("user_logininfo");
  unset($user_box);
}
else {
  $user_box = $site_template->parse_template("user_loginform");
  $site_template->register_vars(array(
    "user_box" => $user_box,
    "user_loggedin" => 0,
    "user_loggedout" => 1,
    "is_admin" => 0
  ));
  $site_template->un_register_vars("user_loginform");
  unset($user_box);
}


replace with :

Code: [Select]

//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
if ($user_info['user_level'] >= USER) {

$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $user_info['user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_info['user_id']);

$site_template->register_vars("lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", "<a href=\"".$site_sess->url($user_profile_link)."\">".$user_info['user_name']."</a>", $lang['lang_loggedin_msg']));
$user_box = $site_template->parse_template("user_logininfo");
$site_template->register_vars(array(
    "user_box" => $user_box,
    "user_loggedin" => 1,
    "user_loggedout" => 0,
    "is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0
));
$site_template->un_register_vars("user_logininfo");
unset($user_box);
unset ($user_profile_link);
}
else {
  $user_box = $site_template->parse_template("user_loginform");
  $site_template->register_vars(array(
    "user_box" => $user_box,
    "user_loggedin" => 0,
    "user_loggedout" => 1,
    "is_admin" => 0
  ));
  $site_template->un_register_vars("user_loginform");
  unset($user_box);
}


This will say like : Connected to <<user_account>> (with the showprofile's page on it). It's quite the same function as the "View my profile" thing I did above. ;)

[ EDIT ]

Some modifications needed to be done to version B and everything works fine now. ;)
« Last Edit: January 29, 2006, 05:20:23 PM by V@no »

Offline Jenn

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: "View Your Profile" option?
« Reply #2 on: February 15, 2007, 09:55:10 PM »
Thanks, works like a charm :)

Offline quartz

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: "View Your Profile" option?
« Reply #3 on: July 21, 2007, 12:25:17 AM »
just what i needed...and it works