Author in LISE

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
monuhf
New Member
New Member
Posts: 2
Joined: Mon May 16, 2016 7:23 am

Author in LISE

Post 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!
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Author in LISE

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
monuhf
New Member
New Member
Posts: 2
Joined: Mon May 16, 2016 7:23 am

Re: Author in LISE

Post 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
Post Reply

Return to “Modules/Add-Ons”