Make something show up only on an item for specific quota

alt=
@tunefeed
6 years ago
22 posts
If i want an item ONLY to show up on a specific user quota's items. Would it be something like this?

{foreach from=$_items item="item"}
{if user.quota=examplequota}
{jrCore_include template="example.tpl"}
{else hidden}
{/if}
{/foreach}

I feel like i need to reference $user.item or something somewhere as this would be visible to all users but only show up on a users items if they are in the quota. I know i'm close but if im missing something can you let me know?
updated by @tunefeed: 05/19/18 06:55:25PM
SteveX
SteveX
@ultrajam
6 years ago
2,584 posts
You might be looking for $_user.quota_id, difficult to tell, but if you put {debug} in your template it will show you all the variables you can use in that template:
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/1477/debug


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
alt=
lets go
@devcentricbeats
6 years ago
118 posts
In your core list add quota_id"#"

Like this:
{jrCore_list module="jrAudio" quota_id="4" chart_field="audio_like_count" template="music_list3.tpl" pagebreak=30 page=$_post.p pager=false}
paul
@paul
6 years ago
4,326 posts
Not really sure what you are trying to do from your description, guessing that you only want items showing that were created by users in the same quota as the viewing user? If so -
{foreach from=$_items item="item"}
    {if $item.profile_quota_id == $_user.profile_quota_id}
        // Show the item
    {/if}
{/foreach}
As Steve says above, temporarily putting a debug at the top of any template will create a popup showing all variables and arrays available to that template. Its a really useful tool when editing templates.
hth


--
Paul Asher - JR Developer and System Import Specialist
alt=
@tunefeed
6 years ago
22 posts
We're close. I want items from users in this quota to show extra features. Visible to all. But shown on items only for users in the quota "2"
{* {if $item.profile_quota_id == 2}
// Show the item
{/if} *}
michael
@michael
6 years ago
7,714 posts
put code into [c o d e]the code goes in here[/ c o d e] blocks.

{* this is a comment, it will not show. *}
alt=
@tunefeed
6 years ago
22 posts
This is that I have so far.

{if $item._profile_quota_id == 2 or 4}

{show this}
{else hidden}
{/if}

It works in another area of my site with this code at the top

{if is_array($item)}
{$_profile_quota_id = $item._profile_quota_id}

{/if}

but it doesnt work in my item lists. with the same code at least
douglas
@douglas
6 years ago
2,790 posts
This:

{if $item._profile_quota_id == 2 or 4}

is the wrong syntax and may give you a template error.

You should read up on smarty so you can get a better understanding of how it works.

https://www.smarty.net/docs/en/

That said, your if statement should look something like this:

{if $item._profile_quota_id == '2' || $item._profile__quota_id == '4'}
What you want to show to quota ID's 2 and 4 goes here. No need for an else statement unless you want to show something else to profiles that are not in quota ID's 2 and 4.
{/if}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
paul
@paul
6 years ago
4,326 posts
Also lose the underscore - $item._profile_quota_id should be $item.profile_quota_id


--
Paul Asher - JR Developer and System Import Specialist

Tags