1

Pretty new to EE, I am creating a site similar to desert island discs - but for crisps for a friend and as part of my uni assignment.

I'm using EE 2.5 and Safecracker 2.1. I have created the safecracker form based on this tutorial by Ryan White http://www.venveo.com/articles/view/understanding-safecracker-for-expressionengine.

Now the form works a charm from the front end. This is the setup:user_entries. Status group with status Pending created and assigned to the group. In members I have created an annonymous user and assigned access to the above channel to publish from front end (status still pending). This is all good.

I have a template group called entries and inside this I have the user_entries template where the form code resides. I also have a confirmation template to redirect users upo successful submission.

Now every time I test this, an entry is created - but in the pages section, which is fine. I can go there publish the page and all is good. What I can't figure out is how do I output all the new entries (after status change to Open) on the front end to another page called say Previous entries or similar.

Here is my code for the Safecracker form:

{embed="includes/html_head"}
<body>


<!-- Super Container for entire site -->
{embed="includes/masthead"}
<!-- Super Container -->
<div class="super-container full-width">

    <!-- 960 Container -->
    <div class="container">

        <!-- CONTENT -->
        <div class="eleven columns content">        
        <h2 class="title"><span>Submit your 8 choices!</span></h2>  

<!--============SAFECRACKER STUFF GOES RIGHT HERE=============-->
                    {exp:safecracker
  channel="user_entries"
  return="entries/confirmation"
  include_jquery="no"
  logged_out_member_id="2"
  rules:your_name="required"
  rules:choice_number_1="required"
  rules:choice_number_2="required"
  rules:choice_number_3="required"
  rules:choice_number_4="required"
  rules:choice_number_5="required"
  rules:choice_number_6="required"
  rules:choice_number_7="required"
  rules:choice_number_8="required"
  rules:title="required"
}
<br class="clearfix" />
            <hr />

<h3 class="feature">
    <label><strong>First please tell us your name</strong></label>
    <input type="text" class="text" name="your_name" value="{your_name}"/>
  </h3>
 <br class="clearfix" />
            <hr />
<h3 class="feature">
    <label><strong>Give your choice a memorable name</strong></label>
    <input type="text" class="text" name="title" value="{title}"/>
  </h3>

<fieldset class="five columns alpha aside">

  <!--Choice one code-->
  <h5>
    <label><strong>Choice number 1</strong></label>
    <input type="text" class="text" name="choice_number_1"/>
  </h5>
  <p>
    <label>Choice 1 description</label>
    <input type="text" class="text" name="choice_1_description"/>
  </p>
<br />
    <label>Choice 1 image</label>
    <input type="file" class="" name="choice_1_image" />
</fieldset>


<!--====Choice twocode-->
<fieldset class="five columns omega aside">
  <h5>
    <label><strong>Choice number 2</strong></label>
    <input type="text" class="text" name="choice_number_2"/>
  </h5>
  <p>
    <label>Choice 2 description</label>
    <input type="text" class="text" name="choice_2_description"/>
  </p>
  <br />
    <label>Choice 2 image</label>
    <input type="file" class="button green" name="choice_2_image"/>

  </fieldset>



<!--===============Choice three code-->
<fieldset class="five columns alpha aside">

<h5>
    <label><strong>Choice number 3</strong></label>
    <input type="text" class="text" name="choice_number_3"/>
  </h5>
  <p>
    <label>Choice 3 description</label>
    <input type="text" class="text" name="choice_3_description"/>
  </p>
<br />
    <label>Choice 3 image</label>
    <input type="file" class="button green" name="choice_3_image"/>

</fieldset>


<!--====Choice four code-->
<fieldset class="five columns omega aside">
  <h5>
    <label><strong>Choice number 4</strong></label>
    <input type="text" class="text" name="choice_number_4"/>
  </h5>
  <p>
    <label>Choice 4 description</label>
    <input type="text" class="text" name="choice_4_description"/>
  </p>
<br />
    <label>Choice 4 image</label>
    <input type="file" class="button green" name="choice_4_image"/>  
  </fieldset>



<!--===============Choice five code-->
<fieldset class="five columns alpha aside">

<h5>
    <label><strong>Choice number 5</strong></label>
    <input type="text" class="text" name="choice_number_5"/>
  </h5>
  <p>
    <label>Choice 5 description</label>
    <input type="text" class="text" name="choice_5_description"/>
  </p>
<br />
    <label>Choice 5 image</label>
    <input type="file" class="button green" name="choice_5_image"/>
</fieldset>


<!--====Choice six code-->
<fieldset class="five columns omega aside">
  <h5>
    <label><strong>Choice number 6</strong></label>
    <input type="text" class="text" name="choice_number_6"/>
  </h5>
  <p>
    <label>Choice 6 description</label>
    <input type="text" class="text" name="choice_6_description"/>
  </p>
