<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>WordPress &#8250; Support Topic: p2 Custom Field//Meta Data Insertion</title>
<link>http://wordpress.org/support/</link>
<description>WordPress &#8250; Support Topic: p2 Custom Field//Meta Data Insertion</description>
<language>en</language>
<pubDate>Tue, 24 Nov 2009 15:25:13 +0000</pubDate>

<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1115532</link>
<pubDate>Wed, 24 Jun 2009 23:04:12 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1115532@http://wordpress.org/support/</guid>
<description>&#60;p&#62;There's no post content, just a title--ha! &#60;/p&#62;
&#60;p&#62;How could I make the post title and the post content the same? I'm cheating right now by posting the title, but I'd rather have a cleaner solution.&#60;/p&#62;
&#60;p&#62;One issue remains:&#60;/p&#62;
&#60;p&#62;1) Firefox doesn't want anything to do with the post. Please see the site here: &#60;a href=&#34;http://yourstatussucks.com/home/&#34; rel=&#34;nofollow&#34;&#62;http://yourstatussucks.com/home/&#60;/a&#62; . Safari works, though.
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1115522</link>
<pubDate>Wed, 24 Jun 2009 22:53:43 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1115522@http://wordpress.org/support/</guid>
<description>&#60;p&#62;What doesn't look right about the first image??? I modified entry.php a bit. If you look around lines 29-38&#60;/p&#62;
&#60;p&#62;----------------------------------------&#60;/p&#62;
&#60;p&#62;Also I used the following plugins—&#60;br /&#62;
Akismet, All in One SEO Pack, Audio player, Invite friends, Peter's Login Redirect, and Twitter Tools&#60;/p&#62;
&#60;p&#62;----------------------------------------&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;The custom field is posting (at least after refresh)&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;You have to update &#60;code&#62;function prologue_latest_posts()&#60;/code&#62; in functions.php around line 703&#60;/p&#62;
&#60;p&#62;Hope that helps! Sorry I can't fix for you, but it's good practice :D
&#60;/p&#62;</description>
</item>
<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1115497</link>
<pubDate>Wed, 24 Jun 2009 22:26:01 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1115497@http://wordpress.org/support/</guid>
<description>&#60;p&#62;And it doesn't work in firefox...
&#60;/p&#62;</description>
</item>
<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1115445</link>
<pubDate>Wed, 24 Jun 2009 21:47:55 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1115445@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I'm getting close...&#60;/p&#62;
&#60;p&#62;Here's my code, if anyone wants to take a look at it: &#60;a href=&#34;http://yourstatussucks.com/P2-Status.zip&#34;&#62;Zipped theme&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;The custom field is posting (at least after refresh) and the title and categories do get added to the post's database entry. Good, good.&#60;/p&#62;
&#60;p&#62;Unfortunately, the new entries don't read quite right yet. See &#60;a href=&#34;http://item-9.com/uploads/Your_Status_Sucks-20090624-164456.jpg&#34;&#62;here&#60;/a&#62; for what it looks like immediately after posting.  Then, after a refresh, they only say &#34;Click to edit&#34; (&#60;a href=&#34;http://item-9.com/uploads/Your_Status_Sucks-20090624-164637.jpg&#34;&#62;Image here&#60;/a&#62;). &#60;/p&#62;
&#60;p&#62;Any clues? What file/lines should I be looking to edit?
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1113932</link>
<pubDate>Tue, 23 Jun 2009 17:19:36 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1113932@http://wordpress.org/support/</guid>
<description>&#60;p&#62;hmmm, I haven't looked at your code extensively yet, but just from what you've written there's two things that come to mind that may help.&#60;/p&#62;
&#60;p&#62;1. The packaged .zip available doesn't use entry.php it's just there for reference for when I break gph-form.php&#60;/p&#62;
&#60;p&#62;2. Your post title issue; does that not insert into the db or does it not show up in ajax? At the end of &#60;code&#62;newPost&#60;/code&#62; you'll notice a case change for &#60;code&#62;unewposts&#60;/code&#62; this inserts the new post via ajax. functions.php and unewposts are 2 concurrent functions because functions actually gets it in the database + unewposts shows the content that you've submitted via ajax.&#60;/p&#62;
&#60;p&#62;Also when you modify &#60;code&#62;prologue_new_post&#60;/code&#62; in functions.php don't forget to update &#60;code&#62;prologue_new_post_noajax&#60;/code&#62; — I'll get back to you when I have more time to further investigate.
&#60;/p&#62;</description>
</item>
<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1113468</link>
<pubDate>Tue, 23 Jun 2009 06:25:34 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1113468@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I feel like I almost have it solved, but I'm not having any luck getting my custom field (user_name) to register. I've also lost the ability for the content to become the post's title. If anyone is interested in helping me spot these errors, please take a look at the code included in this &#60;a href=&#34;http://yourstatussucks.com/P2-edited.zip&#34;&#62;Zipped P2 file&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;I only really only edited gph-form.php, functions.php, entry.php, P2.js and style.css files. If it'll help, feel free to compare it to the zipped theme posted above from @jonobr1. I thought I'd have a better chance reverse engineering the 1.0.3 code borrowed from him than translating it to my P2 1.0.4 code.&#60;/p&#62;
&#60;p&#62;Thank you in advance.
&#60;/p&#62;</description>
</item>
<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1112945</link>
<pubDate>Mon, 22 Jun 2009 19:27:27 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1112945@http://wordpress.org/support/</guid>
<description>&#60;p&#62;@jonobr1: That is about the most helpful reply I've ever seen. Wow. Thank you so much.
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1112239</link>
<pubDate>Mon, 22 Jun 2009 03:20:50 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1112239@http://wordpress.org/support/</guid>
<description>&#60;p&#62;@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.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.flickr.com/photos/jonobr1/3649470330/&#34;&#62;IMG&#60;/a&#62; &#124; &#60;a href=&#34;http://jonobr1.com/_media/p2.zip&#34;&#62;ZIP&#60;/a&#62; (the zipped file is the entire GPH theme)&#60;/p&#62;
&#60;p&#62;Also the code is here below:&#60;/p&#62;
&#60;p&#62;//--Form&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
$user = get_userdata( $current_user-&#38;gt;ID );
$name = isset( $user-&#38;gt;first_name ) &#38;amp;&#38;amp; $user-&#38;gt;first_name? $user-&#38;gt;first_name : $user-&#38;gt;display_name;
?&#38;gt;
 &#38;lt;div id=&#38;quot;postbox&#38;quot;&#38;gt;
	&#38;lt;form id=&#38;quot;new_post&#38;quot; name=&#38;quot;new_post&#38;quot; method=&#38;quot;post&#38;quot; action=&#38;quot;&#38;lt;?php bloginfo( &#38;#39;url&#38;#39; ); ?&#38;gt;/&#38;quot;&#38;gt;
		&#38;lt;input type=&#38;quot;hidden&#38;quot; name=&#38;quot;action&#38;quot; value=&#38;quot;post&#38;quot; /&#38;gt;
		&#38;lt;?php wp_nonce_field( &#38;#39;new-post&#38;#39; ); ?&#38;gt;
		&#38;lt;div class=&#38;quot;inputarea&#38;quot;&#38;gt;
			&#38;lt;label for=&#38;quot;post_title_src&#38;quot;&#38;gt;&#38;lt;?php printf( __(&#38;#39;Hey, what&#38;amp;apos;s Glitzy Poppy Hooray today?&#38;#39;, &#38;#39;p2&#38;#39;), wp_specialchars( $name ) ) ?&#38;gt;&#38;lt;/label&#38;gt;
			&#38;lt;label class=&#38;quot;post-error&#38;quot; for=&#38;quot;posttext&#38;quot; id=&#38;quot;posttext_error&#38;quot;&#38;gt;&#38;lt;/label&#38;gt;
			&#38;lt;div class = &#38;quot;prepostcat&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;postrow&#38;quot;&#38;gt;
					&#38;lt;input type=&#38;quot;text&#38;quot; name=&#38;quot;post_title_src&#38;quot; id=&#38;quot;post_title_src&#38;quot; tabindex=&#38;quot;1&#38;quot; autocomplete=&#38;quot;off&#38;quot; value=&#38;quot;&#38;lt;?php echo attribute_escape(__(&#38;#39;Artist — Song&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;quot;
						onfocus=&#38;quot;this.value=(this.value==&#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;Artist — Song&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39;) ? &#38;#39;&#38;#39; : this.value;&#38;quot;
						onblur=&#38;quot;this.value=(this.value==&#38;#39;&#38;#39;) ? &#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;Artist — Song&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39; : this.value;&#38;quot; /&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;br /&#38;gt;
				&#38;lt;div class=&#38;quot;postrow&#38;quot;&#38;gt;
						&#38;lt;input type=&#38;quot;text&#38;quot; name=&#38;quot;post_music_src&#38;quot; id=&#38;quot;post_music_src&#38;quot; tabindex=&#38;quot;2&#38;quot; autocomplete=&#38;quot;off&#38;quot; value=&#38;quot;&#38;lt;?php echo attribute_escape(__(&#38;#39;http://someplace.com/endingwith.mp3&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;quot;
							onfocus=&#38;quot;this.value=(this.value==&#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;http://someplace.com/endingwith.mp3&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39;) ? &#38;#39;&#38;#39; : this.value;&#38;quot;
							onblur=&#38;quot;this.value=(this.value==&#38;#39;&#38;#39;) ? &#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;http://someplace.com/endingwith.mp3&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39; : this.value;&#38;quot; /&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;

			&#38;lt;div class = &#38;quot;postcat&#38;quot;&#38;gt;
					&#38;lt;label for= &#38;quot;post_category&#38;quot;&#38;gt;Choose a category —&#38;lt;/label&#38;gt;
					&#38;lt;!-- &#38;lt;input id = &#38;quot;post_category&#38;quot; type = &#38;quot;radio&#38;quot; name = &#38;quot;post_category&#38;quot; class=&#38;quot;post_category&#38;quot; value=&#38;quot;3&#38;quot;&#38;gt;&#38;amp;nbsp;Glitzy&#38;amp;nbsp;
					&#38;lt;input id = &#38;quot;post_category&#38;quot; type = &#38;quot;radio&#38;quot; name = &#38;quot;post_category&#38;quot; class=&#38;quot;post_category&#38;quot; value=&#38;quot;4&#38;quot;&#38;gt;&#38;amp;nbsp;Poppy&#38;amp;nbsp;
					&#38;lt;input id = &#38;quot;post_category&#38;quot; type = &#38;quot;radio&#38;quot; name = &#38;quot;post_category&#38;quot; class=&#38;quot;post_category&#38;quot; value=&#38;quot;5&#38;quot;&#38;gt;&#38;amp;nbsp;Hooray --&#38;gt;
					&#38;lt;?php wp_dropdown_categories(&#38;#39;hide_empty=0&#38;amp;name=post_category&#38;#39;); ?&#38;gt;
			&#38;lt;/div&#38;gt;&#38;lt;div class=&#38;quot;clear&#38;quot;&#38;gt;&#38;lt;/div&#38;gt;&#38;lt;br /&#38;gt;
			&#38;lt;div class = &#38;quot;postrow&#38;quot;&#38;gt;
				&#38;lt;input type=&#38;quot;text&#38;quot; name=&#38;quot;tags&#38;quot; id=&#38;quot;tags&#38;quot; tabindex=&#38;quot;3&#38;quot; autocomplete=&#38;quot;off&#38;quot; value=&#38;quot;&#38;lt;?php echo attribute_escape(__(&#38;#39;Tag it&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;quot;
					onfocus=&#38;quot;this.value=(this.value==&#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;Tag it&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39;) ? &#38;#39;&#38;#39; : this.value;&#38;quot;
					onblur=&#38;quot;this.value=(this.value==&#38;#39;&#38;#39;) ? &#38;#39;&#38;lt;?php echo js_escape(__(&#38;#39;Tag it&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39; : this.value;&#38;quot; /&#38;gt;
					&#38;lt;input id=&#38;quot;submit&#38;quot; type=&#38;quot;submit&#38;quot; tabindex=&#38;quot;4&#38;quot; value=&#38;quot;&#38;lt;?php echo attribute_escape(__(&#38;#39;Post it&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;quot; /&#38;gt;
			&#38;lt;/div&#38;gt;
			&#38;lt;span class=&#38;quot;progress&#38;quot; id=&#38;quot;ajaxActivity&#38;quot;&#38;gt;&#38;lt;img src=&#38;quot;&#38;lt;?php bloginfo(&#38;#39;template_directory&#38;#39;); ?&#38;gt;/i/indicator.gif&#38;quot;
				alt=&#38;quot;&#38;lt;?php echo attribute_escape(__(&#38;#39;Loading...&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;quot; title=&#38;#39;&#38;lt;?php echo attribute_escape(__(&#38;#39;Loading...&#38;#39;, &#38;#39;p2&#38;#39;)); ?&#38;gt;&#38;#39;/&#38;gt;&#38;lt;/span&#38;gt;
		&#38;lt;/div&#38;gt;&#38;lt;div class=&#38;quot;clear&#38;quot;&#38;gt;&#38;lt;/div&#38;gt;
	&#38;lt;/form&#38;gt;
&#38;lt;/div&#38;gt;&#38;lt;!-- // postbox --&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;//--Ajax&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function newPost(trigger) {
		var thisForm = $(trigger.target);
		var thisFormElements = $(&#38;#39;#post_title_src, #post_music_src, #post_category, #tags, :input&#38;#39;,thisForm).not(&#38;#39;input[type=hidden]&#38;#39;);

		var submitProgress = thisForm.find(&#38;#39;span.progress&#38;#39;);

		//var posttext = $.trim($(&#38;#39;#posttext&#38;#39;).val());
		var post_title_src = $.trim($(&#38;#39;#post_title_src&#38;#39;).val());
		var post_music_src = $.trim($(&#38;#39;#post_music_src&#38;#39;).val());
		console.log(post_music_src)
		if (&#38;quot;&#38;quot; == post_title_src &#124;&#124; &#38;quot;&#38;quot; == post_music_src) {
			$(&#38;quot;label#posttext_error&#38;quot;).text(&#38;#39;This field is required&#38;#39;).show().focus();
			return false;
		}
		toggleUpdates(&#38;#39;unewposts&#38;#39;);
		if (typeof ajaxCheckPosts != &#38;quot;undefined&#38;quot;)
			ajaxCheckPosts.abort();
		$(&#38;quot;label#posttext_error&#38;quot;).hide();
		thisFormElements.attr(&#38;#39;disabled&#38;#39;, true);
		thisFormElements.addClass(&#38;#39;disabled&#38;#39;);

		submitProgress.show();
		var tags = $(&#38;#39;#tags&#38;#39;).val();
		if (tags == p2txt.tagit) tags = &#38;#39;&#38;#39;;
		var post_category = $(&#38;#39;#post_category&#38;#39;).val();
		//var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, posttext: posttext, tags: tags};
		var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, post_title: post_title_src, meta_value: post_music_src, post_category: post_category, tags: tags};
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		console.log(args);

		var errorMessage = &#38;#39;&#38;#39;;
		$.ajax({
			type: &#38;quot;POST&#38;quot;,
			url: ajaxUrl,
			data: args,
			success: function(result) {
				if (&#38;quot;0&#38;quot; == result)
					errorMessage = p2txt.not_posted_error;

				//$(&#38;#39;#posttext&#38;#39;).val(&#38;#39;&#38;#39;);

				$(&#38;#39;#post_music_src&#38;#39;).val(&#38;#39;&#38;#39;);
				$(&#38;#39;#post_title_src&#38;#39;).val(&#38;#39;&#38;#39;);

				$(&#38;#39;#tags&#38;#39;).val(p2txt.tagit);

				if(errorMessage != &#38;#39;&#38;#39;) {
					newNotification(errorMessage);
				}
				if ($.suggest)
					$(&#38;#39;ul.ac_results&#38;#39;).css(&#38;#39;display&#38;#39;, &#38;#39;none&#38;#39;); // Hide tag suggestion box if displayed

				if (isFirstFrontPage &#38;amp;&#38;amp; result != &#38;quot;0&#38;quot;) {
					getPosts(false);
				} else if (!isFirstFrontPage &#38;amp;&#38;amp; result != &#38;quot;0&#38;quot;) {
					newNotification(p2txt.update_posted);
					console.log(p2.txt.update_posted);
				}
				submitProgress.fadeOut();
				thisFormElements.attr(&#38;#39;disabled&#38;#39;, false);
				thisFormElements.removeClass(&#38;#39;disabled&#38;#39;);
			  }
		});
		thisFormElements.blur();
		toggleUpdates(&#38;#39;unewposts&#38;#39;);
	}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;//--Functions&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function prologue_new_post() {
	if( &#38;#39;POST&#38;#39; != $_SERVER[&#38;#39;REQUEST_METHOD&#38;#39;] &#124;&#124; empty( $_POST[&#38;#39;action&#38;#39;] ) &#124;&#124; $_POST[&#38;#39;action&#38;#39;] != &#38;#39;prologue_new_post&#38;#39; ) {
	    die();
	}
	if ( !is_user_logged_in() ) {
		die(&#38;#39;&#38;lt;p&#38;gt;&#38;#39;.__(&#38;#39;Error: not logged in.&#38;#39;, &#38;#39;p2&#38;#39;).&#38;#39;&#38;lt;/p&#38;gt;&#38;#39;);
	}
	if( !current_user_can( &#38;#39;publish_posts&#38;#39; ) ) {
		die(&#38;#39;&#38;lt;p&#38;gt;&#38;#39;.__(&#38;#39;Error: not allowed to post.&#38;#39;, &#38;#39;p2&#38;#39;).&#38;#39;&#38;lt;/p&#38;gt;&#38;#39;);
	}
	check_ajax_referer( &#38;#39;ajaxnonce&#38;#39;, &#38;#39;_ajax_post&#38;#39; );
	$user_id		= $current_user-&#38;gt;user_id;
	//$post_content	= $_POST[&#38;#39;posttext&#38;#39;];
	$tags			= trim( $_POST[&#38;#39;tags&#38;#39;] );
	$category 		= $_POST[&#38;#39;post_category&#38;#39;];
	$post_title_src 		= $_POST[&#38;#39;post_title&#38;#39;];
	$post_music_src			= $_POST[&#38;#39;meta_value&#38;#39;];

	if ( $tags == __(&#38;#39;Tag it&#38;#39;, &#38;#39;p2&#38;#39;) &#124;&#124; $tags == &#38;#39;Tag it&#38;#39; ) $tags = &#38;#39;&#38;#39;;
	if ( $post_title_src == __(&#38;#39;Artist — Song&#38;#39;, &#38;#39;p2&#38;#39;) &#124;&#124; $tags == &#38;#39;Artist — Song&#38;#39; ) die(&#38;#39;&#38;lt;p&#38;gt;&#38;#39;.__(&#38;#39;Error: You must fill this in.&#38;#39;, &#38;#39;p2&#38;#39;).&#38;#39;&#38;lt;/p&#38;gt;&#38;#39;);
	if ( $post_music_src == __(&#38;#39;http://someplace.com/endingwith.mp3&#38;#39;, &#38;#39;p2&#38;#39;) &#124;&#124; $tags == &#38;#39;http://someplace.com/endingwith.mp3&#38;#39; ) die(&#38;#39;&#38;lt;p&#38;gt;&#38;#39;.__(&#38;#39;Error: You must fill this in.&#38;#39;, &#38;#39;p2&#38;#39;).&#38;#39;&#38;lt;/p&#38;gt;&#38;#39;);

    $post_title = prologue_title_from_content( $post_content );

	$post_id = wp_insert_post( array(
		&#38;#39;post_author&#38;#39;	=&#38;gt; $user_id,
		&#38;#39;post_title&#38;#39;	=&#38;gt; $post_title_src,
		//&#38;#39;music_src&#38;#39;		=&#38;gt; $post_music_src,
		//&#38;#39;post_content&#38;#39;	=&#38;gt; $post_content,
		&#38;#39;post_category&#38;#39; =&#38;gt; array($category),
		&#38;#39;tags_input&#38;#39;	=&#38;gt; $tags,
		&#38;#39;post_status&#38;#39;	=&#38;gt; &#38;#39;publish&#38;#39;
	) );

	add_post_meta($post_id, &#38;#39;music_src&#38;#39;, $post_music_src);

	echo $post_id? $post_id : &#38;#39;0&#38;#39;;
	exit;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;These are the relevant bits from the files. Hope that helps
&#60;/p&#62;</description>
</item>
<item>
<title>jpelker on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1111282</link>
<pubDate>Sat, 20 Jun 2009 22:06:11 +0000</pubDate>
<dc:creator>jpelker</dc:creator>
<guid isPermaLink="false">1111282@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I'd like to see this in action, but your site requires a login to post a reply. Could you post a screenshot of what the reply field looks like? In fact, I'm working on a site that could &#60;code&#62;really&#60;/code&#62; use this feature. Hopefully, you'll share more info!
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1089226</link>
<pubDate>Tue, 02 Jun 2009 00:23:44 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1089226@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Transcription of a little visual I made when I realized what I was doing wrong&#60;br /&#62;
&#60;a href=&#34;http://www.flickr.com/photos/jonobr1/3586725313/&#34;&#62;http://www.flickr.com/photos/jonobr1/3586725313/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;What I didn’t get was the order of operations. In hindsight this is a no-brainer which is why no one probably commented. Nonetheless this is paramount to getting this script to run properly. There are two things that I ran into that were troublesome—&#60;/p&#62;
&#60;p&#62;1. p2.js handles the form. So it comes BEFORE functions.php handles the information. The pixy dust that is JSON turns your variables in p2.js into $_POST[] item that is retrievable in functions.php&#60;/p&#62;
&#60;p&#62;2. The meta data is on entirely different TABLE, meaning that when you edit functions.php you can use the same function wp_insert_post() you need to have a separate function add_post_meta() —this seems like something the wordpress team should address, but whatever. It’s known now so I guess I can deal with it.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;var args = {action: ‘prologue_new_post’, _ajax_post:nonce, post_title: post_title_src, meta_value: post_music_src};	//line 176&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;meta_value is your key, which means that is what your $_POST[‘key‘] variable is looking for in functions.php!!!&#60;br /&#62;
post_music_src is your javascript variable which holds the text data from your Form in post_form.php!!!&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$post_id = wp_insert_post( array(
		‘post_author’		=&#38;gt; $user_id,
		‘post_title’		=&#38;gt; $post_title_src,
		‘post_status’		=&#38;gt; ‘publish’
	) );								// line 544
	add_post_meta($post_id, ‘music_src’, $post_music_src);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;functions.php works the same way. the pink are your keys and the blue are your values.&#60;br /&#62;
The big difference is that add_post_meta is on a separate table and it takes 3 arguments—&#60;br /&#62;
1. the id to which the meta is attached 2. the key or the name for the type of meta data + 3. the value or data that the key contains.&#60;/p&#62;
&#60;p&#62;Soon to be up— &#60;a href=&#34;http://glitzypoppyhooray.com/&#34; rel=&#34;nofollow&#34;&#62;http://glitzypoppyhooray.com/&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>dwharrington on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1085567</link>
<pubDate>Thu, 28 May 2009 13:20:54 +0000</pubDate>
<dc:creator>dwharrington</dc:creator>
<guid isPermaLink="false">1085567@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hey, I want to know about this too!
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1083298</link>
<pubDate>Tue, 26 May 2009 00:10:28 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1083298@http://wordpress.org/support/</guid>
<description>&#60;p&#62;no JSON or ajax p2-ers out there ???
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1068985</link>
<pubDate>Sat, 09 May 2009 04:13:03 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1068985@http://wordpress.org/support/</guid>
<description>&#60;p&#62;okay, so I understand how the &#60;strong&#62;functions.php&#60;/strong&#62; and &#60;strong&#62;prologue_new_post()&#60;/strong&#62; are working I think. I modified them in the way that i wanted to. I noticed that for the most part the php is working smoothly. I happily switched over to &#60;strong&#62;p2.js&#60;/strong&#62; to see how the &#60;em&#62;ajax&#60;/em&#62; was handling these particular bits of information because when I try to use the &#60;strong&#62;post-form&#60;/strong&#62; I get an &#60;em&#62;error message&#60;/em&#62; that p2 has built in when the result in the &#60;code&#62;$.ajax&#60;/code&#62; comes up &#60;code&#62;0&#60;/code&#62;. I've narrowed it down to the &#60;code&#62;var args&#60;/code&#62;. I just don't understand how this works. I looked it up and it looks to be a &#60;em&#62;JSON&#60;/em&#62; array carrying all the objects needed to post to the databse, but I can't simply drop my variables into this array. How are these &#60;code&#62;JSON objects&#60;/code&#62; made and declared?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, &#38;lt;em&#38;gt;posttext: posttext, tags: tags&#38;lt;/em&#38;gt;};&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I think if I understood this and was able to replace the posttext and tags lik:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var myvar = string from the form;

var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, &#38;lt;em&#38;gt;myObject:myvar&#38;lt;/em&#38;gt;};&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This returns an error. Looking through JSON it seemed like the variable args was the point in the javascript where php was turned into usable javascript data so I tried pulling my form titles as the second object like so:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//—In functions.php
$theTitle = $_POST[&#38;#39;title&#38;#39;];

//—In p2.js
var myVar = string from the form;

var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, &#38;lt;em&#38;gt;myVart:title&#38;lt;/em&#38;gt;};&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I also tried &#60;code&#62;&#38;#39;title&#38;#39;&#60;/code&#62; to see if it were supposed to be a string but still errors. The problem seems to be that the array as a whole and all the individual arguments in the array return &#60;em&#62;undefined&#60;/em&#62;, but I don't really understand that line very well...&#60;/p&#62;
&#60;p&#62;Any clarification on how this array holds its information would be greatly appreciated. Thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1068757</link>
<pubDate>Fri, 08 May 2009 21:16:37 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1068757@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Thanks Noel, I'll be looking into it and keeping you posted on my findings.!
&#60;/p&#62;</description>
</item>
<item>
<title>noel on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1066757</link>
<pubDate>Wed, 06 May 2009 20:50:51 +0000</pubDate>
<dc:creator>noel</dc:creator>
<guid isPermaLink="false">1066757@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Check out functions.php and prologue_new_post() and look for how the xhr/ajax request is being made. That should lead you in the right direction.
&#60;/p&#62;</description>
</item>
<item>
<title>jonobr1 on "p2 Custom Field//Meta Data Insertion"</title>
<link>http://wordpress.org/support/topic/267583#post-1063965</link>
<pubDate>Mon, 04 May 2009 03:37:06 +0000</pubDate>
<dc:creator>jonobr1</dc:creator>
<guid isPermaLink="false">1063965@http://wordpress.org/support/</guid>
<description>&#60;p&#62;&#60;em&#62;This post is similar to &#60;a href=&#34;http://wordpress.org/support/topic/263354?replies=2&#34;&#62;this post&#60;/a&#62; which has yet to be resolved as well.&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;So I've been messing around with the theme p2. Frankly, its awesome. I can't live without it...haha. I've been looking around for a few days now how to resolve this problem but I'm not entirely how to approach this.&#60;/p&#62;
&#60;p&#62;In &#60;strong&#62;post-form.php&#60;/strong&#62; I'd like to &#60;strong&#62;add&#60;/strong&#62; a &#60;strong&#62;field&#60;/strong&#62; that refers directly to the custom field music_src I've setup within the Wordpress administration posts. I've looked through the codex and there are only functions to return the meta data, i.e. g&#60;code&#62;et_post_meta($ID, $key )&#60;/code&#62; nothing similar to writing like &#60;code&#62;post_meta( $key, &#38;#39;value&#38;#39; )&#60;/code&#62;. I'd write a function myself that would write to the database, but I'd rather try to work with how p2 is inherently setup because I don't fully understand how the jquery/ajax handles the information from post-form.php&#60;/p&#62;
&#60;p&#62;It seems to be the method at function newPost() in p2.js but I don't understand how the arguments are written and how that translates into an insertion into the database. Particularly:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var tags = $(&#38;#39;#tags&#38;#39;).val();
		if (tags == p2txt.tagit) tags = &#38;#39;&#38;#39;;
		var args = {action: &#38;#39;prologue_new_post&#38;#39;, _ajax_post:nonce, posttext: posttext, tags: tags};
		var errorMessage = &#38;#39;&#38;#39;;
		$.ajax({
			type: &#38;quot;POST&#38;quot;,
			url: ajaxUrl,
			data: args,
			success: function(result) {
				if (&#38;quot;0&#38;quot; == result)
					errorMessage = p2txt.not_posted_error;

				$(&#38;#39;#posttext&#38;#39;).val(&#38;#39;&#38;#39;);
				$(&#38;#39;#tags&#38;#39;).val(p2txt.tagit);
				if(errorMessage != &#38;#39;&#38;#39;)
					newNotification(errorMessage);

				if ($.suggest)
					$(&#38;#39;ul.ac_results&#38;#39;).css(&#38;#39;display&#38;#39;, &#38;#39;none&#38;#39;); // Hide tag suggestion box if displayed

				if (isFirstFrontPage &#38;amp;amp;&#38;amp;amp; result != &#38;quot;0&#38;quot;) {
					getPosts(false);
				} else if (!isFirstFrontPage &#38;amp;amp;&#38;amp;amp; result != &#38;quot;0&#38;quot;) {
					newNotification(p2txt.update_posted);
				}
				submitProgress.fadeOut();
				thisFormElements.attr(&#38;#39;disabled&#38;#39;, false);
				thisFormElements.removeClass(&#38;#39;disabled&#38;#39;);
			  }
		});&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I don't know what &#60;code&#62;unewpos&#60;/code&#62;t is or how &#60;code&#62;var args&#60;/code&#62; works&#60;/p&#62;
&#60;p&#62;Does anyone else have desires to do this, resolutions, issues?
&#60;/p&#62;</description>
</item>

</channel>
</rss>
