Thank you so much! Seem like it’s worked for what I need it to.
Re: Plugin Switch Statement
« Reply #1 on: Today at 12:23 PM »
Reply with quoteQuote
If I’m understanding you correctly, you have two registration pages and want your plugin to behave differently depending on which page is up when the plugin is activated.
You should be able to get the current page ID with $modx->documentIdentifier, so the simplest solution would be to put an if statement in your plugin:
Code:
if ($modx->documentIdentifier == 5) {
// create your docs here
} elseif $modx->documentIdentifier == 6) {
// create your other docs here
} else {
echo "Error - unknown page";
}
Replace 5 and 6 with the document IDs of your two registration pages.
Code:
Or, if you’d rather use a switch statement:
switch ($modx->documentIdentifier) {
case 5:
// create documents
break;
case 6:
//create documents
break;
default:
echo "Unknown document";
break;
}
This worked as the other one didn’t... This opens up all sorts of ideas for me now since the switch statement works with forms.