• Resolved stagmo

    (@stagmo)


    I’m trying to add a field to the gallery settings. The field I’m adding is called “Store Link.” I edited the /admin/manage-images.php to have:

    <th align="left"><?php _e('Store Link', 'nggallery') ?>:</th>
    <th align="left"><input type="text" size="50" name="store_link" value="<?php echo $gallery->store_link; ?>"  /></th>

    And added the following to /lib/image.php:

    var $store_link = ''; // Gallery path

    But I don’t know what else needs changing to store this variable wherever the rest are being stored. Basically the purpose is I want to have a button at the bottom of the thumbnail view that links to a page, but the client doesn’t know enough about coding to put the html in for each one, so I wanted to have a link field then use it in /view/gallery.php

    Any ideas?

    http://wordpress.org/extend/plugins/nextgen-gallery/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter stagmo

    (@stagmo)

    Update:
    I found the section in /admin/manage.php where the database is updated. I manually went in and added store_link to the gallery table. After trying this out, it now displays the value in the input box and is properly storing them in the database, but I still haven’t gotten view/gallery.php to display them properly.

    I’m guessing it has something to do with the $gallery classes already being instantiated or something since I made the change to /lib/image.php after activating the plugin. Does anyone know what would fix this issue. Basically it doesn’t want to recognize $gallery->store_link on /view/gallery.php but works fine on /admin/manage-images.php.

    Thread Starter stagmo

    (@stagmo)

    Still searching for a solution.

    Thread Starter stagmo

    (@stagmo)

    Okay, I found it! In case anyone else finds a need to add a variable to the gallery, the last thing you need to do is:
    In nextgen-gallery/nggfunctions.php:
    find the section that starts like this:

    // Populate galleries values from the first image
    	$first_image = current($picturelist);
    	$gallery = new stdclass;
    	$gallery->ID = (int) $galleryID;
    	$gallery->show_slideshow = false;

    And add a line like this that matches your variable name (mine is store_link):

    $gallery->store_link = $first_image->store_link;

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: NextGEN Gallery] Adding a new gallery variable?’ is closed to new replies.