[wp-hackers] Dashboard plugin/widget development - create new post
James Nachlin
jnachlin at sixapart.com
Mon Apr 5 16:32:16 UTC 2010
Hi List,
I thought this would be easy at first. Maybe it is.
I am developing a dashboard widget that creates a post. Trying to
emulate what QuickPress does, only the title is from a select box,
instead of text input.
Here is the form. It points at wp-admin/post.php. I get redirected to
edit.php, but no post shows up. No error message
ether.
<?php
function draw_form($instance) {
global $qotd_user_id, $qotd_base_url, $local_url;
$json = $this->get_questions($qotd_user_id);
?>
<form id="answerform" name="answerform" action="<?php echo
esc_url( admin_url( 'post.php' ) ); ?>" method="post">
<h4 id="content-label"><label
for="content">Question</label></h4>
<select>
<?php
foreach($json as &$q) {
?>
<option value="<?php echo $q{'pk'} ?>"><?php echo
$q{'fields'}{'text'} ?></option>
<?php
}
?>
</select>
<h4 id="content-label"><label for="content">Answer</
label></h4>
<div class="textarea-wrap">
<textarea name="content" id="content"
class="mceEditor"
rows="3" cols="15" tabindex="2"></textarea>
</div>
<p class="submit">
<input type="hidden"
name="conversation_post_ID" value="0" /
>
<input type="hidden" id="_wpnonce"
name="_wpnonce" value="<?
php echo wp_create_nonce( "conversate_$qotd_user_id" ) ?>" />
<input type="submit" name="save"
id="save-post"
class="button" tabindex="4" value="Save Draft" />
<input type="reset" value="Reset" class="button" /
>
<input type="submit" name="publish"
id="publish"
accesskey="p" tabindex="5"
class="button-primary"
value="Publish" />
<br class="clear" />
</p>
</form>
<?php
}
?>
Thanks in advance for any help or suggestions!
-JIM
P.S.
Apologies if this question already posted. I seem to be having posting
issues.
More information about the wp-hackers
mailing list