• Resolved uvwebdesign

    (@uvwebdesign)


    I create a new key called “Profs” and then an associated query, but the plugin is using the KEY as the query and not what is in the query field.

    The results that show are for the KEY and not the query. Please assist to resolve this issue.

    Thanks

Viewing 14 replies - 16 through 29 (of 29 total)
  • Plugin Author jimhu

    (@jimhu)

    What I now think is happening:

    the options are loading into $this->options, so something is evaluating as false in the if statement from lines 181-184 in the getQueryFromOptions method, which where I had you insert the code that gave no output. I have no idea why any of those wouldn’t return true, though.

    Maybe comment out 181-183 and see what happens? If that works, uncomment each to see which is the offending test.

    If it doesn’t work, try putting the statement that gave no output above the if statement.

    Thread Starter uvwebdesign

    (@uvwebdesign)

    PHP 5.6.36

    Thread Starter uvwebdesign

    (@uvwebdesign)

    I did both your suggestions and nothing changed.

    Plugin Author jimhu

    (@jimhu)

    So not even any output from putting the diagnostic above the if statement?!!

    That makes it sound like the execution isn’t even getting there. What did you put between 179 and 180?

    	function getQueryFromOptions($key){
    179		$key = trim($key, "\n ()");
    180		if(	
    			is_array($this->options['facprops']) &&
    			array_key_exists($key, $this->options['facprops']) && 
    			isset($this->options['facprops'][$key]['query']) &&
    			$this->options['facprops'][$key]['query'] != ''
    			){
    				return $this->options['facprops'][$key]['query'];
    			}
    			return false;
    	}
    • This reply was modified 6 years, 5 months ago by jimhu.
    Thread Starter uvwebdesign

    (@uvwebdesign)

    This line was put between 179 and 180.

    echo __METHOD__.’: ‘.$this->options[‘facprops’][$key][‘query’].”<hr>”;

    Plugin Author jimhu

    (@jimhu)

    Did you roll back the other changes first? What I see on your site now looks like the stuff at line 9 is still there. That will prevent seeing anything else. Undo all changes except the $debug = true.

    Thread Starter uvwebdesign

    (@uvwebdesign)

    Rollback complete. Have a look now as you can see the queries are blank from Options.

    Plugin Author jimhu

    (@jimhu)

    At least it’s now showing that the getQueryFromOptions method is being called, even if it’s not working right.

    Before the rollback, the __construct should have set $this->options[‘facprops’], based on the diagnostic you rolled back. That showed that $this->options[‘facprops’][‘test’][‘query’] was set to the string we expected: ‘safe s’.

    The fact that $this->options[‘facprops’][$key][‘query’] is giving nothing now means that either it got unset somehow or the key is messed up. To test that, change the line between 179 and 180 to this pair of lines

    echo __METHOD__."key:$key query:".$this->options[‘facprops’][$key][‘query’].”<hr>”;
    echo __METHOD__."key:test query:".$this->options[‘facprops’]['test'][‘query’].”<hr>”;

    The first one should just tell us if it’s trying ‘test’ as the key. The second will tell us whether something messed up $this->options.

    I’m also wondering if there are other plugins that could be messing things up, because I can’t come up with a mechanism that would cause this.

    Thread Starter uvwebdesign

    (@uvwebdesign)

    I am getting the following error:
    Your PHP code changes were rolled back due to an error on line 180 of file wp-content/plugins/wp-pubmed-reflist/class.wpPubMedRefList.php. Please fix and try saving again. syntax error, unexpected ‘>’

    I will try deactivating some plugins as well and see what happens

    Plugin Author jimhu

    (@jimhu)

    Aargh. The stupid wordpress site changed all the straight quote marks to curly ones. That’s what caused your error.

    • This reply was modified 6 years, 5 months ago by jimhu.
    Thread Starter uvwebdesign

    (@uvwebdesign)

    Ah yes, I tried fixing them but I missed one. Got that fixed.

    I also deactivated all plugins with no change. There aren’t many plugins installed anyway, but that didn’t solve anything.

    Plugin Author jimhu

    (@jimhu)

    Just got back from a seminar. Looking at your site, try this. Change line 179 from

    $key = trim($key, "\n ()");

    to

    $key = trim($key, "\n \"()");

    my theory is that the quote marks surrounding the key are causing the problem.

    also, are the quotes around the key in the shortcode regular quotes or curly quotes?

    • This reply was modified 6 years, 5 months ago by jimhu.
    Thread Starter uvwebdesign

    (@uvwebdesign)

    Thanks! Works now.

    Plugin Author jimhu

    (@jimhu)

    Great! Looks like you need to clean up some of the diagnostics still. I’ll try to push a new version soon with your change.

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘Plugin is not using the query field’ is closed to new replies.