Question

I am using the Penny auction theme and I am getting the following error message:

Uncaught SyntaxError: Unexpected token <     penny_scripts.js:126

When I expand the error it shows:

(anonymous function)   penny_scripts.js:126
$.ajax.success         smart-updater.js:146
j                      jquery.js?ver=1.11.0:2
k.fireWith             jquery.js?ver=1.11.0:2
x                      jquery.js?ver=1.11.0:4
b                      jquery.js?ver=1.11.0:4

Line 126 of penny_scripts.js is

var myObj = eval("(" + data + ")");
for (var i = 0; i < myObj.length; i++) <---This line
{
    pid                 = myObj[i].pid;
    rnd                 = myObj[i].rnd;
    remaining_time      = myObj[i].remaining_time;
    current_bid         = myObj[i].current_bid;

If I do alert(data); then I get the following message

enter image description here

Line 1092 of functions.php is:

$info = array(); global $wpdb;
$my_arr = $_POST['my_values'];
$OKOK = $_POST['OKOK'];

foreach($my_arr as $id_plus_rand)
{
$exp = explode("_",$id_plus_rand);
$pid = $exp[0];
$rnd = $exp[1];

//----------------------
$newpid = array();  

$highest_bidder_id  = PennyTheme_get_highest_bid_owner_obj($pid);

if($highest_bidder_id == false) $highest_bidder = "0";
else {

    $s = "select user_login from ".$wpdb->users." where ID='{$highest_bidder_id->uid}'";
    $r = $wpdb->get_results($s); $r = $r[0];
    $highest_bidder =   $r->user_login;

}       

$newpid['highest_bidder'] = $highest_bidder;    
$newpid['highest_bidder_id'] = $highest_bidder_id->id;      
$newpid['pid'] = $pid;
$newpid['rnd'] = $rnd;
$newpid['remaining_time'] = get_post_meta($pid, 'ending', true) - current_time('timestamp',0);
$newpid['current_bid'] = PennyTheme_get_show_price(get_post_meta($pid, 'current_bid', true));


if($OKOK == "1"):

//$closed = get_post_meta($pid, 'closed', true);
//$post = get_post($pid);               

$bids = "select * from ".$wpdb->prefix."penny_bids where pid='$pid' order by id DESC limit 13";
$res  = $wpdb->get_results($bids);

$all_bids = '';

if(count($res) > 0)
{
    $all_bids .= '<table width="100%">';
    $all_bids .= '<thead><tr>';
    $all_bids .= '<th>'.__('Username','PennyTheme').'</th>';
    $all_bids .= '<th>'.__('Bid Amount','PennyTheme').'</th>';
    //      echo '<th>'.__('Date Made','PennyTheme').'</th>';

    $all_bids .= '</tr></thead><tbody>';
    //-------------

    foreach($res as $row)
    {
        $user = get_userdata($row->uid);
        $s = "select user_login from ".$wpdb->users." where ID='{$row->uid}'";
        $r = $wpdb->get_results($s);

        $all_bids .= '<tr>';
        $all_bids .= '<th>'.$r[0]->user_login.'</th>';
        $all_bids .= '<th>'.PennyTheme_get_show_price($row->bid).'</th>';
        //  echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';

        $all_bids .= '</tr>';

    }

    $all_bids .= '</tbody></table>';
}
else $all_bids .= __("No bids placed yet.", 'PennyTheme');

$newpid['bidders'] = $all_bids;
endif;

array_push($info,$newpid); 

}
header('Content-type: application/json');   <---Line 1092

Line 146 of smart-update.js is:

if(es.rCallback && rCallback && es.rCallback.search(rCallback) != -1) {
window[rCallback](data);
} else  { 
es.callback(data);  <---This line
}

Line 1395 of plugin.php:

function remove_menu_page( $menu_slug ) {
global $menu;

foreach ( $menu as $i => $item ) {  <-- This line
    if ( $menu_slug == $item[2] ) {
        unset( $menu[$i] );
        return $item;
    }
}

return false;
 }

I only get this error message when I am not logged into the site or logged in with an account that the user level is below Contributor.

I am unsure why that is happening or how to fix this. Any help is appreciated.

Was it helpful?

Solution

The above problem was caused by a plugin that I had enabled on my site. When I updated it, the error stopped. The error doesn't happen with version 2.19.5 or above. Changelog for 2.19.5

  • Remove Testimonials menu for authors removal code <--This was the change that fixed the error for me.
  • Require Aihrus Framework 1.1.4
  • Revise premium introduction
  • Update premium links
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top