• Hey guys,

    Below is a very rough outline of a plugin;

    <?php
    
    /*
    Version: 0.1
    */
    
    add_action('admin_menu', array('MBH_Team_Manager', 'admin_menu'));
    
    register_activation_hook( __FILE__, array('MBH_Team_Manager', 'activate'));
    register_deactivation_hook( __FILE__, array('MBH_Team_Manager', 'deactivate'));
    
    class MBH_Team_Manager {
    
    	function admin_menu(){
    		add_pages_page('The Team Management', 'The Team', 'publish_pages', 'mbh_team_manager', array('MBH_Team_Manager', 'admin_options'));
    	}
    
    	function admin_options(){
    ?>
    <div class="wrap"><div id="icon-users" class="icon32"></div>
    <h2>The Team Management <a class="button add-new-h2" href="edit.php?post_type=page&page=mbh_team_manager&action=add">Add New</a></h2>
    <br />
    <?php
    		if(isset($_GET['action']))
    		{
    			if($_GET['action'] == 'add')
    			{
    				$this->add_new()
    			} else{
    				$this->list_team();
    			}
    		} else {
    			$this->list_team();
    		}
    ?>
    </div>
    <?php
    	}
    
    	function list_team(){
    ?>
    list team
    <?php
    	}
    
    	function add_new(){
    ?>
    add new
    <?php
    	}
    
    	function activate(){
    		//create table
    	}
    
    	function deactivate(){
    		//delete table
    	}
    
    }

    You should be able to see the if statement if(isset($_GET['action'])). Following this I want to call one of the classes methods, but wordpress does not allow me to do this.

    What should I be running in place of $this->list_team(); to access a method from another method?

    Cheers,
    Gareth

  • The topic ‘How to access a method inside my plugin’ is closed to new replies.