livejournal plugin modifications
Posted: Thu Apr 14, 2005 6:42 am
I made a couple changes to the livejournal plugin the other night. First off I added a checkbox to disable comments on the livejournal post. Then I made a new comments link that gets inserted at the end of the entry so that people viewing on livejournal can comment and have all the comments local to here.
It was pretty tricky to get the direct link to that posts comments working, and I'm sure theres a much better way. This was all I managed to figure out though.
heres what I did (this chunk goes right after the line that 'Makes all entries not doublespaced'):
//insert hard link to local post
$badChars = array("?","!","#","&","@","#","$","%","^","*","(",")");
$staticTitle = str_replace(" ","-",$serendipity['POST']['title']);
$staticTitle = str_replace($badChars,"",$staticTitle);
$commentlink = $serendipity['baseURL']."index.php?/archives/".$serendipity['lastSavedEntry']."-".$staticTitle.".html";
$event = $event."\n<table valign=bottom align=right><tr><td><ahref='".$commentlink."#comments'>post/read comments</a></td></tr></table>";
to the $props declarations I added:
$props['opt_nocomments'] = new XML_RPC_Value($serendipity['POST']['ljcomment'],'string');
and then in the UI section I added:
<input type="checkbox" name="serendipity[ljcomment]" value="1" checked> Disable Comments
to add a checkbox to determine whether or not to turn them on or off.
I would really appreciate it if someone who knows a heck of a lot more than me would make this a bit less hacky, I'm not sure if it will work with custom archive links or not.
thanks,
jer
It was pretty tricky to get the direct link to that posts comments working, and I'm sure theres a much better way. This was all I managed to figure out though.
heres what I did (this chunk goes right after the line that 'Makes all entries not doublespaced'):
//insert hard link to local post
$badChars = array("?","!","#","&","@","#","$","%","^","*","(",")");
$staticTitle = str_replace(" ","-",$serendipity['POST']['title']);
$staticTitle = str_replace($badChars,"",$staticTitle);
$commentlink = $serendipity['baseURL']."index.php?/archives/".$serendipity['lastSavedEntry']."-".$staticTitle.".html";
$event = $event."\n<table valign=bottom align=right><tr><td><ahref='".$commentlink."#comments'>post/read comments</a></td></tr></table>";
to the $props declarations I added:
$props['opt_nocomments'] = new XML_RPC_Value($serendipity['POST']['ljcomment'],'string');
and then in the UI section I added:
<input type="checkbox" name="serendipity[ljcomment]" value="1" checked> Disable Comments
to add a checkbox to determine whether or not to turn them on or off.
I would really appreciate it if someone who knows a heck of a lot more than me would make this a bit less hacky, I'm not sure if it will work with custom archive links or not.
thanks,
jer