4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Sun Zaza 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
-
Hi,
in includes/functions.php
search:
"is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,
before add:
"user_name" => $user_info['user_name'],
in templates:
{if user_loggedin} Hello {user_name}{endif user_loggedin}
or
{if user_loggedout}Please login!{endif user_loggedout}
Kurt
-
Is good. ;)
// Step 1
In member.php file,
find:
"lang_profile_of" => $lang['profile_of'],
replace:
"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:
$lang['profile_of'] = "Welcome to the profile page of <b>{user_name}</b>";
add after:
$lang['profile_self_of'] = "Welcome <b>{user_name}</b> to your profile.";
// Step 3
In templates/your_template/member_profile.html file,
find:
<td valign="top" class="head1">{lang_profile_of} {user_name}</td>
replace:
<td valign="top" class="head1">{lang_profile_of}</td>
Finish.
-
I fix step 2. I forget for change original profile from with user name. Is fix. ;)
-
@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
-
@Thunderstrike:
Your code is perfect!
Thank for posting.
-
Hi KurtW,
in includes/functions.php
search:
"is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,
before add:
"user_name" => $user_info['user_name'],
Do you mean includes/page_header.php? :wink:
-
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:
{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
-
Hi KurtW,
in includes/functions.php
search:
"is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 0,
before add:
"user_name" => $user_info['user_name'],
Do you mean includes/page_header.php? :wink:
yes :oops:
-
@Thunderstrike:
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)
-
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. ;)
-
Of course not! How can I use your code to show a table? With tables you can not use main.php (The language file).
-
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 ...
-
You still misunderstand my request. I will explain:
On member_profile.html I made an extra table:
<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:
<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 (http://www.4homepages.de/forum/index.php?topic=19374.msg104354#new) :wink:
-
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 ?
-
I can not use it because the tweak of today you have to typ the name of the user
{if user_loggedin_username} and {endif user_loggedin_username}. Replace username with true user name.
but what I want on the member_profile.html is:
If user ID info is match with user ID profile (same ID) = show the table:
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head2">
***some text here***
</td>
</tr>
</table><br /><br />
If not: Show nothing (Hide the table).
Try please to TWEAK (change) this code:
"user_loggedin_" . $user_info['user_name'] => (isset($user_info['user_name']) && !empty(format_text(trim($user_info['user_name'])), 2) && $user_info['user_level'] >= USER) ? true : false,
I know that you want to help me and I know also that you are busy with other codes. So please take your time to read my request to understand what I want.
This time I explain it very very good! :wink:
-
I could use the tweak of today if I can use {user_ID} in your code on the page_header.php. Something like:
if user_loggedin_{user_id}} and {endif user_loggedin_{user_id}},
but it is NOT possible. :x
-
***some text here***
// Step 1
In member.php file,
find:
"lang_profile_of" => $lang['profile_of'],
add after:
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : "",
// Step 2
In lang/english/main.php file,
on top ?>:
$lang['text_for_each_user'] = "This is text for <b>{user_name}</b>";
Edit text in lang.
// Step 3
In templates/your_template/member_profile.html file,
find:
***some text here***
replace:
{lang_text_for_each_user}
Finish.
Note: If have problem with tweak - please post in correct topic :!:
-
Thanks for the code!
Why are you still talking about text and NOT about table.
I want to hide/show table, NOT A TEXT!
Not
***some text here***
I want to hide/show the hole table:
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head2">
***some text here***
</td>
</tr>
</table><br /><br />
Oke, Listen: How can I use the same code to hide/show a TABLE instead of text.
Please i need to use {if...} {andif...} otherwise I can not use it with tables. :cry:
-
For table, you use: {if user_loggedin} and {endif user_loggedin} ...
Is for user level ...
-
Do you mean that I have first to use:
***some text here***
// Step 1
In member.php file,
find:
"lang_profile_of" => $lang['profile_of'],
add after:
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : "",
// Step 2
In lang/english/main.php file,
on top ?>:
$lang['text_for_each_user'] = "This is text for <b>{user_name}</b>";
Edit text in lang.
// Step 3
In templates/your_template/member_profile.html file,
find:
***some text here***
replace:
{lang_text_for_each_user}
Finish.
Note: If have problem with tweak - please post in correct topic :!:
en then
For table, you use: {if user_loggedin} and {endif user_loggedin}
-
If use my step 1-2-3 of code - you no need for use {if ... and {endif ... but if use tag, you need for add each user individual with tweak but if use step 1-2-3, query is check for match user ID current with profile user ID. If match, you use {lang_text_for_each_user} .
So do like this:
{if lang_text_for_each_user}{lang_text_for_each_user}{endif lang_text_for_each_user}
in member_profile.html file.
all tag register to $site_template->register_vars is match with IF and ENDIF tag. ;)
-
Hi,
I just test your code step 1-2-3, but {lang_text_for_each_user} is not showing.
There is something wrong with this code I think:
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : "",
Can you see what wrong here? :?
-
Replace code:
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : $lang['text_for_fun'],
In lang/english/main.php file,
in top ?>:
$lang['text_for_fun'] = "This is text for fun !";
Is show now :?:
-
I am still testing it. Nothing is showing, but I want first to try more tricks before going back to you and als to be sure about the result.
Later :)
-
Ok so remove IF and ENDIF of this lang in member_profile.html file.
-
No good niews :x
I used
{lang_text_for_fun}
on member_profile.html and
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : $lang['text_for_fun'],
and
$lang['text_for_fun'] = "This is text for fun !";
in main.php
But nothing is showing yet
-
In member.php file,
replace this:
"lang_text_for_each_user" => (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['text_for_each_user']) : $lang['text_for_fun'],
-
Nope, nothing is showing yet :(
-
And you place code in showprofile action and no editprofile action in member.php file ?
-
After
"lang_profile_of" => $lang['profile_of'],
-
I no can reproduce problem ...
-
I will try it again tomorrow :wink:
-
Good news Thunderstrike :D
I get it to work.
In member.php you find twice the code
lang_profile_of
So this line was in the wrong section:
"lang_text_for_each_user" => (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_id']]), 2), $lang['text_for_each_user']) : "",
I can now hide/show tables.
Thanks man!
-
lang_profile_of
I no say for find twice ... I say add after line ...
-
I no say for find twice ... I say add after line ...
Yes I know, but I added the code after the first (lang_profile_of) in the section edit_profile instead of the (lang_profile_of) of the section show_profile.
My mistake :oops:
It is working now and I am satisfied.
Thank you again ThunderStrike :D