Author Topic: How to include a 2nd Lightbox?  (Read 2264 times)

0 Members and 1 Guest are viewing this topic.

Offline DPHAZE

  • Newbie
  • *
  • Posts: 12
    • View Profile
How to include a 2nd Lightbox?
« on: August 09, 2010, 04:44:32 PM »
Hello everybody,

first of all i want to say how brilliant that gallery is. very, very useful.

but i was wondering, if it's possible to include a 2nd or 3rd lightbox. So i searched the hole forum, to find a solution and i found some mods like the "Multi Lightboxes 1.03 "-Mod.
But that pretty nice Mod is not what i'm looking for, because it relates to registered members.

I try to explain my idea.
I want to include a 2nd lightbox (public) to give our guests the possibility to request certain images apart from the usage of the "normal" lightbox.
that means, every user/guest of our gallery should be able to assort different images to put these images in a "request-box" to start a request or assort some images to put it in the basic lightbox to create a album or whatever they do ;).

Like for instance: a) the user/guest wants to put imageXY.jpg to the lightbox, so he can download it or assort a album.  
                        b) additionally the same user/guest wants to put imageYZ.jpg to the request box, so he can start to request a hole bunch of images at one action - without the dependence of the images in the basic lightbox.
                            The "request-box" should give him the possibility to assort different images. Not the ones in the basic lightbox. this is the important fact.
                            (at this point i have to say, that i already found the "email list of images"- Mod, but this one depends on the basically included lightbox).

So, my approach to include that function were the following steps:

1. i included a new table in my sql with the certain keys etc. (nearly the same like the basic lightboxes table) and named it "request" (request_id, user_id, request_lastaction, request_images_ids and the related keys).
2. i duplicated and modified the lightbox.php and renamed the copy to request.php. i coded a new request.html and request_thumbnail_bit.html, so that the files fits to my wishes and integrated the files in my templates folder.
3. after that step, i modified the files constants.php, functions.php and page_header.php to include my new request-files to the system's needs. until that step, all was/is quite nice.
4. now i modified the sessions.php in the following steps:
   a) i copied the "if ($user_id != GUEST) etc...." - Part, which is enclosed in the "function load_user_info($user_id = GUEST)" and relates to the lightbox-sessions-stuff.
   b) I pasted the hole string inside below the original code and above the "if (empty($user_info[$user_table_fields['user_id']]"-String.
   c) i modified the pasted string, so it fits to my new sql request_table.
   d) after that, i commented out the original lightbox related code and tested/checked my "new request-box". yes, it is working. nice.

after all that steps were done, i wanted to test, if the both "boxes" are working together. so, i "reactivated" the commented lightbox-parts in the sessions.php.
but unfortunately only my new request-box works, the basic lightbox doesn't.
so ok, i commented out my new "request-parts" in the sessions.php. and the effect was, the original lightbox works.
ok, now i was able to isolate my probs. i tried different things to get these bloody boxes running. but finally all of my attempts failed. either the request-box works or the lightbox but never both together.

Now my question. ;)

Is anybody out there, who is able and willing to point out the problem or give me a hint to solve that. because i'm more in the front-end design business than in the php/back-end stuff. it makes me crazy. ;)

Below you can find my sessions.php modification:

Code: [Select]
......................................................................
//START ORIGINAL CODE
function load_user_info($user_id = GUEST) {
    global $site_db, $user_table_fields, $additional_user_fields;

    if ($user_id != GUEST) {
      $sql = "SELECT u.*, l.*
              FROM (".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l)
              WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");
      $user_info = $site_db->query_firstrow($sql);
      if (!$user_info) {
        $sql = "SELECT *
                FROM ".USERS_TABLE."
                WHERE ".get_user_table_field("", "user_id")." = $user_id";
        $user_info = $site_db->query_firstrow($sql);
        if ($user_info) {
          $lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
          $sql = "INSERT INTO ".LIGHTBOXES_TABLE."
                  (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
                  VALUES
                  ('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          $site_db->query($sql);
          $user_info['lightbox_lastaction'] = $this->current_time;
          $user_info['lightbox_image_ids'] = "";
        }
      }
    }
//END ORIGINAL CODE

//START REQUEST CODE
    if ($user_id != GUEST) {
      $sql = "SELECT u.*, r.*
              FROM (".USERS_TABLE." u, ".REQUEST_TABLE." r)
              WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND r.user_id = ".get_user_table_field("u.", "user_id");
      $user_info = $site_db->query_firstrow($sql);
      if (!$user_info) {
        $sql = "SELECT *
                FROM ".USERS_TABLE."
                WHERE ".get_user_table_field("", "user_id")." = $user_id";
        $user_info = $site_db->query_firstrow($sql);
        if ($user_info) {
          $request_id = get_random_key(REQUEST_TABLE, "request_id");
          $sql = "INSERT INTO ".REQUEST_TABLE."
                  (request_id, user_id, request_lastaction, request_image_ids)
                  VALUES
                  ('$request_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          $site_db->query($sql);
          $user_info['request_lastaction'] = $this->current_time;
          $user_info['request_image_ids'] = "";
        }
      }
    }
//END REQUEST CODE
    if (empty($user_info[$user_table_fields['user_id']])) {
      $user_info = array();
      $user_info['user_id'] = GUEST;
      $user_info['user_level'] = GUEST;
      $user_info['user_lastaction'] = $this->current_time;.........and so on etc. pp...........

My gallery version is 1.7.7.

And i don't know if this is important to get assistance, but i owned the full "4images licence bundle".


I want to say thanks in advance and at least i hope all my written stuff above is reasonably well understandable.

cheers and i pray to the PHP-God











« Last Edit: August 09, 2010, 05:09:49 PM by DPHAZE »