List Manager Forum

User Field

User moon_541 2012-06-11 10:45:41

I added the user field to track which user has added a record, however, when a record is added the user field in the view is blank (has no value).

If I choose a user in the backend, it will show up in the view, however when admin add comment or the user update the record the "User" file is blank in the view.

Could you please advise how to fix this.

Edited by moon_541 - 11.06.2012 10:50

Moonsoft support 2012-06-11 12:10:23

Hello,
that seems as the id of active user is not being recovered when storing records. Please try this alternative method:

edit file
joomla\components\com_listmanager\models\listmanager.php

and around line 335

replace this line


if ($field=='6') tmp_value=JUser::getInstance()->id;

with this one

if ($field=='6') $tmp_value=JRequest::getVar('user_on');

try to add a new record and please confirm if now you can see the user name at the record.

Regards

Moonsoft support 2012-06-11 12:47:58

Dear Support,

I had this same problem and applied your suggestion and it now works

Thanks

Anselm

User moon_541 2012-06-11 13:34:54

Thanks, now it works.
However, I would like to know if it is possible to retain the original userid of the person who created the row.

I have setup so the admin can update the progress of each request in the each row, however when the admins update the progress, it changes the user to the Admin ID instead of retaining the ID of the user who created the row.

Thanks.

Moonsoft support 2012-06-11 14:13:02

Hello,
when using front-end edition, user always updates to the one saving the row. If you want to preserve initial user, you should use backend administration to update the records without changing that field.

Regards

User moon_541 2012-06-11 15:28:22

I have worked out if I comment out the //if ($field=='6') $tmp_value=JRequest::getVar('user_on');

and save it will not update the user.

What I need to is to have a new button on the form called "Update" and this will post the result into the table with the function below:

Is this possible?

function updateData(){

//if ($field=='6') $tmp_value=JUser::getInstance()->id;
//if ($field=='6') $tmp_value=JRequest::getVar('user_on');


}

}

Edited by MSTeam - 11.06.2012 19:58

Moonsoft support 2012-06-11 20:01:05

Hello,
yes, you could try to add a new function, if you want to give it a try. Also you can code something like this, instead of commenting the line:


if ($field=='6' && JRequest::getVar('idrecord',"")=="") $tmp_value=JRequest::getVar('user_on');

(Only assign value to new records)

Hope this helps

...
List Manager

Build different lists for your site

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!