ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Nested simple conditionals with SafeCracker

July 22, 2011 6:08am

Subscribe [2]
  • #1 / Jul 22, 2011 6:08am

    {if logged_in}
            {if logged_in_member_id == author_id}
            <div class="market-edit">
                <a href="/market/edit/{categories}{category_url_title}{/categories}/{url_title}">Redigér</a>
                /assets/images/interface/edit-icon.png
                
                {if "{market_sold}" == "YES"}
                {exp:safecracker id="market-sold-form" channel="{channel}" url_title="{segment_3}" return="market/show/{segment_3}/"}
                <input type="hidden" name="allow_comments" value="y" />
                <input type="hidden" name="market_sold" id="market_sold" value="NO" />
                {/exp:safecracker}
                <a >Sæt til salg</a>
                /assets/images/interface/checkmark.png
                {/if}
                
                {if "{market_sold}" != "YES"}
                {exp:safecracker id="market-sold-form" channel="{channel}" url_title="{segment_3}" return="market/show/{segment_3}/"}
                <input type="hidden" name="allow_comments" value="n" />
                <input type="hidden" name="market_sold" id="market_sold" value="YES" />
                {/exp:safecracker}
                <a >Markér som solgt</a>
                /assets/images/interface/cross.png
                {/if}
            </div>
            {/if}
            {/if}

    This shows the safecrackerform even though you arent logged in. Why?

    /Rasmus

  • #2 / Jul 22, 2011 6:16am

    Yes, I know that I can put the safecracker forms in embedded templates and it will work, but I don’t want the overhead of an embedded template for three lines of code.

    /Rasmus

  • #3 / Jul 23, 2011 5:19pm

    Dan Decker

    7338 posts

    Hi Rasmus,

    Are you using a separate browser to ensure you aren’t logged in? The reason I ask is because, a “log in” to the Control Panel = a “login” to the front of the site as well. So in order to insure you are *not logged in* you must either use a second browser, or log out of your Control Panel before checking templates with the {if logged_in} conditional.

    Let us know if you need further assistance.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases