Have you ever needed to edit some txp data (articles, users, etc) on the public side, or even import them automatically from external sources? Then welcome etc_post
!
It registers <txp:etc_post />
tag that serves as entry point to the admin side. To see an example, suppose we want to allow the site visitors to submit draft articles in articles
section.
- Create a
Freelancer
user, sayguest
. - Create a custom HTML-type form, say
postit
:
<txp:etc_post user="guest" event="article" step="save" post="Title, Body, Excerpt, Keywords">
Section=articles
Status=3
publish_now=1
</txp:etc_post>
<txp:header name="Location" value='<txp:site_url />' />
- Create an article (or even a static web page) with a HTML form like
<form action="?f=postit" method="post">
<input name="Title" placeholder="Title" required="required" /><br />
<input name="Keywords" placeholder="Keywords" /><br />
<textarea name="Body" placeholder="Body"></textarea>
<textarea name="Excerpt" placeholder="Excerpt"></textarea>
<input type="submit" />
</form>
Now everyone can use it to submit draft articles under guest
account. Which means use it with much caution :-)
Actually, you can send this form data to ?f=postit
via some automated script too. Of course, you can put <txp:etc_post />
tag elsewhere (in an article, etc) where it can be parsed, and send data to its URL. And you are not limited to article posting, unlike with some specialized plugins. It suffices to change event
and step
attributes to trigger any (core or plugin) admin-side action (upload an image, register a new user, etc). The plugin does not write directly to db, but uses the standard txp workflow instead, making txp think it all happens on the admin side.
To see it in action, try changing the first commenter name, as if you were on my Comments tab:
Enjoy!
File(s)
- File: etc_post_v0.2.txt [5.17 kB] (297 downloads, ~8 per month)