Hi,
I'm using CMSMS 1.12.
I'm busy developing a module for a customer.
Is it possible to have a UDT created on installation of a module? How?
Thanks.
Add a UDT on installation of a new module
Re: Add a UDT on installation of a new module
There are a few API methods to do that: http://apidoc.cmsmadesimple.org/classes ... tions.html
Just use them on your install method.
Untested, but should be something like this:
Just use them on your install method.
Untested, but should be something like this:
Code: Select all
$usertagops = cmsms()->GetUserTagOperations();
$tagname = 'foo';
$tagtext = '/* some tag code */';
if( !$usertagops::UserTagExists($tagname) )
{
$usertagops::SetUserTag($tagname, $tagtext);
}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Add a UDT on installation of a new module
Great! Thanks.
Re: Add a UDT on installation of a new module
Just notice I made a mistake, called the methods statically on a non static context, sorry correction follows:
Code: Select all
$usertagops = cmsms()->GetUserTagOperations();
$tagname = 'foo';
$tagtext = '/* some tag code */';
if( !$usertagops->UserTagExists($tagname) )
{
$usertagops->SetUserTag($tagname, $tagtext);
}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Add a UDT on installation of a new module
Yes, I had already corrected that.
Another question: I have quite some PHP code to set inside the $tagtext variable with single en double quotes. How can I best add my code?
Another question: I have quite some PHP code to set inside the $tagtext variable with single en double quotes. How can I best add my code?
Re: Add a UDT on installation of a new module
Ok. Forget my last reply. I figured it out.
Another question:
Which code can I use to make sure the UDT is removed when the module in uninstalled.
Another question:
Which code can I use to make sure the UDT is removed when the module in uninstalled.