[Plugin: Ieteikt Draugiem] Bugs in code
-
Plugin version: 1.2.2
———-
1. Label for=”” references ID, not name, so input should have that id, otherwise now – clicking on text, does not change checkbox state.
LINE 47:
input .. name="ieteikt_draugiem" id="ieteikt_draugiem"
Also – “]” character after it and unneeded br tag.LINE 123:
input .. name="ieteikt_global" id="ieteikt_global"———-
2. If checkbox is (somehow – see 3rd) is unchecked, then it ruins content, because does not “return $content”, if $ieteikt is false.
Should always return $content even if nothing changed/added.
LINE 26:
if($display == 1) return $content.'......';
LINE 27 – should be:
else return $content;———-
3.1. ieteikt_post_display() functon does not properly read post meta value.
LINE 42:
$ieteikt = get_post_meta($post_id, 'ieteikt_draugiem', true);
Should be:
`global $post;
$ieteikt = get_post_meta($post->ID, ‘ieteikt_draugiem’, true);`———-
3.2.
“0” is considered empty, so this check always evaluate to false – no matter what state meta value is:
Also get_post_meta always returns something so no need for isset()
LINE 45:
if(isset($ieteikt) && !empty($ieteikt) && $ieteikt == 0)
Should be just:
if($ieteikt == 0)———-
As for that “checked=’checked'” checking – there is function:
"checked($options)"
The topic ‘[Plugin: Ieteikt Draugiem] Bugs in code’ is closed to new replies.