Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Dispaly User Fields Under Thumb and Intermediate Image  (Read 5379 times)

0 Members and 1 Guest are viewing this topic.

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Dispaly User Fields Under Thumb and Intermediate Image
« on: October 28, 2005, 10:20:57 pm »

I know someone out there will have the answer to this.

I have search for the answer to my question but am having difficulty in finding it. I hope someone can point me to a topic that answers my question or answer it for me, and thank you in advance.

Right my question sounds so simple, but I cant quite grasp it as I am a realtively newbie to all that is php.

I am looking to be able to show the contents of User1 and User2 fileds under both the thumbnail and intermeidate images. However I dont want to have to show all the information as set by the "show file information by default" setting.

Can someone show me how to do this in the most simplest method possible.

Thanks again.

COSARIN
« Last Edit: November 12, 2005, 06:31:22 pm by GauGau »
Logged

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #1 on: October 29, 2005, 01:05:28 pm »

Well I have sorted one of these out.

In case anyone else is interested. To display the results of a custom user field on the intermediate view pages (disaplyimage.php) the solution is quite simple.

The first step is to define a parameter and place holder for the value.

This can be done by editting the displayimage.php file with the following.

find:
Code: [Select]
$params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $pic_html,
        '{ADMIN_MENU}' => $picture_menu,
        '{TITLE}' => $CURRENT_PIC_DATA['title'],
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

    return template_eval($template_display_picture, $params);
}

and add into the parameter list something like.

Code: [Select]
        '{USER1}' => $CURRENT_PIC_DATA['user1'],

Change the USER1 and user1 parts with USER2 / USER3 depending on the field you wish to show.

Then in your theme.php find the area that defines the html for the intermediate picture display, and add above or below your image the following.

Code: [Select]
{USER1}


or USER2 / USER3 depending on the user field you wish to show.

However I am still having difficulty with putting the same information into the thumbnail view. Its does not look as simple as with the intermediate image page.

Can anyone help me?

COSARIN
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #2 on: October 29, 2005, 02:01:46 pm »

it's even easier. In functions.inc.php find the function get_pic_data(), the $caption variable holds what's getting displayed in thumb view under the thumbs. If you edit $caption below // Regular albums then the main thumb view gets changed.. to change the meta albums display you have to eg. modify $caption under case 'lastcom':

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #3 on: October 29, 2005, 06:28:43 pm »

I can see that the area you mentioned gives the caption information, but which part do I change and how do I get it to call the data in User1 customer field. Each section seems to have its own function like comments, or rating, or picture owner. Where do I add the different data or what do I change.

The code I have is


Code: [Select]
                // Set picture caption
                if ($set_caption) foreach ($rowset as $key => $row){

                        $caption = "<span class=\"thumb_title\">";
                        $caption .= ($rowset[$key]['title']||$rowset[$key]['hits']) ? $rowset[$key]['title'] : '';

            if ($CONFIG['views_in_thumbview']){
               if ($rowset[$key]['title']){$caption .= "&nbsp;&ndash;&nbsp;";}
            $caption .= sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits']);
            }
                 $caption .= "</span>";


                        if ($CONFIG['caption_in_thumbview']){
                           $caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">".bb_decode(($rowset[$key]['caption']))."</span>" : '';
                        }
                        if ($CONFIG['display_comment_count']) {
                                $comments_nr = count_pic_comments($row['pid']);
                                if ($comments_nr > 0) $caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $comments_nr )."</span>";
                        }

                        if ($CONFIG['display_uploader']){
                                $caption .= '<span class="thumb_title"><a href ="profile.php?uid='.$rowset[$key]['owner_id'].'">'.$rowset[$key]['owner_name'].'</a></span>';
                        }

                        $rowset[$key]['caption_text'] = $caption;

                }

                return $rowset;
        }

I hope you can help.

COSARIN
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #4 on: November 02, 2005, 06:18:20 pm »

you still are looking for help with it or is it already solved?

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #5 on: November 02, 2005, 07:41:18 pm »

Stramm

Yes I am still looking for help on this.

I solved the "display custom user fileds below the image in intermediate view" in displayimage.php

But I still need help on displaying user fileds under each thumbnail image in the thumbnails.php

I hope you can help.

Thanks

COSARIN
Logged

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #6 on: November 02, 2005, 09:27:45 pm »

it's even easier. In functions.inc.php find the function get_pic_data(), the $caption variable holds what's getting displayed in thumb view under the thumbs. If you edit $caption below // Regular albums then the main thumb view gets changed.. to change the meta albums display you have to eg. modify $caption under case 'lastcom':

Please explain how I adjust the information without altering the default systems.

In other words I dont want to have to click show comments in the config menu to show a user field.

Thanks

COSARIN
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #7 on: November 06, 2005, 05:10:54 pm »

sorry, wasn't online for a few days.. and I've not tested what I'm telling you now

a few lines above // Set picture caption (from your code) find
Code: [Select]
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';add to it your user1 and user2 columns. Then scroll down a few lines and find
Code: [Select]
                        $rowset[$key]['caption_text'] = $caption;above add
Code: [Select]
$caption = "<span class=\"thumb_caption\">User 1: ".$row['user1'])." - User 2:".$row['user2'])."'</span>';

COS@RIN

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • Cosarin Internet
Re: Dispaly User Fields Under Thumb and Intermediate Image
« Reply #8 on: November 12, 2005, 05:10:10 pm »

Stramm

Thanks for your help.

You code has been tried and tested and with slight changes works a treat.

I noticed that your code shown below needed slight alteration, as it displayed both user1 and user2 data, but left out the Title.

Quote
$caption = "<span class=\"thumb_caption\">User 1: ".$row['user1'])." - User 2:".$row['user2'])."'</span>';

So I slightly changed it to suit my needs to

Code: [Select]
$caption = '<span><tr><td class="pictitle2">'.$row['title'].'</td></tr><tr><td class="latinname2">(Latin Name: '.$row['user1'].')</td></tr></span>';
and this then worked perfectly for my requirements.

First showing the Title, then Latin Name which is stored in the User1 custom field.

Thanks very much for your assistace.

COS@RIN
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.