Author Topic: [MOD] Caja en perfil | Lightbox on profile  (Read 14808 times)

0 Members and 1 Guest are viewing this topic.

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
[MOD] Caja en perfil | Lightbox on profile
« on: May 11, 2007, 09:59:15 AM »
COMENTARIO:
^o^ Mi primer mod!! Por supuesto con ayuda de ejemplos para ayudarme y no cometer errores.
 Como es mi primer mod, agradeceria cualquier comentario, ayuda o correcion acerca de este mod, ya que seguramente es redundante y podra optimizarse.

DESCRIPCION:
Este mod permite ver todos los favoritos del usuario (todas las imagenes que tiene en la caja del lightbox) por paging en el perfil de usuario. Podremos elegir cuantas imagenes mostraremos en el perfil por pagina. Seran visibles tanto para usuarios registrados como invitados. No necesita el mod Multilightbox ni ningun otro (nunca he conseguido instalarlo).

DEMO: http://www.myart.es/perfil2.htm  (al final de mi perfil)

ARCHIVOS A MODIFICAR:
- member.php
- includes/page_header.php
- lang/spanish/main.php
- templates/tus_plantillas/member_profile.html



PASOS A SEGUIR PARA LA INSTALACION:


1-. Abrir member.php
Buscar:
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;
  }


Añadir debajo:
Code: [Select]

//----------------------------------------------------------------------------------
//--- COMENZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es ---------------
//----------------------------------------------------------------------------------
$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;
    }
  }
  if ($user_row = get_user_info($user_id)) {
$sql = "SELECT *
        FROM ".LIGHTBOXES_TABLE."
        WHERE user_id = $user_id";
    $user_favoritos_info = $site_db->query_firstrow($sql);
    $num_rows_all = 0;
    if (!empty($user_favoritos_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ",", trim($user_favoritos_info['lightbox_image_ids']));
    $sql = "SELECT COUNT(image_id) AS images
         FROM ".IMAGES_TABLE."
         WHERE image_active = 1 AND image_id IN ($image_id_sql)";
    $result = $site_db->query_firstrow($sql);
    $num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
    $user_total_favorites = $num_rows_all;
$site_template->register_vars("user_total_favorites", $user_total_favorites);
   
unset($user_total_favorites);


$user_favorites = 3; // Indicar cuantas imagenes favoritas quiere mostrar
 
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging_favorites = new Paging($page, $user_favorites, $num_rows_all, $link_arg);
$offset = $getpaging_favorites->get_offset();
$site_template->register_vars(array(
"paging_favorites" => $getpaging_favorites->get_paging(),
"paging_favorites_stats" => $getpaging_favorites->get_paging_stats()
));

  $sql = "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 image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $offset, $user_favorites";
  $result = $site_db->query($sql);
  $num_rows = $site_db->get_numrows($result);
 
  $lightbox_lastaction = format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']);
if (empty($user_info['lightbox_lastaction'])) {
  $lightbox_lastaction = "n/a";
}
$site_template->register_vars("lightbox_lastaction", $lightbox_lastaction);
unset($lightbox_lastaction);
}else{
$num_rows = 0;
}


if (!$num_rows)  {
  $user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $user_profile_favorites .= $lang['lightbox_no_images'];
  $user_profile_favorites .= "</td></tr></table>";
}
else  {
  $user_profile_favorites = "<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)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $user_profile_favorites .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $user_profile_favorites .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

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

unset($user_profile_favorites);

}
//----------------------------------------------------------------------------------
//--- FINALIZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es --------------
//----------------------------------------------------------------------------------


2-. Abrir includes/page_header.php
Buscar:
Code: [Select]

  "lang_lightbox" => $lang['lightbox'],



Añadir debajo:
Code: [Select]

  "lang_favoritos_perfil" => $lang['favoritos_perfil'],



3-. Abrir - lang/spanish/main.php
Buscar:
Code: [Select]

$lang['delete_lightbox_confirm'] = "¿Esta seguro de eliminar su caja de favoritos?";

Añadir debajo:
Code: [Select]

//-----------------------
//--- Favoritas en perfil
//-----------------------
$lang['favoritos_perfil'] = "Ultimos Favoritos de ";


4-. Modifica el numero de la variable $user_favorites para indicar cuantos favoritos mostramos por pagina
- Abrir templates/tus_plantillas/member_profile.html

Añadir debajo o donde quieras que este tu tabla de favoritos:
Code: [Select]

<br><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_favoritos_perfil}{user_name} ({user_total_favorites})<br>{lang_lighbox_lastaction} {lightbox_lastaction}<br>{lang_lighbox_lastaction} {lightbox_lastaction}</td>
        </tr>
        <tr>
          <td class="row1">{user_profile_favorites}</td>
        </tr>
      </table>
    </td>
  </tr>
</table>{paging_favorites}

{lang_favoritos_perfil} es el texto del titulo de la tabla de los favoritos para que lo podais poner en varios idiomas
Si os fijais el paging de los favoritos sera: {paging_favorites}
Ademas podremos usar {user_total_favorites}  para el numero total de favoritos del usuario.
Y {lightbox_lastaction} que da la fecha y hora de la ultima modificacion en la caja del usuario.
Si no tiene favoritos saldra el mensaje de no imagenes del lightbox ( $lang['lightbox_no_images']) diciendo que no tiene favoritos el usuario


Espero vuestros comentarios y que os sirva ^^

STEPS in ENGLISH
« Last Edit: August 02, 2007, 04:23:37 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 prive

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #1 on: May 11, 2007, 03:50:51 PM »
Me parece un MOD interesante, puede que lo utilice más adelante.

