I got an error like this: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/manzoon/public_html/wp-content/themes/clipper/includes/theme-voting.php on line 135 The php code is: // calculate the total successful percentage and round to remove all decimals if($row->votestotal>0) $votes_percent = round($row->votesup / $row->votestotal * 100); else $votes_percent = 100; // update/create meta keys on the post so it's easy to call from the loop update_post_meta($post_id, $app_abbr. '_votes_up', $row->votesup); update_post_meta($post_id, $app_abbr. '_votes_down', $row->votesdown); update_post_meta($post_id, $app_abbr. '_votes_percent', $votes_percent); echo $votes_percent . '%'; // send back the % result so we can update the coupon % value in real-time die; // so it doesn't return an extra zero } // check if the visitor or user has already voted // called within the coupon loop function clpr_vote_check($post_id, $the_trans) { // see if the post id exists in the array meaning they already voted [COLOR="#FF0000"] if (in_array($post_id, $the_trans))[/COLOR] return true; else return false; } Code (markup): The red line is the line 135 which marked as an error, how to fix it? Thanks for your help! You also can check the problem on my site couponbanks.com In the rating area, thanks for everyone.
Change: function clpr_vote_check($post_id, $the_trans) { PHP: To: function clpr_vote_check($post_id, $the_trans) { if (!isset($post_id) || !is_array($the_trans)) { return false; } PHP:
You need to post the code for how you are calling that function. Depending on what is passed into it, the code above might not do what the function description says.
function clpr_vote_check($post_id, $the_trans) { // see if if $the_trans is array if(is_array($the_trans) { // see if the post id exists in the array meaning they already voted if (in_array($post_id, $the_trans)) return true; return false; } } PHP: