Forums

Join
bbPress Support ForumsPluginsI can't work out what's wrong? Producing a fatal error.

Info

I can't work out what's wrong? Producing a fatal error.

  1. Hi all!

    I'm upgrading a plugin to use the administration menus, rather than editing within the plugin itself. I have used admin functions before (such as add_action), but for the life of me I can't figure out why I'm having problems adding it this time around.

    Basically, on activation of the following plugin I get a "this plugin has caused a fatal error" (but it is activated), and on deactivation I get "Warning: Cannot modify header information - headers already sent by (output started at /home/britain/public_html/forum/bb-plugins/top-posters-code.php:32) in /home/britain/public_html/forum/bb-includes/pluggable.php on line 232".

    Here is the code

    <?php
    /*
    Plugin Name: Show Top Posters (backup)
    Plugin URI: http://www.gospelrhys.co.uk/bbpress-plugin-show-top-posters
    Description:  Readers with the most postes are displayed on your bbpress forum, with their names (linked to their website if they provided one). Based on the <a href="http://www.pfadvice.com/wordpress-plugins/show-top-commentators/" target="_blank">Show Top Commenters</a> plugin for WordPress by <a href="http://www.savingadvice.com" target="_blank">Nate Sanden</a>
    Version: 1.2
    Author: Rhys Wynne
    Author URI: http://www.gospelrhys.co.uk
    */
    
    add_action('bb_admin-header.php', 'show_top_posters_admin_page_default');
    add_action('bb_admin_menu_generator', 'show_top_posters_add_admin_page');
    
    function show_top_posters_add_admin_page() {
    	bb_admin_add_submenu(__('Show Top Posters'), 'use_keys', 'show_top_posters_admin_page');
    }
    
    function show_top_posters_admin_page_default() {
    	echo "test";
    }
    
    function show_top_posters_admin_page() {
    	echo "test";
    } 
    
    function show_top_poster_text() {
    	echo "test";
    }
    
    ?>

    Any suggestions?

  2. Is it possible there's any extra whitespace (an extra line or space) in the plugin... either before the <?php or after the ?> ?

  3. That was it!

    Thanks :)

  4. You must log in to post.