WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Activate permalinks in NextGEN Gallery 1.8 and qTranslate 2.5.21 incompatibility (4 posts)

  1. HFigarella
    Member
    Posted 2 years ago #

    Activate permalinks in NextGEN Gallery 1.8 produces this url:

    http://site/nggallery?lang=en/galleryname.

    I modified nextgen-gallery/lib/rewrite.php as shown below and it works for me. Maybe there is another way. Changing qtranslate is not an option for me.

    // 1. Post / Page url + main slug
                //$url = trailingslashit ( get_permalink ($post->ID) ) . $this->slug;
                $url = trailingslashit ( $_SERVER['REQUEST_URI'] ) . $this->slug; 			// Modified by Horacio  ***************
    
    			// 2. Album, pid or tags
    			if (isset ($args['album']) && ($args['gallery'] == false) )
    				$url .= '/' . $args['album'];
    			elseif  (isset ($args['album']) && isset ($args['gallery']) )
    				$url .= '/' . $args['album'] . '/' . $args['gallery'];
    
    			if  (isset ($args['gallerytag']))
    				$url .= '/tags/' . $args['gallerytag'];
    
    			if  (isset ($args['pid']))
    				$url .= '/image/' . $args['pid'];			
    
    			// 3. Navigation
    			if  (isset ($args['nggpage']) && ($args['nggpage']) )
    				$url .= '/page-' . $args['nggpage'];
    
    			// 4. Show images or Slideshow
    			if  (isset ($args['show']))
    				$url .= ( $args['show'] == 'slide' ) ? '/slideshow' : '/images';
    
    			global $q_config;																		// Added by Horacio (begins) ************
    			$lang = qtrans_getLanguage();
    			if(!$q_config['hide_default_language']||$lang!=$q_config['default_language']){
    				if(strpos($url,'?')===false) {
    					$url .= '?';
    				} else {
    					$url .= '&';
    				}
    				$url .= "lang=".$lang;
    			}																						// Added by Horacio (ends) ************

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

  2. HFigarella
    Member
    Posted 2 years ago #

    NextGen Gallery 1.8.2 and qTranslate 2.5.21 are working fine for me now!

    For those of us with multilingual sites:

    qtranslate allows you to have as many languages as .mo you have on your site.

    To stop NextGen Gallery from redirecting the web site to the default language as you click on albums, galleries, and navigation buttons, NextGen Gallery's code has to be modified to use a qtraslate function:

    from:
    $nggRewrite->get_permalink(params) where params varies in pages nggfunctions.php, lib/navigation.php and lib/rewrite.php

    to:
    qtrans_convertURL($nggRewrite->get_permalink(params))

  3. thematrixit
    Member
    Posted 2 years ago #

    For WP 3.2.1, NextGen 1.8.3 and qTranslate 2.5.24, it's not working and $nggRewrite->get_permalink is not found on lib/rewrite.php.

    And with the first method, Query Mode (?lang=en), redirection stops, but it is not loading gallery.

  4. thematrixit
    Member
    Posted 2 years ago #

    Found it, have to replace

    $nggRewrite->get_permalink ( $args );

    with:

    qtrans_convertURL($nggRewrite->get_permalink ( $args )).'/';

    in nggfunctions.php

    http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=197&sid=96ddcf0db7aac217af58c861df2bb64c&start=10

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic