Site icon Hip-Hop Website Design and Development

WordPress Shortcode callback function with a plugin

I am working on a plugin and the plugin currently works great on the admin section but I’m trying to extend the functionality to the front end and using a shortcode to use the same functions. I have a form that gets displayed currently with the following code:

function display_sheet_form($f=array())
{

    $count = (isset($f['task_title'])) ? count($f['task_title']) : 3;
    if ($count < 3) $count = 3;

    echo '<form name="add_sheet" id="dls-sus-modify-sheet" method="post" action="">';
    //some additional code here
    echo '<input type="hidden" name="mode" value="submitted" />';
    echo '<input type="submit" name="Submit" class="button-primary" value="'.esc_attr('Save').'" />';
}

This form doesn’t have an action but the from the submenu it has a function callback that it knows to post this to within the same page. The code for the submenu is:

add_submenu_page($this->admin_settings_slug.'_sheets', 'Add New Sheet', 'Add New', 'manage_signup_sheets', $this->admin_settings_slug.'_modify_sheet', array(&$this, 'modify_sheet_page'));

There you can see that the callback function is the modify_sheet_page. Here is the code for this function:

function modify_sheet_page()
{
    if (!current_user_can('manage_options') && !current_user_can('manage_signup_sheets'))  {
        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    }
    echo "in the modify sheet page";
    // Set mode vars
    $edit = (empty($_GET['sheet_id'])) ? false : true;
    $add = ($edit) ? false : true;
    $submitted = (isset($_POST['mode']) && $_POST['mode'] == 'submitted');
    $err = 0;

    // Process form if submitted
    if($submitted) {
    //process the form code
    }
}

I created my shortcode like this:

add_shortcode('create_sign_up_sheet', array(&$this->admin, 'display_sheet_form'));

Currently it’s saying the action is the page that the template is being displayed on since it can’t use the callback of the submenu page. How can I post to the same modify_sheet_page() function using this shortcode?