• [MOD] Show user images in profile 4 0 5 1
Currently:  

Author Topic: [MOD] Show user images in profile  (Read 91759 times)

0 Members and 1 Guest are viewing this topic.

Offline Vladec

  • Newbie
  • *
  • Posts: 12
    • View Profile
[MOD] Show user images in profile
« on: November 05, 2006, 08:08:18 PM »
Hello All!!!

 :arrow: :!: Update: 21.11.2007

After searching and looking and asking i finaly got help from Nicky (Thank you!) and with my little modification (paging) this mod looks great.

This mod will allow you to show all images, that member has uploaded, with paging on his profile page , that is very convinient and atractive in my opinion.

So here it is:

Open member.php and find:
Code: [Select]
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
  $txt_clickstream = $lang['profile'];
  if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
    $user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
    if (!$user_id) {
      $user_id = GUEST;
    }
  }
  else {
    $user_id = GUEST;
  }

Add below:
Code: [Select]
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}


$sql1 = "SELECT COUNT(*) as user_count_images
        FROM ".IMAGES_TABLE."
        WHERE user_id = $user_id";
        $row = $site_db->query_firstrow($sql1);
        $user_total_images = $row['user_count_images'];

$site_template->register_vars($lang['user_profile_images'] = preg_replace("/".$site_template->start."user_total_images".$site_template->end."/siU", $user_total_images, $lang['user_profile_images']));
unset($user_total_images);

$user_images = 20; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN
$sql2 = "SELECT COUNT(i.user_id) AS images
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
  $result = $site_db->query_firstrow($sql2);
  $num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $user_images, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));

$sql3 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $offset, $user_images";

$result = $site_db->query($sql3);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $user_profile_images .= $lang['no_new_images'];
  $user_profile_images .= "</td></tr></table>";
}
else  {
  $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    $user_named = format_text($image_row['user_name'], 2);
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $user_profile_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $user_profile_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $user_profile_images .= $site_template->parse_template("thumbnail_bit");
    $user_profile_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $user_profile_images .= "</tr>\n";
      $count = 0;
    }
  } // end while
 
  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $user_profile_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $user_profile_images .= "</tr>\n";
    }
  }
  $user_profile_images .= "</table>\n";
} // end else


$site_template->register_vars("user_profile_images", $user_profile_images);
$site_template->register_vars("lang_user_profile_images", $lang['user_profile_images']);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//----------------------------------------------------- 

Open member_profile.html and after:
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>

  or any where else you like images to be shown add:

Code: [Select]
<br />
<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>
      <table width="100%" border="0" cellpadding="4" cellspacing="0">
        <tr>
          <td valign="top" class="head1">{lang_user_profile_images}</td>
        </tr>
        <tr>
          <td class="row1">{user_profile_images}</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br />
{paging}
<br />
<br />

into lang/yourlanguage/main.php
add this anywhere
Code: [Select]
$lang['user_profile_images'] = "User added {user_total_images} image(s) to this Gallery";


That's It, Have Fun!
« Last Edit: November 22, 2007, 12:30:50 PM by Nicky »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Show user images in profile
« Reply #1 on: November 05, 2006, 08:15:51 PM »
Code: [Select]
$sql = "SELECT COUNT(user_id) AS images
         FROM ".IMAGES_TABLE."
         WHERE user_id = ".$user_id;

i do not agree with this.. for paging... think... pics there are not visible for guest or images that are locked for another users/guest will be counted too..
paging will be there wrong.

and {paging} you forgot in template ;)
« Last Edit: November 05, 2006, 08:32:52 PM by Nicky »
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Vladec

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD] Show user images in profile
« Reply #2 on: November 05, 2006, 08:24:41 PM »
Sorry, my mystake  :oops: i've modifed the mod with {paging} now it looks ok.

Nicky, i didn't anderstand that:
Quote
i do not agree with this.. for paging... think... pics there are not visible for guest or images that are locked for another users/guest..
paging will be there wrong.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Show user images in profile
« Reply #3 on: November 05, 2006, 08:31:54 PM »
i edited your paging SQL
to
Code: [Select]
$sql = "SELECT COUNT(i.user_id) AS images
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";

==EDITED==
{paging} in template
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Darkness2001

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • photo-galerie-online
Re: [MOD] Show user images in profile
« Reply #4 on: November 12, 2006, 03:29:38 PM »
Hello Nicky,

thanks for this ;-)

Greez Darkness  :mrgreen:

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Show user images in profile
« Reply #5 on: November 21, 2006, 02:13:59 AM »
Vladec, how's implementation of lang packs going?
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [MOD] Show user images in profile
« Reply #6 on: November 21, 2006, 02:08:24 PM »
Thanks for this mod

 8)

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Show user images in profile
« Reply #7 on: November 22, 2006, 07:51:37 AM »
 :lol: This is a great mod! And it works! (I was serching this more time ago..)
« Last Edit: November 23, 2006, 04:30:08 PM by ccsakuweb »
: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 Philmax

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • Fotos-zeigen.de
Re: [MOD] Show user images in profile
« Reply #8 on: December 05, 2006, 06:28:37 PM »
Nach dem Einbau dieses Mods bekomme ich im Kontrolzentrum folgende Fehlermeldung:
After the installation of this Mods I get the following error message in the Controlpanel:

Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(*) as user_count_images FROM 4images_images WHERE user_id =
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

DB Error: Bad SQL Query: SELECT COUNT(i.user_id) AS images FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0)
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND i.cat_id NOT IN (0)' at line 4

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, i.image_photographer, c.cat_name, u.user_name FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 0, 20
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/htdocs/digitcom/includes/db_mysql.php on line 116

Wer kann mir beim beheben helfen???
Fotos-zeigen.de
Zeig deine schönsten Fotos!

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Show user images in profile
« Reply #9 on: December 05, 2006, 08:55:09 PM »
i saw your site, i see there that you have avatar mod too, maybe is this the reason, and somewhere you did the mistake.
i saw that bildergallery (ivan) have avatar mod and it works for him > http://www.bildergallery.com/member.php?action=showprofile&user_id=1&l=deutsch
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Philmax

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • Fotos-zeigen.de
Re: [MOD] Show user images in profile
« Reply #10 on: December 05, 2006, 09:26:07 PM »
Before i add this mod to my gallery it works without errors.
The error comes when i want to edit my profile, not when i show the profil.

Here is my member.php

http://www.philmax.de/member.txt
Fotos-zeigen.de
Zeig deine schönsten Fotos!

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Show user images in profile
« Reply #11 on: December 05, 2006, 09:53:18 PM »
you added mod before
Code: [Select]
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
.........

instead of below
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Philmax

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • Fotos-zeigen.de
Re: [MOD] Show user images in profile
« Reply #12 on: December 05, 2006, 10:01:58 PM »
Thats it.

 :roll:
Fotos-zeigen.de
Zeig deine schönsten Fotos!

Offline gustav

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: [MOD] Show user images in profile
« Reply #13 on: December 05, 2006, 11:27:33 PM »
I just installed the mod and it works fine.... but paging is visible two times below the thumbnails.... I already removed the paging tag from the html code... but there is still one paging left.... seems it gets generated somewhere in the member.php... cause there are definately no more paging tags in the html file.....
Please help, as I need to remove paging for this mod...

Thanx

Offline LoganSix

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://www.dean-logan.com/gallery
Re: [MOD] Show user images in profile
« Reply #14 on: December 29, 2006, 04:31:54 PM »
Nice mod.
Thanks.