diff options
author | friendica <info@friendica.com> | 2013-11-27 20:56:08 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-11-27 20:56:08 -0800 |
commit | 21e465e48ae918b75d011d0fc5de1864bb474edc (patch) | |
tree | feff755dbf55dd9d994415b7023de7aa5ba4d6c1 /util | |
parent | b67347d9a03f92738eaa6b6de3f2b526f35d99d0 (diff) | |
download | volse-hubzilla-21e465e48ae918b75d011d0fc5de1864bb474edc.tar.gz volse-hubzilla-21e465e48ae918b75d011d0fc5de1864bb474edc.tar.bz2 volse-hubzilla-21e465e48ae918b75d011d0fc5de1864bb474edc.zip |
add photos to red-to-wordpress comments
Diffstat (limited to 'util')
-rw-r--r-- | util/wp/post_to_red/post_to_red.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/util/wp/post_to_red/post_to_red.php b/util/wp/post_to_red/post_to_red.php index 7fbf1eb76..71ae88aa8 100644 --- a/util/wp/post_to_red/post_to_red.php +++ b/util/wp/post_to_red/post_to_red.php @@ -261,6 +261,8 @@ add_action('before_delete_post', 'post_to_red_delete_post'); add_filter('xmlrpc_methods', 'red_xmlrpc_methods'); +add_filter('get_avatar', 'post_to_red_get_avatar',10,5); + function red_xmlrpc_methods($methods) { $methods['red.Comment'] = 'red_comment'; @@ -333,11 +335,29 @@ function red_comment($args) { wp_set_comment_status($comment_ID,'approve'); } + if(isset($content_struct['red_avatar'])) + add_comment_meta($comment_ID,'red_avatar',$content_struct['red_avatar'],true); + do_action( 'xmlrpc_call_success_red_Comment', $comment_ID, $args ); return $comment_ID; } +function post_to_red_get_avatar($avatar,$id_or_email,$size,$default,$alt) { + + if(! is_object($id_or_email)) + return $avatar; + if((! array_key_exists('comment_author_email',$id_or_email)) || (empty($id_or_email->comment_author_email))) + return $avatar; + if((! array_key_exists('comment_ID', $id_or_email)) || (! intval($id_or_email->comment_ID))) + return $avatar; + $l = get_comment_meta($id_or_email->comment_ID,'red_avatar',true); + if($l) { + $safe_alt = esc_attr($alt); + $avatar = "<img alt='{$safe_alt}' src='{$l}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />"; + } + return $avatar; +} // from: |