Plugin is not using the query field
-
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
-
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.
PHP 5.6.36
I did both your suggestions and nothing changed.
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 8 years ago by
jimhu.
This line was put between 179 and 180.
echo __METHOD__.’: ‘.$this->options[‘facprops’][$key][‘query’].”<hr>”;
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.
Rollback complete. Have a look now as you can see the queries are blank from Options.
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.
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
Aargh. The stupid wordpress site changed all the straight quote marks to curly ones. That’s what caused your error.
-
This reply was modified 8 years ago by
jimhu.
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.
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 8 years ago by
jimhu.
Thanks! Works now.
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.
-
This reply was modified 8 years ago by
The topic ‘Plugin is not using the query field’ is closed to new replies.