[TxMt] Wordpress 2.2 and Pings/Comments
Pavan Gunupudi
pavan at doe.carleton.ca
Wed Jun 13 21:51:49 UTC 2007
>
> Btw: have a look at both NewPost and EditPost -- it seems NewPost
> sets comment_status to open/closed where EditPost sets it to the
> value of mt_allow_comments casted to an int. When using
> comment_status, it is tested against the string value 'open'. So
> regardless of value sent (for mt_allow_comments) it will always
> disable comments when editing a post.
>
>
>
>
As a temporary fix until this is resolved officially,
Removing the (int) cast in
if(isset($content_struct["mt_allow_comments"])) {
$comment_status = (int) $content_struct["mt_allow_comments"];
}
solved the issue of comments.
Adding
if(isset($content_struct["mt_allow_pings"])) {
$ping_status = $content_struct["mt_allow_pings"];
}
just below the above block seems to solve the issue with pings.
This will take care of editing posts.
For taking care of new posts, replace
if(isset($content_struct["mt_allow_comments"])) {
switch((int) $content_struct["mt_allow_comments"]) {
case 0:
$comment_status = "closed";
break;
case 1:
$comment_status = "open";
break;
default:
$comment_status = get_option("default_comment_status");
break;
}
}
if(isset($content_struct["mt_allow_pings"])) {
switch((int) $content_struct["mt_allow_pings"]) {
case 0:
$ping_status = "closed";
break;
case 1:
$ping_status = "open";
break;
default:
$ping_status = get_option("default_ping_status");
break;
}
}
with
if(isset($content_struct["mt_allow_comments"])) {
$comment_status = $content_struct
["mt_allow_comments"];
}
if(isset($content_struct["mt_allow_pings"])) {
$ping_status = $content_struct
["mt_allow_pings"];
}
Seems to work okay for me. Could break things for you. Use it at your
own risk!! :)
The working file can be accessed at
http://www.doe.carleton.ca/~pavan/blog/xmlrpc.txt
Just rename it from .txt to .php and give it a shot.
Pavan
More information about the textmate
mailing list