I need to display details of a random front end user on the home page. Each time the page is accessed, a different random user would be displayed. Has anybody done something like this?
CMS Made Simple: 1.9.2
FrontEndUsers: 1.12.12
Thanks
[SOLVED] Frontend users:display random user info
[SOLVED] Frontend users:display random user info
Last edited by crossland on Mon May 09, 2011 8:20 pm, edited 1 time in total.
Re: Frontend users:display random user info
To display user list on frontend you will first need CGUserDirectory then you could try smarty shuffle modifier, see http://forum.cmsmadesimple.org/viewtopic.php?t=47204
Re: Frontend users:display random user info
Thanks very much for a useful pointer.
To get it to work, I created a new summary template (called random) in the Calguys User Directory containing the following:
{capture}{$users|@shuffle}{/capture}
...
{foreach from=$users[1].properties item='onepropvalue' key='propname'}
{* pull out values so we can display them in the desired format *}
{ if $properties.$propname.prompt == "Organisation name" }{assign var='iorg' value=$onepropvalue}{/if}
...
{/foreach}
{* display properties in correct format *}
<span class="textclass1" style="font-weight: bold">{$iorg}</span>
...
{ if $iurl != "" }
...
<a href="http://{$iurl}">Visit Website</a>
{/if}
...
Then I included the following on the front page:
{CGUserDirectory action='default' uid='10' summarytemplate='random'}
The site now shows a different front end user each time the home page is accessed. Thanks again.
To get it to work, I created a new summary template (called random) in the Calguys User Directory containing the following:
{capture}{$users|@shuffle}{/capture}
...
{foreach from=$users[1].properties item='onepropvalue' key='propname'}
{* pull out values so we can display them in the desired format *}
{ if $properties.$propname.prompt == "Organisation name" }{assign var='iorg' value=$onepropvalue}{/if}
...
{/foreach}
{* display properties in correct format *}
<span class="textclass1" style="font-weight: bold">{$iorg}</span>
...
{ if $iurl != "" }
...
<a href="http://{$iurl}">Visit Website</a>
{/if}
...
Then I included the following on the front page:
{CGUserDirectory action='default' uid='10' summarytemplate='random'}
The site now shows a different front end user each time the home page is accessed. Thanks again.