• I posted in another thread a few months ago but didn’t get a reply there. I realized the legacy shortcodes don’t support id=album-name anymore. Any plans to reinstate? I have hundreds of galleries on my site, I would not be able to convert each gallery name to its corresponding id/number. Tested on a local development duplicate.

    [nggallery id=my-album] <= broken

    [nggallery id=345] <= works

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes, been trying to get this to work as well but no luck.

    Thread Starter dalexisv83

    (@dalexisv83)

    I wrote a quick workaround using the old plugin code.

    On line 152 of module.nextgen_basic_gallery.php there is a function called render that takes the data from the shortcode. This function doesn’t check against the DB if the ID is not numeric since that practice was deprecated even in the old plugin.

    I changed lines 152-154 from:

    function render($params, $inner_content=NULL)
        {
            $params['gallery_ids']     = $this->_get_param('id', NULL, $params);

    To:

    function render($params, $inner_content=NULL)
        {
            global $wpdb;
    	$id = $this->_get_param('id', NULL, $params);
    
    	if( !is_numeric($id) ) {
    		$id = $wpdb->get_var( $wpdb->prepare ("SELECT gid FROM $wpdb->nggallery WHERE name = '%s' ", $id) );
    	}
            $params['gallery_ids']     = $id;

    Couple things!! This will get removed if you update the plugin. Also, this doesn’t support multiple gallery ID’s in one shortcode (which might be why it was deprecated, I dunno).

    The render function only works for galleries not slideshows. You’d have to do a similar code swap for the function called render_slideshow on line 229 probably.

    Any chance of getting this in the next update Photocrati? Would be much appreciated.

    Plugin Contributor photocrati

    (@photocrati)

    @dalexisv83 – You are more than welcome to suggest this as a Feature Request (https://www.nextgen-gallery.com/feature-voting/) but as you noted this particular shortcode functionality was deprecated and therefore was not translated into the current NextGEN Gallery.

    That’s doesn’t make it any less an interesting idea to re-implement though.

    – Cais.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Legacy shortcode id=album-name no longer works’ is closed to new replies.