archetyped / simple-lightbox

The highly customizable lightbox for WordPress
http://archetyped.com/tools/simple-lightbox/
GNU General Public License v2.0
75 stars 33 forks source link

Conflict with wpdb::prepare function? #1056

Closed rdieringer closed 7 months ago

rdieringer commented 9 months ago

Description of Problem

I'm running current versions of WP and Simple Lightbox. I have a custom template that dynamically targets a folder of images that I'm then trying to display through the plugin. The template relevant codes is:

    $imageFiles = glob($directory . '*.jpg'); // Assuming JPEG files; adjust as needed

    if (!empty($imageFiles)) {
        echo '<div id="gallery">';
        foreach ($imageFiles as $imageFile) {
            $thumbnail = $baseURL . rawurlencode(basename($imageFile));
            $fullsize = $baseURL . rawurlencode(basename($imageFile));

            echo '<a href="' . esc_url($fullsize) . '" title="' . esc_attr($folder) . '">';
            echo '<img src="' . esc_url($thumbnail) . '" alt="' . esc_attr($folder) . '">';
            echo '</a>';
        }
        echo '</div>';

        // Manually activate Simple Lightbox for the gallery
        $gallery_content = ob_get_clean();
        if (function_exists('slb_activate')) {
            $gallery_content = slb_activate($gallery_content);
        }

        echo $gallery_content;
    } else {
        echo 'No photos found in the folder.';
    }

where I get the folder name from the referring link. I get the following error: PHP Notice: Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (4) for the number of arguments passed (2).

Details

archetyped commented 9 months ago

Hi, can you please provide the full error output including the call stack so that I can see if and where in SLB's code this error message is coming from?

Please also update your original post to provide the details necessary to evaluate your issue further.

Also, it does not appear that your code has an active output buffer, so calling ob_get_clean() will not contain any content for SLB to activate. See ob_get_clean() documentation for more details.

archetyped commented 7 months ago

Hi, are you still experiencing an issue with SLB? If so, please provide the requested details and I would be glad to take a look.

This ticket will be closed in 24 hours due to inactivity.

rdieringer commented 7 months ago

I decided to go in a different direction and use a different plugin for my galleries. Not quite the functionality I was hoping for but accomplishes the goal sufficiently. Rick Dieringer @.*** 513.621.2544

On Mar 27, 2024, at 3:36 PM, Archetyped @.***> wrote:

Hi, are you still experiencing an issue with SLB? If so, please provide the requested details and I would be glad to take a look.

This ticket will be closed in 24 hours due to inactivity.

— Reply to this email directly, view it on GitHub https://github.com/archetyped/simple-lightbox/issues/1056#issuecomment-2023817819, or unsubscribe https://github.com/notifications/unsubscribe-auth/BF4ABW62ELSWJXHJGGHLHDTY2MNSLAVCNFSM6AAAAABCZGI5POVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRTHAYTOOBRHE. You are receiving this because you authored the thread.