Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
public-side article-submission
Hi,
I’m still trying to setup a public-side form that people can use to submit article content directly into my textpattern
table. I have a working installation using ign_password_protect
, mem_self_register
, mem_form
, and mem_moderation
— it’s almost perfect, but I want the submitted article content to bypass Manfre’s wonderful moderation queue.
Gocom said that writing a plugin to do this would take two minutes:
just copy every function from txp_article.php, install ign_password_protect, make it to use ign_user global and replace all echos with return— and tada, we got a custom add new content page.
Disillusioned with overconfidence, I tried to make this happen, but I don’t have the PHP chops for it.
I’d be super grateful to get some help on this. If this can really be done in two minutes, would someone be willing to post a draft of this plugin?
My public-side form includes the following fields:
- Section (using
mem_form_secret
— this is predetermined for each input form). - Title.
- Posted— need users to be able to manually enter a publication date.
- Body— accepting Textile input.
- Keywords.
- Category1.
- Custom fields 1-20 (with support for glz_custom_fields).
Using mem_form
and mem_moderation_article
, I’m pretty close to the desired solution.
Who will pick up the gauntlet? I appreciate any wisdom or guidance you might provide!
Last edited by johnstephens (2009-02-01 04:02:58)
Offline
Offline
Re: public-side article-submission
I’m working on a discussion site that will aggregate article metadata from a variety of publications. Users will be able to find article info (including a link to the article, when available) and discuss the article right there. Users will also be able to post references to articles on an ongoing basis to open new discussions. I posted a little more detail here.
If I’m a reader of articles on a certain topic, I might come to find new articles & discussions (we won’t host the actual article, just a formatted reference, including title, author, keywords, and link) related to that. If I’m an author, editor, critic, or concerned citizen, I might want to post references to new articles as they come out. That’s why I need the public-facing “write” form, which will be slightly simpler than the TXP interface, and styled like the rest of the site.
Does that help?
Last edited by johnstephens (2008-09-19 01:21:34)
Offline
Re: public-side article-submission
I wonder if this would be easier to do without a plugin— using the txp:php
element. If I follow this method, What would the correct action
be for the form
element? Is there anything else I need to take into consideration?
Last edited by johnstephens (2008-09-19 04:14:35)
Offline
Re: public-side article-submission
If the create article form is on an article page, I’d use permlinkurl_id()
. Otherwise, a section name would work.
<txp:php>
global $thisarticle;
$uri = permlinkurl_id($thisarticle['thisid']);
echo <<<EOD
<form action="{$uri}" method="post">
...form HTML
</form>
EOD;
</txp:php>
Offline
Re: public-side article-submission
Note: it doesn’t have any glz_custom_field integration, but you can sorta force it to work.
Offline
Re: public-side article-submission
jm wrote:
If the create article form is on an article page, I’d use
permlinkurl_id()
. Otherwise, a section name would work.
<txp:php>
global $thisarticle;
$uri = permlinkurl_id($thisarticle['thisid']);
echo <<<EOD
<form action="{$uri}" method="post">
...form HTML
</form>
EOD;
</txp:php>
Would I be right in Thinking that if this code was added to an article, and then someone added some data and submitted it, it would then be added to my article list? x
~ Cameron
Offline
Re: public-side article-submission
Thank you Jon-Michael & Mr. Manfre! Manfre— you win the 2-minute plugin challenge, which qualifies you as a contender for the 2009 Badass Games! (Jon-Michael, your input was helpful too, and allowed me to go to bed last night knowing I could move forward in the morning.)
My initial tests of mem_simple_form
have yielded a few questions that I shall post over on the mem_form thread. Thanks again!
Offline
Re: public-side article-submission
Somehow, mem_simple_form stopped working for me, so I’m revisiting this problem and struggling profoundly.
Over on the #xpat channel, Jukka 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.
After I get this basic thing working, what I’d like to do is roll in support for mem_form and glz_custom_fields and release it as a plugin. My understanding is that mem_form is way more secure. I’d also like to take advantage of Textpattern’s ability to turn ‘Body’ input into ‘Body_html’ input using textile, but first things first.
Would anyone be willing to offer guidance, wit, or wisdom?
Offline
Pages: 1