Adding user properties with DD + using dropdown lists

[email protected] (mikespub)
Newsgroups gmane.comp.cms.xaraya.knowledge-base
Organization Not much, really...
Message-ID <[email protected]>
[Original subject was : Re: [Xaraya_public-dev] Xaraya .900 Beta is Released.
by Pedro Innecco]

In article <mailman.1050918964.20486.xaraya_public-dev-n5IRV0TL0hwRxVAL8JNkPw@public.gmane.org>, 
[email protected] wrote:
>>We also have a upgrade script to be tested for people running .71 PostNuke
>>sites. This is not for the weak at heart. The script works and will be
>>integrated into the install after we have more successful tests. For those
>>wishing to test Xaraya with your current data, please stop into our support
>>chat and someone should be able to walk you through the process.
>
>What about the latest version 0.723?
>
As far as I know, there haven't been any changes in the tables between
PN .714 and .723, at least for those tables that we're using for the import.
Let me know if I'm wrong, though :)

>>With Xaraya's Dynamic Data Model, you are able to redesign the data
>>structure of modules. Need to capture different user data? Dynamic Data
>>can do that for you, and you can export the data structure to other websites
>>in need.
>
>Were can I get more information about DDM? I want to know, for example, how 
to
> add information about a user's favourite band. The user would select it from 
a
> drop-down list of options.
>
As Marie mentioned, I've posted several messages about DD here recently.
If you're not reading this via a news server, you can find the messages at
http://www.xaraya.com/newsgroups/article.php?id=3071&group=xaraya.public-dev
and follow-ups.

Unfortunately, the DD module isn't well documented yet with regard to 
specific properties you might want to use.

Here's a brief run-down on how to add a favourite band to the user profile :

1) Creating a Dynamic Object for users

Use one of the following approaches :

a. If you're using the import8.php script, it'll create a dynamic object
for users, with a "traditional" set of phpBB/PostNuke-like user properties.
b. If you don't intend to import any data just yet, you can import those
properties by going to Dynamic Data -> Utilities -> Import -> users.xml
c. if you're not interested in the "traditional" user properties and you only
want to define your own, you can go to Dynamic Data -> View Objects
-> View Properties for the roles module (-> an object for the roles
module will be created once you press Update Properties)

2) Adding Dynamic Properties to an object

You can add properties via Dynamic Data -> View Objects -> Edit the
object you want -> Modify Dynamic Properties.
(Or if you choose option c. above, you'll already be on the right page)

Now fill in label "Test", choose property type "Text Box", leave the
rest as it is, and press Update Properties. Your users will now have
an extra property called "test", with the label & type you've just specified.
The data for it will be stored in a separate table (the dynamic data table)
but they won't see the difference.

If you experiment a bit, you'll notice that the Roles -> Memberslist will
show this extra property as well. If you don't want that, go back to the
dynamic properties and change the Status of that property to "Display Only".

3) Working with Dropdown List

OK, so you have an extra property for your users, but now you want
to change that to show their favourite band, rather than some plain
text box.
First, you can change the label to "Favourite Band", and the property
type to Dropdown List. (Or you can just delete the test property by
giving it an empty label, and define a new property like that).

Then you'll have to say what kind of options you want to show in
that dropdown list. For that, you'll be using the Validation, and you
have 3 options there :

- name1;name2;name3 : to show those 3 names, and store them like
  that too
- id1,name1;id2,name2;id3,name3 : to show those 3 names, but store
  only the id corresponding to the selected name
- xarModAPIFunc('yourmodule','user','getbands') : to call some user
  API function 'getbands' in the module 'yourmodule'. That function
  should return an array of id => name pairs that will be used to
  fill in the dropdown list.

In your case, you'd probably want to add the function to the roles
module, in xaruserapi.php, but it could be any valid API function,
really.

That's it...

[The implementation details for the different property types can be
found in modules/dynamicdata/class/properties.php. If anyone is
willing to document them properly, I'd be eternally grateful :-)]

>>With the Xaraya Article System, no longer do you need to install multiple
>>modules that do similar acts. Xaraya comes pre-configured with News,
>>Documents, Links, Reviews, and FAQ. It doesn't end there though. You can
>>add article types as needed.
>
>So, an article is a general expression to reffer to a text-based-content? 
FAQs,
> Links, Reviews & all are all articles? I could then, create other articles
> such as knowledge-base?

Yes, that's the idea of publication types : you can use the standard set
of articles fields in different ways, extend them with dynamic properties
for a particular publication type, use specific templates for each, ...

Have fun,

Mike.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.