Page 1 of 1

livejournal plugin modifications

Posted: Thu Apr 14, 2005 6:42 am
by nyquil
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

bad wrapping

Posted: Thu Apr 14, 2005 6:44 am
by nyquil
Its pretty tough using this little text box to input long strings, so there are some places where it wrapped badly. I'm sure its decipherable where a space needs to be added to make it work properly, but it does actually work.

Re: livejournal plugin modifications

Posted: Thu Apr 14, 2005 12:36 pm
by garvinhicking
nyquil,

thanks a lot for your help improving Serendipity! (Also thanks for the other support issues you commented on in the blog, I much appreciate your feedback).

I implemented your patches into the additional plugin and committed them; they should be available on SF.Net within the next 24 hours. I polished up the code a bit and hope it properly works - i don'T have ALiveJournal, so I couldn'T test it. :)

Regards,
Garvin

Posted: Mon Apr 18, 2005 12:01 am
by nyquil
It does indeed work. One thing though, the align=right doesnt seem to work on livejournal, i think they might parse that out. Thats why I put it in its own table so I could align it over to the right - where livejournals native comment links are. Kinda ugly, but I don't know what else to do