It's really just a total hack - I added elseif statements and hard-coded post types, assigning them to $post_type.<div><br></div><div>I suppose the right thing to do is take the <span class="Apple-style-span" style="font-family: monospace; font-size: 11px; border-collapse: collapse; white-space: pre-wrap; "><a href="http://_variables/content_struct.html" target="_blank" style="color: rgb(136, 34, 34); text-decoration: none; ">$content_struct</a>['post_type'] and test it against registered post types, test for permission, and assign it to the $post_type or return the error.</span><br>
<br></div><div>If I get around to doing that some time soon, I'll send it along.</div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Wed, Jul 7, 2010 at 10:42 PM, Eric Mann <span dir="ltr"><<a href="mailto:eric@eamann.com">eric@eamann.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">David,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Any chance you can post a snippet (better yet a diff) showing
what exactly you changed to support your custom post types? If possible, I’d
like to generalize it and submit a formal patch …</span></p>
<p class="MsoNormal"><a name="129b025f762ead5f__MailEndCompose"><span style="font-size:11.0pt;color:#1F497D"> </span></a></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:wp-xmlrpc-bounces@lists.automattic.com" target="_blank">wp-xmlrpc-bounces@lists.automattic.com</a>
[mailto:<a href="mailto:wp-xmlrpc-bounces@lists.automattic.com" target="_blank">wp-xmlrpc-bounces@lists.automattic.com</a>] <b>On Behalf Of </b>David Weiss<br>
<b>Sent:</b> Wednesday, July 07, 2010 6:07 PM<br>
<b>To:</b> <a href="mailto:wp-xmlrpc@lists.automattic.com" target="_blank">wp-xmlrpc@lists.automattic.com</a><br>
<b>Subject:</b> [wp-xmlrpc] Handling Custom Post Types in WP 3.0 via XMLRPC</span></p>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal">FYI, I wanted to use Custom Post Types and WP 3.0 in a new
blog and manage content via XMLRPC.</p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">XMLRPC.php isn't updated to handle this, it seems.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">mw_NewPost just needs a tweak to get it to work.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div><pre><a name="129b025f762ead5f_l1993"><span><span style="color:#555555">1993</span></span></a> <a href="http://_variables/post_type.html" target="_blank"><span style="color:#882222;text-decoration:none">$post_type</span></a> = 'post';</pre>
<pre><a name="129b025f762ead5f_l1994"><span><span style="color:#555555">1994</span></span></a> <a href="http://_variables/page_template.html" target="_blank"><span style="color:#882222;text-decoration:none">$page_template</span></a> = '';</pre>
<pre><a name="129b025f762ead5f_l1995"><span><span style="color:#555555">1995</span></span></a> if ( !<a href="http://_functions/empty.html" target="_blank"><span style="color:#116611;text-decoration:none">empty</span></a>( <a href="http://_variables/content_struct.html" target="_blank"><span style="color:#882222;text-decoration:none">$content_struct</span></a>['post_type'] ) ) {</pre>
<pre><a name="129b025f762ead5f_l1996"><span><span style="color:#555555">1996</span></span></a> if ( <a href="http://_variables/content_struct.html" target="_blank"><span style="color:#882222;text-decoration:none">$content_struct</span></a>['post_type'] == 'page' ) {</pre>
<pre><a name="129b025f762ead5f_l1997"><span><span style="color:#555555">1997</span></span></a> <a href="http://_variables/cap.html" target="_blank"><span style="color:#882222;text-decoration:none">$cap</span></a> = ( <a href="http://_variables/publish.html" target="_blank"><span style="color:#882222;text-decoration:none">$publish</span></a> ) ? 'publish_pages' : 'edit_pages';</pre>
<pre><a name="129b025f762ead5f_l1998"><span><span style="color:#555555">1998</span></span></a> <a href="http://_variables/error_message.html" target="_blank"><span style="color:#882222;text-decoration:none">$error_message</span></a> = <a href="http://_functions/__.html" target="_blank"><span style="color:#116611;text-decoration:none">__</span></a>( 'Sorry, you are not allowed to publish pages on this site.' );</pre>
<pre><a name="129b025f762ead5f_l1999"><span><span style="color:#555555">1999</span></span></a> <a href="http://_variables/post_type.html" target="_blank"><span style="color:#882222;text-decoration:none">$post_type</span></a> = 'page';</pre>
<pre><a name="129b025f762ead5f_l2000"><span><span style="color:#555555">2000</span></span></a> if ( !<a href="http://_functions/empty.html" target="_blank"><span style="color:#116611;text-decoration:none">empty</span></a>( <a href="http://_variables/content_struct.html" target="_blank"><span style="color:#882222;text-decoration:none">$content_struct</span></a>['wp_page_template'] ) )</pre>
<pre><a name="129b025f762ead5f_l2001"><span><span style="color:#555555">2001</span></span></a> <a href="http://_variables/page_template.html" target="_blank"><span style="color:#882222;text-decoration:none">$page_template</span></a> = <a href="http://_variables/content_struct.html" target="_blank"><span style="color:#882222;text-decoration:none">$content_struct</span></a>['wp_page_template'];</pre>
<pre><a name="129b025f762ead5f_l2002"><span><span style="color:#555555">2002</span></span></a> } elseif ( <a href="http://_variables/content_struct.html" target="_blank"><span style="color:#882222;text-decoration:none">$content_struct</span></a>['post_type'] == 'post' ) {</pre>
<pre><a name="129b025f762ead5f_l2003"><span><span style="color:#555555">2003</span></span></a> <span><i><span style="color:#444444"> // This is the default, no changes needed</span></i></span></pre><pre><a name="129b025f762ead5f_l2004"><span><span style="color:#555555">2004</span></span></a> } else {</pre>
<pre><a name="129b025f762ead5f_l2005"><span><span style="color:#555555">2005</span></span></a> <span><i><span style="color:#444444"> // No other post_type values are allowed here</span></i></span></pre><pre>
<a name="129b025f762ead5f_l2006"><span><span style="color:#555555">2006</span></span></a> return <span><b>new </b></span><a href="http://_classes/ixr_error.html" target="_blank"><span style="color:#2222FF;text-decoration:none">IXR_Error</span></a>( 401, <a href="http://_functions/__.html" target="_blank"><span style="color:#116611;text-decoration:none">__</span></a>( 'Invalid post type.' ) );</pre>
<pre><a name="129b025f762ead5f_l2007"><span><span style="color:#555555">2007</span></span></a> }</pre><pre><a name="129b025f762ead5f_l2008"><span><span style="color:#555555">2008</span></span></a> }</pre>
<pre> </pre><pre>I just edited up the if/elseif/else to take into account my custom post type names, and set the post_type key/value to the appropriate post type in my client.</pre><pre>Works fine so far.</pre></div>
</div></div></div>
</div>
<br>_______________________________________________<br>
wp-xmlrpc mailing list<br>
<a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
<a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc" target="_blank">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
<br></blockquote></div><br></div>