1

Topic: Username in photos.tpl v.s. pictures.tpl

In the CP - Manage Pictures - Profile Photos, I added the username below each image. All I did was put {username} below the image in photos.tpl to accomplish this.

I also wanted to add the username below each members picture at  Manage Pictures - Album pictures,  but when I added {username} below the image in pictures.tpl all that displays in the Manage Pictures - Album pictures is the code and not the member's username.

Not sure why {username} works in photos.tpl but doesn't in pictures.tpl.

Vlad or coding expert, what code can I use  in version 2.5.3 to display the member's username below their image in includes/pictures.tpl?

[img]http://www.filipina-lady.net/test253/user01.jpg[/img]

----------------------------------------------------------------

[img]http://www.filipina-lady.net/test253/user02.jpg[/img]



Thanks

Last edited by db3204 (2009-05-21 16:43:44)

2

Re: Username in photos.tpl v.s. pictures.tpl

You have to edit 2 lines of code in cp.pictures.php:

function show_pictures
line ~569:

//------------------------------------------------
// Get pictures
//------------------------------------------------
$result = $DB->query("SELECT p.*

make it

//------------------------------------------------
// Get pictures
//------------------------------------------------
$result = $DB->query("SELECT p.*, m.username

then about 20 lines below line ~ 594:

$fields[$i]['member_id']   = $obj->member_id;

make it

$fields[$i]['member_id']   = $obj->member_id;
$fields[$i]['username'] = htmlentities2utf8($obj->username);

Now you should have this variable for using.

3

Re: Username in photos.tpl v.s. pictures.tpl

Thanks a million Ramil....it worked like a charm

I never understood why some variables work in some templates and not in others?

4

Re: Username in photos.tpl v.s. pictures.tpl

You are welcome.

I never understood why some variables work in some templates and not in others?

Because there is no need to carry huge language bag every time you go for one day business trip - take only those things you most probably need.

5

Re: Username in photos.tpl v.s. pictures.tpl

hi db and radioact, very good mod easy to follow, thanks smile

6

Re: Username in photos.tpl v.s. pictures.tpl

Hi,

I am trying to find photos.tpl in my panel, but I'm not having much luck. Could someone tell me the path I would follow? I added the modification above, but I still don't see the username displayed underneath the pictures.  I was wondering if I should also put the username code into the pictures.tpl? If so, where would I place that in the code? Thanks for your help.

Last edited by aprildain (2009-08-24 23:11:51)

7

Re: Username in photos.tpl v.s. pictures.tpl

I have the same problem, but I think its because I'm using version 2.5.2 and not 2.5.3, files can vary between versions. I'm sure radioact or some other kind person will advise smile

8

Re: Username in photos.tpl v.s. pictures.tpl

I hope so! This would be really useful on my site. Thanks for the response.

9

Re: Username in photos.tpl v.s. pictures.tpl

All template files for your control panel is in includes/templates

10

Re: Username in photos.tpl v.s. pictures.tpl

If you can explane also first time for this work is very good, becouse is incomplete, very tanks...
What must add in photos.tpl and pictures.tpl  for work?

Last edited by maxjob2 (2009-10-03 15:07:02)

11

Re: Username in photos.tpl v.s. pictures.tpl

db3204 wrote

In the CP - Manage Pictures - Profile Photos, I added the username below each image. All I did was put {username} below the image in photos.tpl to accomplish this.

Again, can you please provide a reference point of where exactly I should insert this into the code?

Thanks a mill!

12

Re: Username in photos.tpl v.s. pictures.tpl

chabon99

Not sure I understand, but just like any code, you can place it where you want. My site is customized quite a bit, so where I would place it may not work for your site.  I can say this,  the CP is a fairly crowded area, so probably you will place the code where it fits best on your site.

13

Re: Username in photos.tpl v.s. pictures.tpl

Sorry for being unclear. I'm just unsure of where to place {username} in photos.tpl and pictures.tpl. Can you provide the line of code preceeding where I should insert {username}?

14

Re: Username in photos.tpl v.s. pictures.tpl

It doesn't matter....place the code where you want to display the username. What I did was place it in one place, didn't like it, tried another place, etc, until I got it where it worked well for my site.

Make sure you are modifying the files in the inclues/templates folder and not in the root/templates folder. There is a difference -- one is for your control panel and the other is for your templates that members see on the front end.

15

Re: Username in photos.tpl v.s. pictures.tpl

Thanks - I got it working!

16

Re: Username in photos.tpl v.s. pictures.tpl

Thanks all!

Good reading material smile  Learning everyday.

17

Re: Username in photos.tpl v.s. pictures.tpl

I`ve got it working too.Thanks Dan and Ramil!