@jpelker, definitely definitely. If you dm me on twitter with your email address I can send you an invite. Otherwise I hope these pics help/I’ve uploaded a .zip document with the three files the form, the functions, and the ajax which you can download.
IMG | ZIP (the zipped file is the entire GPH theme)
Also the code is here below:
//–Form
<?php
$user = get_userdata( $current_user->ID );
$name = isset( $user->first_name ) && $user->first_name? $user->first_name : $user->display_name;
?>
<div id="postbox">
<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
<input type="hidden" name="action" value="post" />
<?php wp_nonce_field( 'new-post' ); ?>
<div class="inputarea">
<label for="post_title_src"><?php printf( __('Hey, what's Glitzy Poppy Hooray today?', 'p2'), wp_specialchars( $name ) ) ?></label>
<label class="post-error" for="posttext" id="posttext_error"></label>
<div class = "prepostcat">
<div class="postrow">
<input type="text" name="post_title_src" id="post_title_src" tabindex="1" autocomplete="off" value="<?php echo attribute_escape(__('Artist —?Song', 'p2')); ?>"
onfocus="this.value=(this.value=='<?php echo js_escape(__('Artist —?Song', 'p2')); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo js_escape(__('Artist —?Song', 'p2')); ?>' : this.value;" />
</div>
<br />
<div class="postrow">
<input type="text" name="post_music_src" id="post_music_src" tabindex="2" autocomplete="off" value="<?php echo attribute_escape(__('https://someplace.com/endingwith.mp3', 'p2')); ?>"
onfocus="this.value=(this.value=='<?php echo js_escape(__('https://someplace.com/endingwith.mp3', 'p2')); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo js_escape(__('https://someplace.com/endingwith.mp3', 'p2')); ?>' : this.value;" />
</div>
</div>
<div class = "postcat">
<label for= "post_category">Choose a category —</label>
<!-- <input id = "post_category" type = "radio" name = "post_category" class="post_category" value="3"> Glitzy
<input id = "post_category" type = "radio" name = "post_category" class="post_category" value="4"> Poppy
<input id = "post_category" type = "radio" name = "post_category" class="post_category" value="5"> Hooray -->
<?php wp_dropdown_categories('hide_empty=0&name=post_category'); ?>
</div><div class="clear"></div><br />
<div class = "postrow">
<input type="text" name="tags" id="tags" tabindex="3" autocomplete="off" value="<?php echo attribute_escape(__('Tag it', 'p2')); ?>"
onfocus="this.value=(this.value=='<?php echo js_escape(__('Tag it', 'p2')); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo js_escape(__('Tag it', 'p2')); ?>' : this.value;" />
<input id="submit" type="submit" tabindex="4" value="<?php echo attribute_escape(__('Post it', 'p2')); ?>" />
</div>
<span class="progress" id="ajaxActivity"><img src="<?php bloginfo('template_directory'); ?>/i/indicator.gif"
alt="<?php echo attribute_escape(__('Loading...', 'p2')); ?>" title='<?php echo attribute_escape(__('Loading...', 'p2')); ?>'/></span>
</div><div class="clear"></div>
</form>
</div><!-- // postbox -->
//–Ajax
function newPost(trigger) {
var thisForm = $(trigger.target);
var thisFormElements = $('#post_title_src, #post_music_src, #post_category, #tags, :input',thisForm).not('input[type=hidden]');
var submitProgress = thisForm.find('span.progress');
//var posttext = $.trim($('#posttext').val());
var post_title_src = $.trim($('#post_title_src').val());
var post_music_src = $.trim($('#post_music_src').val());
console.log(post_music_src)
if ("" == post_title_src || "" == post_music_src) {
$("label#posttext_error").text('This field is required').show().focus();
return false;
}
toggleUpdates('unewposts');
if (typeof ajaxCheckPosts != "undefined")
ajaxCheckPosts.abort();
$("label#posttext_error").hide();
thisFormElements.attr('disabled', true);
thisFormElements.addClass('disabled');
submitProgress.show();
var tags = $('#tags').val();
if (tags == p2txt.tagit) tags = '';
var post_category = $('#post_category').val();
//var args = {action: 'prologue_new_post', _ajax_post:nonce, posttext: posttext, tags: tags};
var args = {action: 'prologue_new_post', _ajax_post:nonce, post_title: post_title_src, meta_value: post_music_src, post_category: post_category, tags: tags};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
console.log(args);
var errorMessage = '';
$.ajax({
type: "POST",
url: ajaxUrl,
data: args,
success: function(result) {
if ("0" == result)
errorMessage = p2txt.not_posted_error;
//$('#posttext').val('');
$('#post_music_src').val('');
$('#post_title_src').val('');
$('#tags').val(p2txt.tagit);
if(errorMessage != '') {
newNotification(errorMessage);
}
if ($.suggest)
$('ul.ac_results').css('display', 'none'); // Hide tag suggestion box if displayed
if (isFirstFrontPage && result != "0") {
getPosts(false);
} else if (!isFirstFrontPage && result != "0") {
newNotification(p2txt.update_posted);
console.log(p2.txt.update_posted);
}
submitProgress.fadeOut();
thisFormElements.attr('disabled', false);
thisFormElements.removeClass('disabled');
}
});
thisFormElements.blur();
toggleUpdates('unewposts');
}
//–Functions
function prologue_new_post() {
if( 'POST' != $_SERVER['REQUEST_METHOD'] || empty( $_POST['action'] ) || $_POST['action'] != 'prologue_new_post' ) {
die();
}
if ( !is_user_logged_in() ) {
die('<p>'.__('Error: not logged in.', 'p2').'</p>');
}
if( !current_user_can( 'publish_posts' ) ) {
die('<p>'.__('Error: not allowed to post.', 'p2').'</p>');
}
check_ajax_referer( 'ajaxnonce', '_ajax_post' );
$user_id = $current_user->user_id;
//$post_content = $_POST['posttext'];
$tags = trim( $_POST['tags'] );
$category = $_POST['post_category'];
$post_title_src = $_POST['post_title'];
$post_music_src = $_POST['meta_value'];
if ( $tags == __('Tag it', 'p2') || $tags == 'Tag it' ) $tags = '';
if ( $post_title_src == __('Artist —?Song', 'p2') || $tags == 'Artist —?Song' ) die('<p>'.__('Error: You must fill this in.', 'p2').'</p>');
if ( $post_music_src == __('https://someplace.com/endingwith.mp3', 'p2') || $tags == 'https://someplace.com/endingwith.mp3' ) die('<p>'.__('Error: You must fill this in.', 'p2').'</p>');
$post_title = prologue_title_from_content( $post_content );
$post_id = wp_insert_post( array(
'post_author' => $user_id,
'post_title' => $post_title_src,
//'music_src' => $post_music_src,
//'post_content' => $post_content,
'post_category' => array($category),
'tags_input' => $tags,
'post_status' => 'publish'
) );
add_post_meta($post_id, 'music_src', $post_music_src);
echo $post_id? $post_id : '0';
exit;
}
These are the relevant bits from the files. Hope that helps