Page 1 of 1

Author in LISE

Posted: Tue May 17, 2016 7:06 pm
by monuhf
Hello

I'm using CMSMS 2.1.3 and 1.2.1.1 Lise
My web has 1 Administrator and and 6 users as Editors

My question is:

How to show in each publication (entry) of Lise the author of it?

Sorry for my poor English.

Thank you!

Re: Author in LISE

Posted: Thu May 19, 2016 4:01 pm
by Jo Morg
Currently LISE doesn't have a way to automatically do that. You have a few alternatives depending on your level of knowledge of PHP/CMSMS/LISE...

On it's simplest form you would have to rely on each user to select itself from a dropdown or multiselect field.

As a proof of concept you can:
  1. create an UDT called LISEUsersList;
  2. Paste:

    Code: Select all

    $user = \UserOperations::get_instance()->LoadUserByID($params['value']);
    foreach( $users as $user ) $params[$user->id] = $user->username;
    return $params;
  3. create an UDT called LISEUsersAdminListing;
  4. Paste:

    Code: Select all

    $user = \UserOperations::get_instance()->LoadUserByID($params['value']);
    return $user->username; 
  5. create a FieldDef in the LISE instance module and make it a Custom Field From UDT;
  6. select the type to fit your needs (I used multiselect but should work we any of them);
  7. select Source UDT: LISEUsersList;
  8. select the Admistrator Listing UDT:: LISEUsersAdminListing;
  9. save and have fun;
The names of the UDT can be any you want as long as they match the selected ones on the fielddef...
This was not tested too extensively but should work fine.

Re: Author in LISE

Posted: Thu May 19, 2016 6:52 pm
by monuhf
Thank you very much for the contribution.
But I can not make it work.
The result is an empty field on the form.

I can solve it with a workaround using "{$ item->owner}" in the template and a cycle of "{if} like this in it.

Code: Select all

{if $item->owner == '1'}
  name of user 1
{elseif  $item->owner == '2'}
  name of user 2
{elseif  $item->owner == '3'}
  name of user 3 
  ---
{/if}
The "{$item->owner}" I think it is the "id" of user

This is only useful for sites with few users. My situation.

Thanks!

Again I apologize for my bad English.


mon