MyBB Community Forums

Full Version: generate_submit_button(); Function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
What actions?
I need to have the following:

index.php?module=tools-easyrep&action=addrep

index.php?module=tools-easyrep&action=removerep

so I would have two sub tabs, add and remove. How could I create a form for both of them on the two separate sub tabs?

Thanks Smile
You edit the link to be those, and to differentiate between tabs you would check $mybb->input['action'] and decide what form to show and which tab to be active based on that.
What would be the best way of doing that?

I've currently got this:

$page->add_breadcrumb_item("Easy Rep", "index.php?module=tools-easyrep");

$page->output_header("");
$sub_tabs['add_rep'] = array(
            'title' => "Add Reputation",
            'link' => "index.php?module=tools-easyrep&action=addrep",
            'description' => "Add Reputation To Users."
        );
$sub_tabs['modify_rep'] = array(
            'title' => "Modify Reputation",
            'link' => "index.php?module=tools-easyrep&action=modifyrep",
            'description' => "Modify User's Reputation."
        );

if ($mybb->input['action'] = "addrep") {
	$page->output_nav_tabs($sub_tabs, 'add_rep');

//Form 1 Here

}
else if ($mybb->input['action'] = "modifyrep") {
	$page->output_nav_tabs($sub_tabs, 'modify_rep');
	$modifyform = new Form("index.php?module=tools-easyrep&action=modifyrep", "post", "easyrep");

//Form 2 Here

}

Any reason why the tab is stuck on Add Rep?

Cheers Smile
The same way you made your previous form?
Thanks for the reply Smile

I've made both forms, I just can't figure out why the modify rep sub tab won't open.

It just stays stuck at the add rep sub tab.

The first part is this:
$page->add_breadcrumb_item("Easy Rep", "index.php?module=tools-easyrep");

$page->output_header("");
$sub_tabs['add_rep'] = array(
            'title' => "Add Reputation",
            'link' => "index.php?module=tools-easyrep&action=addrep",
            'description' => "Add Reputation To Users."
        );
$sub_tabs['modify_rep'] = array(
            'title' => "Modify Reputation",
            'link' => "index.php?module=tools-easyrep&action=modifyrep",
            'description' => "Modify User's Reputation."
        );

if ($mybb->input['action'] = "addrep") {
	$page->output_nav_tabs($sub_tabs, 'add_rep');
	$addform = new Form("index.php?module=tools-easyrep&action=addrep", "post", "easyrep");
//Form here

That's working fine.

The second part is:
else if ($mybb->input['action'] = "modifyrep") {
	$page->output_nav_tabs($sub_tabs, 'modify_rep');
	$modifyform = new Form("index.php?module=tools-easyrep&action=modifyrep", "post", "easyrep");
//Form here

The Modify Rep tab won't open when clicked, it just stays on the Add Rep tab

Cheers Smile
else if ($mybb->input['action'] = "modifyrep") {

should be

else if ($mybb->input['action'] == "modifyrep") {
Thanks euantor! Works perfectly!

One more quick question then I think i'm done! Smile

How can I check all the generate_text_area fields to see if there empty & some can only contain numbers?

Also how can I display either a red or green message, like when the plugin is enabled successfully to show the result?

Thanks! Smile
if(!empty($mybb->input['rec_comment'])) to see if it's empty and if(intval($mybb->input['rec_comment'])) for integers.
Thanks! Smile

Any idea how to display a red / green message on success and failure of form submit?

Cheers Smile
Pages: 1 2 3 4 5