Author Topic: Showing URL only to the author  (Read 7392 times)

0 Members and 1 Guest are viewing this topic.

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Showing URL only to the author
« on: December 03, 2005, 04:48:55 AM »
i would like to show the URL to the author in the media templates for .gif and .jpg extensions. And only show the url to the author, which would be the condition so that it worked?
I know that the URL would be:  http://www.midominio.com/4images/{media_src}
but i want to show only to the author from the file.

this code will be in the templates files.. in extensions .gif, .jpg ...

Please could you help me?
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

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: Showing URL only to the author
« Reply #1 on: December 03, 2005, 05:06:23 AM »
I usualy use PHP code for such things directly in the templates.
For example you can do something like this:
Code: [Select]
<?php
global $user_info;
if (
$this->val_cache['user_id'] == $user_info['user_id'])
{
  echo 
" http://www.midominio.com/4images/".$this->val_cache['media_src'];
}
?>
In this example I used echo to output the needed text when condition is true (this way is faster ;))
but you also can use php only for the condition:
Code: [Select]
<?php
global $user_info;
if (
$this->val_cache['user_id'] == $user_info['user_id'])
{
?>

http://www.midominio.com/4images/{media_src}
<?php
}
?>

P.S. this method only works if EXEC_PHP_CODE is set to 1 in includes/constants.php
P.P.S. when using php in templates, array $this->val_cache can be used instead of tags
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 ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Showing URL only to the author
« Reply #2 on: December 03, 2005, 10:56:00 AM »
Thank you very much ! ;)
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Showing URL only to the author
« Reply #3 on: December 03, 2005, 12:45:19 PM »
I wouldnīt like to show the url to the author in the 23 category too. I put this code but this doesnīt work...

Code: [Select]
<?php
global $user_info;
if (
$this->val_cache['user_id'] == $user_info['user_id']){
if($this->val_cache['cat_id'] != 23){
?>

> Ya que eres su autor, tienes derecho a usar la URL de tu archivo,
  pero no te olvides de enlazar a My Art. <br>
  <font color="FFFFFF"><b>URL : http://www.patrysite.net/myart/{media_src}</b></font>
  <?php
}
}
?>

I donīt know php lenguage... I know C++, shell and ASM

Could you help me?
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Showing URL only to the author
« Reply #4 on: December 03, 2005, 05:15:10 PM »
Code: [Select]
<?php
global $user_info;
if (
$this->val_cache['user_id'] == $user_info['user_id'] | $cat_id != 23){
?>

> Ya que eres su autor, tienes derecho a usar la URL de tu archivo,
  pero no te olvides de enlazar a My Art. <br>
  <font color="FFFFFF"><b>URL : http://www.patrysite.net/myart/{media_src}</b></font>
  <?php
}
?>
Try this...

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: Showing URL only to the author
« Reply #5 on: December 03, 2005, 06:43:35 PM »
actualy...in additional you'll need add in includes/functions.php below:
Code: [Select]
      "media_icon" => $media_icon,This line:
Code: [Select]
      "cat_id" => $cat_id,Then the template condition should looks like this:
Code: [Select]
<?php
global $user_info;
if (
$this->val_cache['user_id'] == $user_info['user_id'] && !in_array($this->val_cache['cat_id'], array(23,156)))
{
?>

> Ya que eres su autor, tienes derecho a usar la URL de tu archivo,
  pero no te olvides de enlazar a My Art. <br>
  <font color="FFFFFF"><b>URL : http://www.patrysite.net/myart/{media_src}</b></font>
<?php
}
?>
(you can add more then one category id in the array ;) (156 is just an example)
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 ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Showing URL only to the author
« Reply #6 on: December 03, 2005, 09:32:32 PM »
hum... thank you but... the normal authors users donīt see the message under the image... but in my case... the admin... the code works correctly... maybe this code
Code: [Select]
$this->val_cache['user_id'] == $user_info['user_id'] is wrong
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Showing URL only to the author
« Reply #7 on: December 08, 2005, 09:48:57 AM »
Could you help me please?
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more