Skip to content

Commit d5eccde

Browse files
committed
Fixed logged in user fetching code
1 parent 122be79 commit d5eccde

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

easyblog/easyblog/comments.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ public function get() {
5858
}
5959

6060
public function post() {
61-
{
62-
$app = JFactory::getApplication();
63-
$my = JFactory::getUser();
64-
$config = EasyBlogHelper::getConfig();
65-
$acl = EasyBlogACLHelper::getRuleSet();
61+
$app = JFactory::getApplication();
62+
$my = $this->plugin->getUser();
63+
$config = EasyBlogHelper::getConfig();
64+
$acl = EasyBlogACLHelper::getRuleSet();
6665
$post = $app->input->post->getArray();
6766

6867
if( empty($acl->rules->allow_comment) && (empty($my->id) && !$config->get('main_allowguestcomment')) )
@@ -235,10 +234,28 @@ public function post() {
235234

236235
//update the sent flag to sent
237236
$comment->updateSent();
237+
238+
// @TODO - Move this to a map comment function
239+
$item = new CommentSimpleSchema;
240+
$item->commentid = $comment->id;
241+
$item->postid = $comment->post_id;
242+
$item->title = $comment->title;
243+
$item->text = EasyBlogCommentHelper::parseBBCode($comment->comment);
244+
$item->textplain = strip_tags(EasyBlogCommentHelper::parseBBCode($comment->comment));
245+
$item->created_date = $comment->created;
246+
$item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime( $comment->created );
247+
$item->updated_date = $comment->modified;
238248

239-
$this->plugin->setResponse( $comment );
249+
// Author
250+
$item->author->name = isset($comment->poster->nickname) ? $comment->poster->nickname : $comment->name;
251+
$item->author->photo = isset($comment->poster->avatar) ? $comment->poster->avatar : 'default_blogger.png';
252+
$item->author->photo = JURI::root() . 'components/com_easyblog/assets/images/' . $item->author->photo;
253+
$item->author->email = $comment->email;
254+
$item->author->website = isset($comment->poster->url) ? $comment->poster->url : $comment->url;
255+
256+
$this->plugin->setResponse( $item );
240257

241-
}}
258+
}
242259

243260
public static function getName() {
244261

0 commit comments

Comments
 (0)