WordPress.org

Forums

mqTranslate
Custom menu links bug (6 posts)

  1. wpetgb
    Member
    Posted 1 year ago #

    Hi developer,

    I am facing a bug in the latest 3 versions of your plugin.

    I hope you understand my explanation.

    I have a menu with some custom links. The HREF for all these menu item = #. Below those menu items i have sub items which are linked to real wordpress pages.

    If i am visiting the website and standing on the home page (www.website.com/en) all the custom menu items get the class "current-menu-item".

    The problem only exists when visiting the home page, not the others.

    I have looked up your code, and noticed this change causes the problems:

    function qtrans_parseURL($url) {
    	$result = parse_url($url);
    	if ($result === false)
    		return __legacy_qtrans_ParseURL($url);
    
    	$result = $result + array(
    			'scheme' => '',
    			'host' => '',
    			'user' => '',
    			'pass' => '',
    			'path' => '',
    			'query' => '',
    			'fragment' => ''
    	);
    
    	if (isset($result['port']))
    		$result['host'] .= ':'. $result['port'];
    
    	return $result;
    }
    
    function __legacy_qtrans_ParseURL($url) {
    	$r  = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
    	$r .= '(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
    
    	preg_match ( $r, $url, $out );
    	$result = @array(
    			"scheme" => $out[1],
    			"host" => $out[4].(($out[5]=='')?'':':'.$out[5]),
    			"user" => $out[2],
    			"pass" => $out[3],
    			"path" => $out[6],
    			"query" => $out[7],
    			"fragment" => $out[8]
    	);
    	return $result;
    }

    This is the structure of my menu:

    home
    custom menu item 1 with url = #
      - Sub item to real page 1
      - Sub item to real page 2
      - Sub item to real page 3
    custom menu item 2 with url = #
      - Sub item to real page 1
      - Sub item to real page 2
      - Sub item to real page 3
    custom menu item 3 with url = #
      - Sub item to real page 1
      - Sub item to real page 2
      - Sub item to real page 3

    The problem stops after replacing this code with the old code from a previous version.

    I hope you are able to fix this bug.

    Kind regards,

    wpetgb

    https://wordpress.org/plugins/mqtranslate/

  2. masterbip
    Member
    Posted 1 year ago #

    I got the same issue here. If I create a custom link to an anchor (#item) The plugin replace the output href link from
    <a href="#item">
    to
    <a href="http://www.mysite.com/#item">

    Breaking my smooth scroll navigation...

    Any help?
    Thanks in advance.

  3. Tim Morley
    Member
    Posted 1 year ago #

    I have the same bug, described here:
    http://wordpress.org/support/topic/new-problem-menu-link-to-langde-no-longer-works?replies=1

    I use custom menus to switch languages (linking to lang=en etc.) but now they're broken. :(

  4. masterbip
    Member
    Posted 1 year ago #

    I figured out that this is caused with the MQTRANSLATE plugin. Y changed back to qTranslate and the problem is solved. It is not a wordpress issue but that plugin problem.

    Thanks!

  5. MarionWante
    Member
    Posted 1 year ago #

    There is a bug somewhere in mqtranslate_utils.php.
    With every update I replace this particular file with a previous one from an older version and ever since no problems with custom links anymore.
    Hope this helps someone.

  6. masterbip
    Member
    Posted 1 year ago #

    For sure it is a plugin "bug" ... Can the plugin creator solve this "issue"

    Thanks!!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic