• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Allow 1 item per user

bloh

New Member
Showcase
I wanted to add a line of conditional statement.
"If current visitor showcase item count > 0", then hide the 'create showcase item' button.
is it possible? If so, what's the conditional code? Thanks in advanced :)
 
You'll need to edit all the templates that have the create button (there are a lot of them) and wrap it with this.

HTML:
<xen:if is="{$visitor.showcase_count} == 0"> CREATE BUTTON CODE </xen:if>

Create button code looks something like this (they are not all exactly the same)...

HTML:
<xen:if is="{$canCreateItem}">
    <xen:topctrl><a href="{xen:link showcase/add}" class="callToAction OverlayTrigger"><span>{xen:phrase nflj_showcase_create_new_item}</span></a></xen:topctrl>
</xen:if>

NOTE: you MUST do it INSIDE of the cat create item if statement, like this..

HTML:
<xen:if is="{$canCreateItem}">
    <xen:if is="{$visitor.showcase_count} == 0">
        <xen:topctrl><a href="{xen:link showcase/add}" class="callToAction OverlayTrigger"><span>{xen:phrase nflj_showcase_create_new_item}</span></a></xen:topctrl>
    </xen:if>
</xen:if>
>
 
Last edited:
Instead of > 0 its best to use == 0 and only display it if they have not yet created an item (if they have permission).

Might not be a bad idea to add item amount limitations to user group/category permissions
 
There is none. The field 'showcase_count' is a cached visible item count added for display purposes outside of showcase only (similar to resource_count, message_count, etc). I don't know of any addon (and core XF for that matter) that adds any "moderated" counts of any type to the xf_user table for use within the $visitor object.

Im pretty sure item create limits has been requested (not in my office right now, So I can't look on the white board). That is what you are wanting right?
 
Keep in mind, there are 4 item_states... 'visible', 'moderated', 'deleted', 'draft', so if you are doing any querying to generate a COUNT(*), you might want to filter out deleted so that it doesn't count that in case that user has had a previous item soft deleted.
 
Back
Top