Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Public-side article-submission
Friends, I got in over my head. Please help!
I’m working on a site that will use a password-protected input form on the public side of the site as an entry point for new articles.
Input fields are needed for the following database fields:
- Section.
- Title.
- Body & Body_html— accepting Textile input.
- Keywords.
- Category1.
- Custom fields 1-20 (with support for glz_custom_fields).
I have used TXPhorum and mem_moderation_article, both of which approach the desired result: TXPhorum doesn’t include support for glz_custom_fields (and does it work with the latest version of Textpattern?), and mem_moderation_article is locked in to the moderation workflow— it doesn’t support publishing directly from the input form.
Jukka (Gocom) suggested this as the beginning of a solution:
<?php
if(gps('article_save')) our_new_article_save();
function our_new_article_save() {
global $ign_user;
if($ign_user) {
extract(doSlash(gpsa(array(
// copy here vars from txp_article.php
))));
safe_insert(
'textpattern',
// copy here query from save -function
// only replace $txp_user with $ign_user
);
}
}
// and build form using same fields than backend, plus include there <input type="hidden" name="article_save" value="1" />
I’ve been working on it, and this is what I have so far.
Right now, it’s not working— Textpattern displays the form correctly, but nothing happens when the form is submitted. No new entries in the database, and no error messages. Someone with PHP-insight can probably see what’s happening, but I have no idea.
Here’s my attempt to roll in support for mem_form
If you have PHP chops, please offer me a shred of your wisdom! I’m new to PHP, and I appreciate every concrete suggestion!
- The main point is to publish user input to the
textpattern
table on submit. What do I need to do to get this part working? - What is the correct way to integrate mem_form ?
- How do I get the plugin to check for and pull in glz_custom_fields ?
- What lines are needed to get Textpattern to convert ‘Body’ input into ‘Body_html’ input using textile?
Thank you!
Last edited by johnstephens (2009-02-02 16:45:08)
Offline
Re: Public-side article-submission
I’m in the process of doing something sort-of similar. It doesn’t sound as intensive as your needs, but essentially allows people to write stuff on the admin side that gets saved to an article. The code’s a bit hairy because various priv levels can do various things and — depending on your login — you see different parts of the form.
I must confess I haven’t used mem_form for that bit (I hard-coded the HTML) but I am using mem_form (and of course the awesome ign_password_protect) for handling managerial updates to user accounts from the public side.
(TXPhorum has been heavily modded to build in a tonne of extra features and has been skillfully styled by jakob and Uli)
I can help you right now with the Textile bit:
include_once txpath.'/lib/classTextile.php';
$textile = new Textile();
$Body_html = $textile->TextileThis($Body);
If you want to have a peek at the nuts and bolts of the site so you can steal stuff, get in touch.
EDIT: I see you have already ;-)
Last edited by Bloke (2009-02-02 19:33:53)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Pages: 1