[PATCH] undefined variable warning
Notice: Undefined property: stdClass::$id in /path/to/wp-content/plugins/threewp-broadcast/include/threewp_broadcast/BroadcastData.php on line 54
In the sql() method change
$bcd->id = $result->id;
if ( !empty($result->id) ) $bcd->id = $result->id;
A bit of background on this issue: The method is called by sql_get_broadcast_datas() in ThreeWP_Broadcast.php with:
$query = sprintf( "SELECT * FROM<code>%s</code>WHERE<code>blog_id</code>= '%s' AND<code>post_id</code> IN ('%s')", $this->broadcast_data_table(), $blog_id, implode( "', '", $post_ids ) ); $results = $this->query( $query ); foreach( $results as $index => $result ) $results[ $index ][ 'data' ] = BroadcastData::sql( $result );
Problem is that the broadcast_data_table doesn’t have an ID column, so in your sql() method the line
$bcd->id = $result->id;will never actually work.
- The topic ‘[PATCH] undefined variable warning’ is closed to new replies.