Se supone que funciona con la ultima versión, no

Gracias

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #2 on: May 11, 2007, 05:20:13 PM »
no creo que haya problemas.
 ^^ si quieres este fin de semana lo pruebo, pero seguramente ira bien, es un mod sencillo y rapido.
pruebalo y si tienes algun fallo ponlo aqui y enseguida acudire a ayudarte
: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 excitex2

  • Addicted member
  • ******
  • Posts: 1.590
  • He desactivado la galería y el buscador
    • View Profile
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #3 on: May 12, 2007, 12:11:29 AM »
Saludos,,,

Buen MOD felicidades por la aportación.

excitex
Lo importante no es saber,,, lo importante es tener el E-Mail de quien sabe

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #4 on: May 12, 2007, 12:38:49 AM »
 :lol: Gracias!! Tenia muchas ganas de aportar algo a los foros ya que me han ayudado a tener un gran site
Y cuando me pongo pues... me tiro horas y horas hasta que me sale (sobre todo con la lista de amigos XD) aunque segurisimo que fallan en algo.

Gracias a ti excitex2 por todo ^^
: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 diablotgp

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #5 on: August 02, 2007, 01:01:15 AM »
Hello - very good, this i need for my page ;-) what about in english??? PLEASE ore German  :oops: :oops:

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #6 on: August 02, 2007, 04:22:03 PM »

DEMO: http://www.myart.es/perfil2.htm 

FILES TO MODIFY:
- member.php
- includes/page_header.php
- lang/spanish/main.php
- templates/tus_plantillas/member_profile.html


1-. Open member.php
Search:
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;
  }


After add:
Code: [Select]

//----------------------------------------------------------------------------------
//--- COMENZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es ---------------
//----------------------------------------------------------------------------------
$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;
    }
  }
  if ($user_row = get_user_info($user_id)) {
$sql = "SELECT *
        FROM ".LIGHTBOXES_TABLE."
        WHERE user_id = $user_id";
    $user_favoritos_info = $site_db->query_firstrow($sql);
    $num_rows_all = 0;
    if (!empty($user_favoritos_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ",", trim($user_favoritos_info['lightbox_image_ids']));
    $sql = "SELECT COUNT(image_id) AS images
         FROM ".IMAGES_TABLE."
         WHERE image_active = 1 AND image_id IN ($image_id_sql)";
    $result = $site_db->query_firstrow($sql);
    $num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
    $user_total_favorites = $num_rows_all;
$site_template->register_vars("user_total_favorites", $user_total_favorites);
   
unset($user_total_favorites);


$user_favorites = 3; // Indicar cuantas imagenes favoritas quiere mostrar
 
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging_favorites = new Paging($page, $user_favorites, $num_rows_all, $link_arg);
$offset = $getpaging_favorites->get_offset();
$site_template->register_vars(array(
"paging_favorites" => $getpaging_favorites->get_paging(),
"paging_favorites_stats" => $getpaging_favorites->get_paging_stats()
));

  $sql = "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 image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $offset, $user_favorites";
  $result = $site_db->query($sql);
  $num_rows = $site_db->get_numrows($result);
 
  $lightbox_lastaction = format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']);
if (empty($user_info['lightbox_lastaction'])) {
  $lightbox_lastaction = "n/a";
}
$site_template->register_vars("lightbox_lastaction", $lightbox_lastaction);
unset($lightbox_lastaction);
}else{
$num_rows = 0;
}


if (!$num_rows)  {
  $user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $user_profile_favorites .= $lang['lightbox_no_images'];
  $user_profile_favorites .= "</td></tr></table>";
}
else  {
  $user_profile_favorites = "<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)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $user_profile_favorites .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $user_profile_favorites .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

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

unset($user_profile_favorites);

}
//----------------------------------------------------------------------------------
//--- FINALIZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es --------------
//----------------------------------------------------------------------------------


2-. Open includes/page_header.php
Search:
Code: [Select]

  "lang_lightbox" => $lang['lightbox'],



After Add:
Code: [Select]

  "lang_favoritos_perfil" => $lang['favoritos_perfil'],



3-. Open - lang/spanish/main.php
Search:
Code: [Select]

$lang['delete_lightbox_confirm']

Add after in a new line:
Code: [Select]

//-----------------------
//--- Favoritas en perfil
//-----------------------
$lang['favoritos_perfil'] = "Last favorites from ";


4-. Modify the number from the variable $user_favorites, it will show the last "number that you have chosen" favorites pics in the profile

- Open templates/tus_plantillas/member_profile.html

Add after or where you want:
Code: [Select]

<br><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_favoritos_perfil}{user_name} ({user_total_favorites})<br>{lang_lighbox_lastaction} {lightbox_lastaction}<br>{lang_lighbox_lastaction} {lightbox_lastaction}</td>
        </tr>
        <tr>
          <td class="row1">{user_profile_favorites}</td>
        </tr>
      </table>
    </td>
  </tr>
</table>{paging_favorites}

{lang_favoritos_perfil} is the title from the favorites table.
The paging from the favorites would bea: {paging_favorites}
And we could use {user_total_favorites} , it is the total favorites from the user.
And {lightbox_lastaction} is the last date and hour that the ligthbox was modified.
If you dont have favorites, it will show $lang['lightbox_no_images']
: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 diablotgp

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #7 on: August 03, 2007, 01:56:00 PM »
THANKS THANKS THANKS !!!!!!!!!!!!!

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Caja en perfil | Lightbox on profile
« Reply #8 on: August 03, 2007, 02:40:10 PM »
your welcome ;)
: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