how are pk's sequenced in c5 database
Permalink
I'm building an external script that sets a custom value in the table atNumber.
But first I need to know how the avID in userAttributeValues is set, whenever a new custom value is added to the database.
Does C5 use db identities or any other sequence types for PK's? (maybe getMAX + 1 in a php script?)
Can't find anything on the DB side.
Thanks.
But first I need to know how the avID in userAttributeValues is set, whenever a new custom value is added to the database.
Does C5 use db identities or any other sequence types for PK's? (maybe getMAX + 1 in a php script?)
Can't find anything on the DB side.
Thanks.
Thanks for replying.
I understand the DB structure and was also checking the api but I don't understand all the classes yet. (I know how OOP works, but I'm a newbie to php)
Could you give me a code snippet how I would add a custom value to a user in the atNumber table (using the API)
Shouldn't be too hard I guess.
Thanks.
I understand the DB structure and was also checking the api but I don't understand all the classes yet. (I know how OOP works, but I'm a newbie to php)
Could you give me a code snippet how I would add a custom value to a user in the atNumber table (using the API)
Shouldn't be too hard I guess.
Thanks.
atNumber is just an attribute type,
something like:
thats just an example,
the docs should have actual examples
something like:
CollectionAttributeKey::add($boolt, array('akHandle' => 'exclude_sitemapxml', 'akName' => t('Exclude From sitemap.xml'), 'akIsSearchable' => true, null));
thats just an example,
the docs should have actual examples
sample code.
The code below is part of the 'kino's import user'.
(http://www.concrete5.org/marketplace/addons/kinos-import-users/... )
The code below is part of the 'kino's import user'.
(http://www.concrete5.org/marketplace/addons/kinos-import-users/... )
function adduser_with_tel($username,$email,$password,$tel=''){ $uak = UserAttributeKey::getByHandle('tel'); $error = $this->check_userinfo($username,$email,$password); if(!$error){ $data = array('uName' => $username, 'uPassword' => $password, 'uEmail' => $email); $uo = UserInfo::add($data); // $uo = UserInfo::getByUserName($username); if (is_object($uo)) { if($tel!=''){ $uo->setAttribute($uak, $tel); } $result = t('%s (%s) was imported successfully.', $username,$email); } } else { $result = t(' import error %s (%s)', $username,$email);
Viewing 15 lines of 19 lines. View entire code block.
That's a great example.
Thank you very much!
Thank you very much!
About calling this function:
Where would be the best place to store this function in the c5 dir?
What's the best way to call it? (Does c5 support restful webservice or should I pass args through a url to a php file?
Thanks.
Where would be the best place to store this function in the c5 dir?
What's the best way to call it? (Does c5 support restful webservice or should I pass args through a url to a php file?
Thanks.
It's sample.
This code will not work alone.
The code that I have more present, so I do not know what you want to create a program that you can not.
This code will not work alone.
The code that I have more present, so I do not know what you want to create a program that you can not.
HI,
I've set up a small php file for accepting two arguments. (located in tools folder)
Arguments come in ok, however the $uak and $uo objects don't seem to work.
Any ideas?
Thanks.
I've set up a small php file for accepting two arguments. (located in tools folder)
Arguments come in ok, however the $uak and $uo objects don't seem to work.
Any ideas?
Thanks.
<?php if ($_REQUEST['uName'] && $_REQUEST['uServoyId']) { $username = $_REQUEST['uName']; $servoy_id = $_REQUEST['uServoyId']; echo ("<p>user: ".$username."</p>"); echo ("<p>servoy: ".$servoy_id."</p>"); $uak = UserAttributeKey::getByHandle('servoy_id'); echo ("<p>uak: ".$uak."</p>"); $uo = UserInfo::getByUserName($username); echo ("<p>uo: ".$uo." </p>"); if (is_object($uo)) { $uo->setAttribute($uak, $servoy_id); }
Viewing 15 lines of 17 lines. View entire code block.
Hi,
ex.)
http://c7.tktools.jp/index.php/tools/test.php?uName=username1&u...
ex.)
http://c7.tktools.jp/index.php/tools/test.php?uName=username1&u...
<?php if ($_REQUEST['uName'] && $_REQUEST['uServoyId']) { Loader::model('attribute/categories/user'); $username = $_REQUEST['uName']; $servoy_id = $_REQUEST['uServoyId']; echo ("<p>user: ".$username."</p>"); echo ("<p>servoy: ".$servoy_id."</p>"); $uak = UserAttributeKey::getByHandle('servoy_id'); // echo ("<p>uak: ".$uak."</p>"); var_dump($uak ); $uo = UserInfo::getByUserName($username); // echo ("<p>uo: ".$uo." </p>"); var_dump($uo ); if (is_object($uo))
Viewing 15 lines of 20 lines. View entire code block.
Great !!! :-))
A couple lines of code says more than a 1000 words. :-)
Thanks.
off topic:
My thoughts go out to all the people suffering from the disaster in your country. Really hope al is well in the area you live.
A couple lines of code says more than a 1000 words. :-)
Thanks.
off topic:
My thoughts go out to all the people suffering from the disaster in your country. Really hope al is well in the area you live.
Thank you.
I live in Kyoto, so there is no damage.
Has sent you a prayer of people around the world.
We are thrilled to.
I think we'll help the forefront of a revival.
I live in Kyoto, so there is no damage.
Has sent you a prayer of people around the world.
We are thrilled to.
I think we'll help the forefront of a revival.
So this is a script that will be called outside the context of a content page, correct?
In C5, the usual way to do this is in a tools file (which runs code and has some resources like the database available, but doesn't bring in the overhead of a page/theme/template/etc.).
Inside the tools file, you can respond to things however you want. C5 does not provide built-in tools for responding in a REST-ful way, but you could code up your own response based on availability of GET/POST (and phony PUT/DELETE in hidden fields or querystring). But it's probably not worth the trouble unless you're building a public API that other people are going to be using (which you're probably not doing because I can't imagine C5 making sense as a platform in that context).
So... yeah... I would just pass args in the url.
-Jordan
In C5, the usual way to do this is in a tools file (which runs code and has some resources like the database available, but doesn't bring in the overhead of a page/theme/template/etc.).
Inside the tools file, you can respond to things however you want. C5 does not provide built-in tools for responding in a REST-ful way, but you could code up your own response based on availability of GET/POST (and phony PUT/DELETE in hidden fields or querystring). But it's probably not worth the trouble unless you're building a public API that other people are going to be using (which you're probably not doing because I can't imagine C5 making sense as a platform in that context).
So... yeah... I would just pass args in the url.
-Jordan
the avid corresponds to other tables, if you want to add to c5's db, use c5's methods to do it,