Author Topic: Showing text and/of table only to the owner of the Profile page  (Read 22764 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Showing text and/of table only to the owner of the Profile page
« on: November 10, 2007, 02:53:52 PM »
Hi guys,

I added some text to the member_profile.html (For example: Welkom {user_name} to your profile page).
I want to show this text only to the owner of the profile page.
If someone else is visiting this member page, will get another text:
(For example: Welkom to the profile page of...)

What do I have to do to use: {if..............} text1 {endif..............} {ifnot..............} text2 {endifnot..............}

Many thanks in advance for any help,
Cruxy

« Last Edit: November 10, 2007, 05:56:23 PM by cruxy »

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: Showing text only to the owner of the Profile page
« Reply #1 on: November 10, 2007, 03:16:48 PM »
Hi,

in includes/functions.php
search:
Code: [Select]
  "is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,before add:
Code: [Select]
  "user_name" => $user_info['user_name'],
in templates:
Code: [Select]
{if user_loggedin} Hello {user_name}{endif user_loggedin}
or
Code: [Select]
{if user_loggedout}Please login!{endif user_loggedout}

Kurt

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #2 on: November 10, 2007, 03:17:02 PM »
Is good. ;)

// Step 1

In member.php file,

find:

Quote
"lang_profile_of" => $lang['profile_of'],

replace:

Code: [Select]
"lang_profile_of" => (isset($user_row[$user_table_fields['user_id']]) && $user_row[$user_table_fields['user_id']] == $user_info['user_id']) ? preg_replace("/". $site_template->start . "user_name" . $site_template->end . "/siU", format_text(trim($user_row[$user_table_fields['user_name']]), 2), $lang['profile_self_of']) : preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(trim($user_row[$user_table_fields['user_name']]), 2), $lang['profile_of']),

// Step 2

In lang/english/main.php file,

find and replace:

Quote
$lang['profile_of'] = "Welcome to the profile page of <b>{user_name}</b>";

add after:

Code: [Select]
$lang['profile_self_of'] = "Welcome <b>{user_name}</b> to your profile.";

// Step 3

In templates/your_template/member_profile.html file,

find:

Quote
<td valign="top" class="head1">{lang_profile_of} {user_name}</td>

replace:

Code: [Select]
<td valign="top" class="head1">{lang_profile_of}</td>

Finish.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #3 on: November 10, 2007, 03:22:57 PM »
I fix step 2. I forget for change original profile from with user name. Is fix. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #4 on: November 10, 2007, 03:58:29 PM »
@KurtW:
I believe you misunderstood my request, but I thank you any way for your help and intention. The solution of Thunderstrike is working fine. :)

@Thunderstrike:
Your code is perfect!

Great man!  :D

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #5 on: November 10, 2007, 04:18:26 PM »
Quote
@Thunderstrike:
Your code is perfect!

Thank for posting.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #6 on: November 10, 2007, 05:29:29 PM »
Hi KurtW,

Quote
in includes/functions.php
search:
Code: [Select]
  "is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,before add:
Code: [Select]
  "user_name" => $user_info['user_name'],


Do you mean includes/page_header.php? :wink:

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #7 on: November 10, 2007, 05:39:45 PM »
Hi guys,

I thought first that I will use this code to show a table only to the owner of the profile page, but I think I need something like: {if...}{endif},

For example:

Code: [Select]
{if...}
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td valign="top" class="head2">
      text
    </td>
  </tr>
</table>
{endif.....}

I appreciate any help,
Cruxy

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: Showing text only to the owner of the Profile page
« Reply #8 on: November 10, 2007, 05:45:35 PM »
Hi KurtW,

Quote
in includes/functions.php
search:
Code: [Select]
  "is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,before add:
Code: [Select]
  "user_name" => $user_info['user_name'],


Do you mean includes/page_header.php? :wink:

yes  :oops:

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text only to the owner of the Profile page
« Reply #9 on: November 10, 2007, 05:54:37 PM »
@Thunderstrike:
Quote
Is new solution:

http://www.4homepages.de/forum/index.php?topic=19374.msg104354#new

This is a really a usefull MOD (I have already an idea how to use it on my gallery), but in this mod you choose yourself which user will see the text or the table.
What I asked is ONLY the owner of the PROFILE PAGE will see the table.

That means if you are the USER1 and you are on your profile page (member_profile.html), you will be able to see the text or the table. But if someone else is on you profile, he will see only the normal profile information.

The text in the table on the (member_profile.html) is ONLY for you (NOT for other users or guest)

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text and/of table only to the owner of the Profile page
« Reply #10 on: November 10, 2007, 06:53:46 PM »
Quote
That means if you are the USER1 and you are on your profile page (member_profile.html), you will be able to see the text or the table. But if someone else is on you profile, he will see only the normal profile information.

The text in the table on the (member_profile.html) is ONLY for you (NOT for other users or guest)

Ok so first code I post in topic is right. Is do exact. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text and/of table only to the owner of the Profile page
« Reply #11 on: November 10, 2007, 06:58:38 PM »
Of course not! How can I use your code to show a table? With tables you can not use main.php (The language file).

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text and/of table only to the owner of the Profile page
« Reply #12 on: November 10, 2007, 07:30:30 PM »
My code is this:

- If user ID info is match with user ID profile (same ID) - is welcome to user direct. If no same, is welcome original text ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing text and/of table only to the owner of the Profile page
« Reply #13 on: November 10, 2007, 07:50:11 PM »
You still misunderstand my request. I will explain:

On member_profile.html I made an extra table:

Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td valign="top" class="head2">
      ***some text here***
    </td>
  </tr>
</table><br /><br />

Under this table you find the normal information of member_profile.html:

Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td valign="top" class="head1">
      <table width="100%" border="0" cellpadding="4" cellspacing="0">
        <tr>
          <td valign="top" class="head1">{lang_profile_of} {user_name}</td>
          <td valign="top" class="head1" align="right"><a href="{url_show_user_images}" class="head1">{lang_show_user_images}</a></td>
        </tr>
        <tr>
          <td class="row1"><b>{lang_join_date}</b></td>
          <td class="row1">{user_join_date}</td>
        </tr>
        <tr>
          <td class="row2"><b>{lang_last_action}</b></td>
          <td class="row2">{user_last_action}</td>
        </tr>
        <tr>
          <td class="row1"><b>{lang_comments}</b></td>
          <td class="row1">{user_comments}</td>
        </tr>
        <tr>
          <td class="row2"><b>{lang_email}</b></td>
          <td class="row2">{if user_email}<a href="{user_mailform_link}">{user_email_save}</a>{endif user_email}</td>
        </tr>
        <tr>
          <td class="row1"><b>{lang_homepage}</b></td>
          <td class="row1">{if user_homepage}<a href="{user_homepage}" target="_blank">{user_homepage}</a>{endif user_homepage}</td>
        </tr>
        <tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>
      </table>
    </td>
  </tr>
</table>


So I want to show this table only to the owner of the profile page (member_profile.html).

NOTE: I think that the new code will be almost a similar of you new tweak of today:
http://www.4homepages.de/forum/index.php?topic=19374.msg104354#new :wink:





Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Showing text and/of table only to the owner of the Profile page
« Reply #14 on: November 10, 2007, 08:18:39 PM »
Quote
NOTE: I think that the new code will be almost a similar of you new tweak of today:
http://www.4homepages.de/forum/index.php?topic=19374.msg104354#new Wink

Yes ... if use tweak I code today ... you can for each username ... is same ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?