[SOLVED] Frontend users:display random user info

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
crossland
Forum Members
Forum Members
Posts: 24
Joined: Fri Sep 11, 2009 9:55 am

[SOLVED] Frontend users:display random user info

Post by crossland »

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
Last edited by crossland on Mon May 09, 2011 8:20 pm, edited 1 time in total.
uniqu3

Re: Frontend users:display random user info

Post by uniqu3 »

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
crossland
Forum Members
Forum Members
Posts: 24
Joined: Fri Sep 11, 2009 9:55 am

Re: Frontend users:display random user info

Post by crossland »

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

Return to “Modules/Add-Ons”