To begin with, I wish to say sorry with this very large question, but each one of these questions were disturbing my little brain (or no brain!) within the last day or two as I wasn't getting any appropriate answer. I'll request to first look at this gradually, and whomever knows any some of it, please attempt to answer it for your part only. I'll be grateful to anyone who solutions any some of it.

I'm creating a Wordpress plugin (using OOP) where Gamers could possibly get registered here &lifier play some kind of rugby game online. With this I produced a database table (wp_rugby_players) in a way that while using the API of signing up Hooks, this table will instantly get produced &lifier dropped when initiating &lifier deactivating the Wordpress plugin, correspondingly.
However, I have to point out that this kind of creating database table is really a bad method of using WordPress because it itself provides several options (including using Options, Custom Fields, Taxonomies, ...) for use for such reasons.

Still because this is my very first time, I must understand how to proceed in such instances using OOP method of programming WordPress plug ins. Issue is my registration of hooks is not working totally, and you will find some problems developing. Therefore if anybody could assist me please, it will likely be just great. Following is my code snippet:-

// Placeholder - #1
class class_play_rugby_game
    function __construct() {
        // Placeholder - #2
        register_activation_hook( __FILE__, array( &$this, 'database_setup' ) );
        register_deactivation_hook( __FILE__, array( &$this, 'database_uninstall' ) );
        add_action( 'admin_menu', array( &$this, 'admin_actions' ) );

    function database_setup() {
        global $wpdb;

        // Placeholder - #3
        $table_name = $wpdb->prefix . "top_rugby_players";
        $current_year = date('Y');

        if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
            $sql = "CREATE TABLE `".$table_name."`......"; // Database Table Creation Code correct, as I have checked it using "phpMyAdmin"

             * This code snippet is actually taken from a non-OOP Plugin code,
             * but still I would want to use it in case anything goes wrong.
            if( !require_once(ABSPATH . 'wp-admin/includes/upgrade.php') ) {
                die('Foolish Plugin has added its own maybe_upgrade* Function');

            // Placeholder - #4

            $welcome_name = "Mr. Wordpress";
            $welcome_text = "Congratulations, you just completed the installation!";

            // Just for testing
            $rows_affected = $wpdb->insert( $table_name, array(
                'name' => $welcome_name,
                'time' => current_time('mysql'),
                'text' => $welcome_text
            ) );

    function database_uninstall() {
        global $wpdb;

        // Placeholder - #5
        $table_name = $wpdb->prefix . "top_rugby_players";
        $wpdb->query("DROP TABLE IF EXISTS $table_name");

    function admin_actions() {
        // Placeholder - #6
        if( function_exists('add_menu_page') ) {
            add_menu_page( __("Play Rugby Game"), __("Top Rugby Players"), 'edit_plugins', "list-top-players" );

        // Placeholder - #7
        if( function_exists('add_submenu_page') ) {
            add_submenu_page( "list-top-players", __("List of Top Players"), __("Top Rugby Players"), 'edit_plugins', "list-top-players", array($this, "list_top_players_page"));

            add_submenu_page( "list-top-players", __("Add Top Players"), __("Add New"), 'edit_plugins', "add-new-player-page", array($this, "add_new_player_page"));

$obj_play_rugby_game = new class_play_rugby_game();

Now I'll mention all of the problems, 1 by 1.
Placeholder - #1:-
Can there be any difficulties with my Class naming structure? If so, please tell me,to ensure that I'm able to stick to the standards.

Placeholder - #2:-
I'm a tiny bit confused regarding where &lifier how you can correctly make use of the object of the class within the functions "register_activation_hook" &lifier "register_deactivation_hook". Are also they syntactically situated inside a right manner within the constructor?

Placeholder - #3 &lifier Placeholder - #5:-
You will find multiple occasions when I must write same string (within this situation table title) in every method, although I'd greatly such as this to keep in certain class property rather. What will be the feasibility of the workaround for dealing with the APIs of "register_activation_hook", "register_deactivation_hook", "add_action", "add_filter", "add_menu_page", and "add_submenu_page"? Will the need for the course qualities be accessible during these when calling the needed-pointed out APIs.

Placeholder - #4:-
How you can know whether dbDelta($sql) is working or otherwise? Otherwise, steps to make it operate in these kinds method?

Placeholder - #6 &lifier Placeholder - #7:-
I saw inside a non-OOP wordpress plugin with such 2 inspections "function_exists('add_menu_page')" &lifier "function_exists('add_submenu_page')". Are these inspections working &lifier could it be useful to check on both of these APIs?

Placeholder - #6 &lifier Placeholder - #7:-
When I stated before that you will find multiple cases of same text here &lifier there. More good examples seem to be the primary menu's "menu_slug" parameter &lifier the sub-menu's "parent_slug" parameter. Also same situation applies to the menu's "capacity" parameter. If at all possible, how do i make use of the class property values here, rather than directly writing exactly the same text over &lifier once again?

Some general questions:-

  • I have to possess a player registration form within the Admin panel, and so i will need a view &lifier controller &lifier one most likely. So can anybody please advise a way possible to do this inside a proper manner, because this is probably the most trivial thing about this wordpress plugin?
  • Whenever I am initiating the Wordpress plugin in the Wordpress plugin Manager area, I get the next message "The plugin generated 585 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." Can anybody please tell in the written above in regards to what may cause this kind of an alert message?

Anyone who knows any little some of it, please answer that part only. I'm itching my mind in the last day or two without any response to these above questions. Please assist me. Thanks ahead of time.