solved User List with Random Audio

SoftDesigns
SoftDesigns
@softdesigns
7 years ago
242 posts
RE: Capture / String Template Below: We have everything working correctly below, except adding last column to pull random audio from User audio list:
{capture assign="profile_tpl"}
{literal}
    {if isset($_items)}
    {jrCore_module_url module="jrProfile" assign="purl"}
    {foreach $_items as $item}
    <div class="container">
        <div class="row">
            <div class="col2">
                <div class="block_image">
                    <a href="{$jamroom_url}/{$item.profile_url}">
                    {jrCore_module_function 
                    function="jrImage_display" 
                    module="jrProfile" 
                    type="profile_image" 
                    item_id=$item._profile_id 
                    size="large" 
                    crop="auto" 
                    class="iloutline img_scale" 
                    alt=$item.profile_name 
                    title=$item.profile_name width=false height=false}</a>
                </div>
            </div>
            <div class="col10 last">
                <div class="p5">
                    <h4><a href="{$jamroom_url}/{$item.profile_url}" 
                    title="{$item.profile_name}">{$item.profile_name|truncate:25}</a>
                     - <small>{$item.profile_tag}</small></h4>
                </div>
            </div>            
        </div>
    </div>
    {/foreach}
    {/if}
{/literal}
{/capture}
Based on code above: How to add last column / div which will pull one random Audio into a nice small player. The audio should have small player, and should pull any random audio from user audio list.
updated by @softdesigns: 01/11/18 04:00:10PM
michael
@michael
7 years ago
7,714 posts
you're going to need another jrCore_list there to search audio from that user's profile. coming back will probably be a $item._profile_id you can use that something like this:
{jrCore_list module="jrAudio" profile_id=$item._profile_id order_by="_item_id random"}
SoftDesigns
SoftDesigns
@softdesigns
7 years ago
242 posts
Hi - This code is almost perfect :
{jrCore_list module="jrAudio" profile_id=$item._profile_id  limit="1" order_by="_item_id random"}
--
Only thing - Not sure, but it does not seem to pull a random audio from user's list?
--
How to pull and show 1 random audio file from User's entire audio list?
paul
@paul
7 years ago
4,326 posts
Where are you putting this in your code?
Are you sure that $item._profile_id is valid at that point?


--
Paul Asher - JR Developer and System Import Specialist
SoftDesigns
SoftDesigns
@softdesigns
7 years ago
242 posts
@Paul - Actually, when we test closer, it does seem to be working.
--
Some users have a small pool of audio, so we thought it was not pulling random audio, but at closer look, it is randomizing.
--
Great Support - Solved :)

Tags