I did that on purpose. The rest of the safecracker form code is below the code.
Basically the logic is that if the user has an entry in existance it will be an “edit” form. If they don’t have an entry it’s an “add.” This is because they are allowed only 1 entry in this channel.
I tried putting all of the safecracker code within each if statment but it doesn’t like that at all.
What I have now that works (but not how I want) is this:
{exp:safecracker channel="staff_memberâ? entry_id="{segment_3}" author_only="yes" author_id="CURRENT_USER" form_class="myform" }
So if there is an entry id it’s an edit form and none it’s an add. I have the links set up like so:
{exp:channel:entries channel="staff_member" author_id="CURRENT_USER" dynamic="off"}
<a href="{path=directory/listing_addedit}/{entry_id}">Edit Staff Listing</a><br />
{if no_results}<a href="{path=directory/listing_addedit}">Add Staff Listing</a><br />{/if}
{/exp:channel:entries}
The problem is that if a user ever removes the entry ID from the URL they will be able to add additional listings.
I can’t think of any way to test if they have an entry already and make it an edit form. Have any safecracker code w/in a channel entries call seems to break it complete.