whaleen
1/9/2012 - 7:52 PM

Front end editing of Textpattern articles

Front end editing of Textpattern articles

<txp:cbe_frontauth_protect>


<!--    Requires a URL variable matching the ID of article to be edited.

Do: http://domain.com/?article_id=123 to load the article with the ID of 123 into the form below.
============================================================================== -->

<txp:smd_query query="SELECT id, title, body, excerpt FROM textpattern WHERE  id = '?article_id'">

<h1>Edit (Update) Article</h1>

<txp:mem_simple_form table="textpattern" id_field="id" id_insert="0" success_form="success_form_name">

        <txp:mem_form_text name="table_title" label="Title" break="" default="{title}" />
        
        <!-- Body and Excerpt are not required / can be removed if not needed -->
        <txp:mem_form_textarea name="table_body" label="" break="" default="{body}" required="0" />
        <txp:mem_form_textarea name="table_excerpt" label="" break="" default="{excerpt}" required="0" />
        
        <!-- Optionally add Custom Fields for use
        <txp:mem_form_secret name="table_custom_1" value='{custom_1}' />
        <txp:mem_form_secret name="table_custom_2" value='{custom_2}' />
        <txp:mem_form_secret name="table_custom_3" value='{custom_3}' />    
        -->
        
        <!-- Must have for articel update : remove if you want to create a new article instead -->
        <txp:mem_form_secret name="integer_id" value="{id}" />
        
    <txp:mem_form_submit />

</txp:mem_simple_form>

</txp:smd_query>

</txp:cbe_frontauth_protect>