1283 Posts
Bucklash
9 years ago
0
Topic

Hi Folks

Aim - I want to collect the User Id of the user adding the article.

I am using live value of User id field to achieve this.

I have added the field 'User Id' to the 'article' content type form (which is using the Article Object!!) at the bottom of the list of fields. 

In the content type form I select [2 - Live + Live Value].

In the Live column I changed the value from 'default' to 'User".

In the Live Value column I clicked 'configure'. A modal window appears...

User is at the value 'current' (there are no other options!)

Property has the value 'id' typed in (as I want to get the id of the user, if I wanted a different value look at the database, #__users table, and select a column title).

I save and Close the modal window. Then save the article form.

I navigate to Joomla's 'article create' page and create an article by clicking 'new'.

I select the SEBLOD article form and at the bottom of my form I can see the id of the user (which is me). On my default Joomla site it is 915.

When I save the article I receive a warning message:

Warning
JUser: :_load: Unable to load user with ID: 2
<br>

The id in question (ID: 2) is actually the id of the article just created.

The problem is to do with storage. It is not set correctly.

Head back to the article form, and click the pencil icon of the 'User Id' field to edit it.

At the bottom of the modal window head to Storage and set "Format / Object" to None.

Error message is gone.

If you want to save the value, you can set a new storage value ie

Format / Object: Standard | Article | my_funky_new_db_column_name_which_will_actually_be_stored_in_#__cck_store_item_content

Obviously, change that crazy field name to something more sensible!

If it is a content type created by you and called 'dave' then the field will be stored in

#__cck_store_form_dave

Hope that helps someone at some point...

Get a Book for SEBLOD