vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r11555: LJSUP-11431: Allow partners to post entr...

Committer: vad
LJSUP-11431: Allow partners to post entries to LJ via XML-RPC and specify a corresponding docid (entry id on a partners site)
U   trunk/cgi-bin/LJ/Hooks/SUP.pm
Modified: trunk/cgi-bin/LJ/Hooks/SUP.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/SUP.pm	2012-03-05 09:59:33 UTC (rev 11554)
+++ trunk/cgi-bin/LJ/Hooks/SUP.pm	2012-03-05 11:29:58 UTC (rev 11555)
@@ -934,6 +934,31 @@
 
 });
 
+LJ::register_hook("postpost", sub {
+    my $arg = shift;
+    return undef unless $arg;
+    
+    ## set mapping between the entry and 
+    ## and the partner's docid.
+
+    my $req = $arg->{req};
+    return unless $req;
+
+    my $partner_info = $req->{partner};
+    return unless $partner_info;
+    my $rsk = $partner_info->{rsk};
+    my $docid = $partner_info->{docid};
+    return unless $rsk;
+    return unless $docid;
+
+    my $partner = LJ::PartnerSite->find_by_api_key($rsk);
+    return unless $partner;
+    my $entry = $arg->{entry};
+    return unless $entry;
+    $partner->replace_mapping($entry, $docid);
+
+});
+
 LJ::register_hook("ctxpopup_extra_info", sub {
     my $u = shift;
 

Tags: ljcom, pm, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments