Page 1 of 1

[solved- but not in core yet] SetUserTag() - how to use in an install

Posted: Sat May 23, 2009 2:55 am
by JeremyBASS
Hello, any one know how to use the

SetUserTag()

I'm working in a method.install.php

I have been tring all types of things but this is where I'm left at..

Code: Select all

$fn = cms_join_path(dirname(__FILE__),'UDT','orig_URLhere_UDT.tpl');
if( file_exists($fn) )
{
  $template = file_get_contents($fn);
  $core = & $gCms->usertagoperations();
  $core->SetUserTag('URLhere', $template);
}
any ideas... I'm sure it's simple

Cheers
jeremyBass

Re: SetUserTag() - how to use in an install

Posted: Sat May 23, 2009 4:10 am
by JeremyBASS
and this didn't work nor throw an error...

Code: Select all


$fn = cms_join_path(dirname(__FILE__),'templates','orig_URLhere_UDT.tpl');
if( file_exists($fn) )
{
  $template = file_get_contents($fn);
  $usertagops =& $gCms->GetUserTagOperations();
  $usertagops->SetUserTag('URLhere', $template);
}


Re: SetUserTag() - how to use in an install

Posted: Sat May 23, 2009 6:15 am
by viebig
Hey jeremy...

did you try turning debug on to see if the query is really performed?

something like:

Code: Select all

INSERT INTO userplugins (userplugin_name, code, create_date, modified_date)
Regards.

G

Re: SetUserTag() - how to use in an install

Posted: Sat May 23, 2009 6:39 pm
by JeremyBASS
Oh I should had posted that last night.. I was getting tired of working and got a little lazy... 17 stright is a long day...


this is the debug...


Debug: (0.257972) - (10379920)


(mysql): SELECT userplugin_id, code FROM cms_154_userplugins WHERE userplugin_name = 'URLhere'
Error (0):

Debug: (0.258634) - (10381936)


(mysql): INSERT INTO userplugins (userplugin_name, code, create_date, modified_date) VALUES ('URLhere','$urlBASE = \"http://\".$_SERVER[\'HTTP_HOST\'].$_SERVER[\'SCRIPT_NAME\'];\r\nif (!empty($_SERVER[\"QUERY_STRING\"]))\r\n$urlBASE .= \"?\".$_SERVER[\'QUERY_STRING\'];\r\nif (isset($config[\'assume_mod_rewrite\']) && ($config[\'assume_mod_rewrite\']==true)) {\r\n$urls = str_replace(\"index.php?page=\", \"\", $urlBASE);\r\n}else{\r\n$urls = $urlBASE;\r\n}\r\n\r\necho $urls;','2009-05-23 11:36:08','2009-05-23 11:36:08')
Error (1146): Table 'cms_154.userplugins' doesn't exist
I'm hitting it again now hopfully now that I sleeped I can get it... :) but any help would be great...

Thanks

Jeremy

Re: SetUserTag() - how to use in an install

Posted: Sat May 23, 2009 6:51 pm
by JeremyBASS
ok.. easy solve.. man I was sleepy last night... this was way simple... :)

thanks viebig

cheers
Jeremy