Support » Plugin: Last Viewed Posts » Caused error to appear

  • Plugin did not immediately cause this error, “Warning: Cannot modify header information – headers already sent by…” but eventually it did appear. Once the plugin was deactivated the problem went away.

    I have removed this plugin from 2 if my 3 WordPress sites — I was just in development on the third site & had not installed it yet

    Too bad — it worked fine EXCEPT for the above error.

    http://wordpress.org/extend/plugins/last-viewed-posts/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have a fix for this issue, as well as two other widget related PHP notices. Would be happy to submit it to svn.

    Here’s a diff til then:

    140c140
    <   	if ( !function_exists('register_sidebar_widget') )
    ---
    >   	if ( !function_exists('wp_register_sidebar_widget') )
    142,143c142,144
    < 	register_sidebar_widget('Last Viewed Posts','zg_lwp_widget');
    <   	register_widget_control('Last Viewed Posts','zg_lwp_widget_control', 250, 100);
    ---
    >
    >   	wp_register_sidebar_widget( 'zg_lwp_widget', 'Last Viewed Posts', 'zg_lwp_widget' );
    >   	wp_register_widget_control( 'zg_lwp_widget', 'Last Viewed Posts', 'zg_lwp_widget_control', array('width' => 250, 'height' => 100) );
    146c147
    < add_action('get_header','zg_lwp_header');
    ---
    > add_action('send_headers','zg_lwp_header');

    And here’s a diff which also works:

    123c123
    < 	if ( $_POST['lwp-submit'] ) {
    ---
    > 	if ( isset($_POST['lwp-submit']) && $_POST['lwp-submit'] ) {
    130c130
    < 	$title = attribute_escape( $options['title'] );
    ---
    > 	$title = esc_attr( $options['title'] );
    133c133
    < 	<?php _e('Title:') ?> <input type="text" style="width:250px" id="lwp-title" name="lwp-title" value="<?php echo $title ?>" /></label>
    ---
    > 	<?php _e('Title:') ?> <input type="text" class="widefat" id="lwp-title" name="lwp-title" value="<?php echo $title ?>" /></label>
    140c140
    <   	if ( !function_exists('register_sidebar_widget') )
    ---
    >   	if ( !function_exists('wp_register_sidebar_widget') )
    142,143c142,144
    < 	register_sidebar_widget('Last Viewed Posts','zg_lwp_widget');
    <   	register_widget_control('Last Viewed Posts','zg_lwp_widget_control', 250, 100);
    ---
    >
    >   	wp_register_sidebar_widget( 'zg_lwp_widget', 'Last Viewed Posts', 'zg_lwp_widget' );
    >   	wp_register_widget_control( 'zg_lwp_widget', 'Last Viewed Posts', 'zg_lwp_widget_control', array('width' => 250, 'height' => 100) );
    146c147
    < add_action('get_header','zg_lwp_header');
    ---
    > add_action('wp','zg_lwp_header');			// We use <code>wp</code> because: no output has been sent, and is_single() et al. is available
    148c149
    < ?>
    \ No newline at end of file
    ---
    > ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Caused error to appear’ is closed to new replies.