Forum


List Manager Support

List Manager support
Forums
Public write access is disabled. Please login

custom option list 20.02.2014 12:59

Hi,
I have two lists ( A and B)
The list A has ID,VALUE, User fields (only own records)

In the B list I want to create a custom option list with the values of A list

I put the sql stament for populate the option list, but the list appears with all the values of A inclusive values from others users,
How can i create the option list with the values of A but only the own records not all records.

Re: custom option list 20.02.2014 16:35

Hi,
you can't get that kind of filter using plain sql because you can't write a sql query dependant on active user ID. You will need to write a more complex query, filtering only the record ids containing the user id, and a code tweak able to introduce the active user at the query. So, you will need a query where you use userid with a special enclosure,like:

select........where.....fielduser=##userid##


and introduce a change at source code before launching the query:


joomla\modules\mod_listmanager\helper.php

about line 159 you will find the function

public function getExecuteQuery($query) {

//introduce this line to replace ##userid## for actual user id

$query= str_replace("##userid##",JFactory::getUser()->id,$query);

$db->setQuery($query);
return $db->loadRowList();
}

Hope this helps, regards
Moonsoft Team
www.moonsoft.es

Re: custom option list 07.03.2014 18:15

FYI - Experimenting with that technique, it seems that one must place ' ' marks around ##userid## in "select........where.....fielduser=##userid##", i.e., "select........where.....fielduser='##userid##'"

Edited by moon_1371 - 07.03.2014 18:44

Re: custom option list 07.03.2014 18:50

I have a similar problem with the userids of rows in a View of a List that has 3 fields:
User Id - type User internal name "user"
Description - type Text
fname - type Option List with SQL Action" "Select id,firstname from ove83_comprofiler where id = '##user##'"

I want to list the first name of the user for that row of the List. How can I do that please?

Re: custom option list 07.03.2014 19:35

Will the helper.php revision be lost with each new release of ListManager and have to be reentered each update? Or can you make support of "##user##" a feature of the next release?

Re: custom option list 10.03.2014 09:12

FYI - Experimenting with that technique, it seems that one must place ' ' marks around ##userid## in "select........where.....fielduser=##userid##", i.e., "select........where.....fielduser='##userid##'"

Edited by moon_1371 - 07.03.2014 18:44


Hello,

This depends on database table column type. You will only need ' ' if column is char type.

Regards,

Edited by MSTeam - 10.03.2014 09:12
Moonsoft Team
www.moonsoft.es

Re: custom option list 10.03.2014 09:28

I have a similar problem with the userids of rows in a View of a List that has 3 fields:
User Id - type User internal name "user"
Description - type Text
fname - type Option List with SQL Action" "Select id,firstname from ove83_comprofiler where id = '##user##'"

I want to list the first name of the user for that row of the List. How can I do that please?


Hello,

Your work seems to be ok: when users use add form, fname field will show a select with only one option, so this form will save the name (use 'Select firstname,firstname...'). This is not valid if you want to add data from backend as user logged is administrator.

Setting field data with an SQL depending on data in the same row is not possible. Maybe you will need to add custom code in List Manager.

Regards,
Moonsoft Team
www.moonsoft.es

Re: custom option list 10.03.2014 09:45

Will the helper.php revision be lost with each new release of ListManager and have to be reentered each update? Or can you make support of "##user##" a feature of the next release?


Hello,

Maybe you should need to reentered your tweak, as, by now, this is not planned to added to new releases.

Regards,
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback