Skip to content

Instantly share code, notes, and snippets.

@whaleen
Last active September 29, 2015 10:07
Show Gist options
  • Save whaleen/1584602 to your computer and use it in GitHub Desktop.
Save whaleen/1584602 to your computer and use it in GitHub Desktop.
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment