livejournal plugin modifications

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
nyquil

livejournal plugin modifications

Post 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
nyquil

bad wrapping

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: livejournal plugin modifications

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
nyquil

Post 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
Post Reply