PHP Warning
-
hello,
i got a PHP warning when i click on ADD(or Remove) favorite link on post page.
Warning: Creating default object from empty value in /home/wp-content/plugins/wp-favorite-posts/wp-favorite-posts.php on line 152
the plugin is working just fine but i’ll appreciate it if you guys could give me a hint on how can fix this so the warning message goes away.
here is the line of codes that the warning message is referring to :
function wpfp_link( $return = 0, $action = "", $show_span = 1, $args = array() ) { global $post; //print_r($post); $post_id = &$post->ID; <=== This is the line 152 extract($args); $str = ""; if ($show_span) $str = "<span class='wpfp-span'>"; $str .= wpfp_before_link_img(); $str .= wpfp_loading_img(); if ($action == "remove"): $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); elseif ($action == "add"): $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); elseif (wpfp_check_favorited($post_id)): $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); else: $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); endif; if ($show_span) $str .= "</span>"; if ($return) { return $str; } else { echo $str; } }
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Warning’ is closed to new replies.