WordPress.org

Ready to get started?Download WordPress

Forums

Trying to create plugin: An error in trying to add settings to Dashboard... (2 posts)

  1. Jim R
    Member
    Posted 3 years ago #

    I"m trying to create a plugin, and while I'm not entirely sure of the direction of that plugin, my first step was just to make sure I knew how to get a page on the Dashboard.

    When trying to logout and login, there are "headers already sent" errors. The code for the plugin is below, and it's awfully simple to be producing errors. Which is to say, I have no clue. :)

    The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
    <?php
    
    // Plugin Name: My Team
    // Plugin URI:
    // Description: Allows a coach to enter information about his team and players
    // Version: 0.1
    
    add_action('admin_menu', 'my_plugin_menu');
    
    function my_plugin_menu() {
    
      add_dashboard_page('My Plugin Options', 'My Team Settings', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
    
    }
    
    function my_plugin_options() {
    
      if (!current_user_can('manage_options'))  {
        wp_die( __('You do not have sufficient permissions to access this page.') );
      }
    
      echo '<div class="wrap">';
      echo '<p>Here is where the form would go if I actually had options.</p>';
      echo '</div>';
    
    }
  2. Jim R
    Member
    Posted 3 years ago #

    I used this page as sort of a guide:

    http://codex.wordpress.org/Adding_Administration_Menus

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.