<br />
    <label>Choice 6 image</label>
    <input type="file" class="button green" name="choice_6_image"/>
  </fieldset>


<!--===============Choice seven code-->
<fieldset class="five columns alpha aside">

<h5>
    <label><strong>Choice number 7</strong></label>
    <input type="text" class="text" name="choice_number_7"/>
  </h5>
  <p>
    <label>Choice 7 description</label>
    <input type="text" class="text" name="choice_7_description"/>
  </p>
<br />
    <label>Choice 7 image</label>
    <input type="file" class="button green" name="choice_7_image"/>
</fieldset>


<!--====Choice eight code-->
<fieldset class="five columns omega aside">
  <h5>
    <label><strong>Choice number 8</strong></label>
    <input type="text" class="text" name="choice_number_8"/>
  </h5>
  <p>
    <label>Choice 8 description</label>
    <input type="text" class="text" name="choice_8_description"/>
  </p>
<br />
    <label>Have an image for Choice 8 image?</label>
    <input type="file" class="button green" name="choice_8_image"/>
  </fieldset>  
<!==============End the fieldsets here for the 8 choices-->
<br class="clearfix" />
            <hr />
  <p>
  <input type="submit" class="button yellow" value="Submit your choices now!" />
</p>
   <br class="clear" />
{/exp:safecracker}

            <br class="clearfix" />
            <hr />

        </div>  
        <!-- /CONTENT -->

        <!-- SIDEBAR -->
        <div class="five columns sidebar">

            {embed="includes/sidebar"}      <!-- /SIDEBAR -->

    </div>
    <!-- /End 960 Container -->

</div>
<!-- /End Super Container -->


<!-- ============================================== -->


{footer}    
<!-- End Document
================================================== -->
</body>
</html>

I shall be eternally grateful to any body who can help me with this issue. Please remember I'm new to EE so go gentle.

Many thanks

Ilir

{exp:channel:entries channel="user_entries" limit="8" status="pending|open"}
  <h4 class="title">
    <span>
      This is the choice {title} made by {your_name} on {entry_date format="%F %d, %Y"}
    </span>
  </h4>
  <ol>
    <li class={first|second|third|fourth|fifth|sixth|seventh|last}>
      <h5>{choice_number_1}</h5>
      <p class="align-left">{choice_1_description}</p>
      <img class="align-left" src="{choice_1_image}"/>
    </li>
  </ol>
{/exp:channel:entries}
  • Can you post what your template looks like for displaying the entries from that channel on the front end? – Jean St-Amand Apr 19 '13 at 11:36
  • 'code'{exp:channel:entries channel="user_entries" limit="8" status="pending|open"} <h4 class="title"><span>This is the choice {title} made by {your_name} on {entry_date format="%F %d, %Y"}</span></h4> <ol> <li class={first|second|third|fourth|fifth|sixth|seventh|last}> <h5>{choice_number_1}</h5> <p class="align-left">{choice_1_description}</p> <img class="align-left" src="{choice_1_image}"/></li> </ol> {/exp:channel:entries} </div> <!-- /CONTENT --> <!-- SIDEBAR --> <div class="five columns sidebar">'code' – Ilir H Apr 19 '13 at 12:19
1

Try adding dynamic="no"and see if that changes things.

{exp:channel:entries channel="user_entries" limit="8" status="pending|open" dynamic="no"}Entry Title: {title}<br>Entry ID: {entry_id}<br>Choice 1 Description: {choice_1_description}<br><hr>{/exp:channel:entries}

  • The problem (or one of a number of problems) I have is also the I have 3 x 8 custom fields for each entry, because users need to make 8 choices I thought I would need to create the form with 3 fields for each entry, so one for Choice name, 1 for choice description and one for file upload so users can upload an image. What I don't know how to do is what code do I put where to display the entries in the front end, at the moment they go to the confirmation page which thanks users for the entry. How do I then display the entries as an admin from CP to display on the site once approved? – Ilir H Apr 19 '13 at 12:44
  • First, can you confirm that the user-submitted data is being saved in an entry in the user_entries channel? Do they show up correctly in EE on the backend? – Stephen Callender Apr 19 '13 at 13:46
  • Yes they do, apart from the images. They are not showing although they are being uploaded to the directory I specified. – Ilir H Apr 19 '13 at 14:02
  • oops my mistake, the images are actually not being uploaded to the directory specified, just checked this! – Ilir H Apr 19 '13 at 14:03
  • try the exact code above and see what it does. – Stephen Callender Apr 19 '13 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.