[Resolved] How to get module id?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
irish
Forum Members
Forum Members
Posts: 101
Joined: Tue Jun 03, 2008 2:31 pm

[Resolved] How to get module id?

Post by irish »

I have built two modules, I need to be able to put a form on module A that submits to module B. In module A, I tried this:

Code: Select all

$members = $this->GetModuleInstance('Members');
$mid = $members->cms->variables['modulenum'];

$smarty->assign('formStart2', $this->CreateFormStart($mid, 'login', $returnid,'post','',true,'',array(),'class="LoginForm"'));
...
but when I submit the form in module A it doesn't send it to module B as expected.

is that the right way to get the module number?
Last edited by irish on Tue Jul 29, 2008 4:20 pm, edited 1 time in total.
irish
Forum Members
Forum Members
Posts: 101
Joined: Tue Jun 03, 2008 2:31 pm

[Resolved] Re: How to get module id?

Post by irish »

OK, after spending the day on this, I've got it to work. Here is what I have done so far.

In module B (Members):
action.default.php - I grabbed the value of $params["show"] and if == 'badge' then include action.showbadge.php
action.showbadge.php - displays the login form and any other functionality
I changed the form tag which is located in action.showbadge.php  to this:

Code: Select all

$smarty->assign('formStart2', $this->CreateFormStart($id, 'login', $returnid,'post','',true,'',array(),'class="LoginForm"'));
In module A:
on the page that I want the form displayed, I added this: {cms_module module="Members" show="badge" }

This works great, displays the form as needed and the hidden fields of that form are showing this:




When I submit the form, it goes to Members::login authenticates and redirects back to the page they were on.

I hope this helps someone and saves them a day of banging their head against a wall.
Post Reply

Return to “Developers Discussion”