Skip to content

Commit

Permalink
Fixed logged in user fetching code
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbung committed Nov 5, 2014
1 parent 122be79 commit d5eccde
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions easyblog/easyblog/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ public function get() {
}

public function post() {
{
$app = JFactory::getApplication();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
$acl = EasyBlogACLHelper::getRuleSet();
$app = JFactory::getApplication();
$my = $this->plugin->getUser();
$config = EasyBlogHelper::getConfig();
$acl = EasyBlogACLHelper::getRuleSet();
$post = $app->input->post->getArray();

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

//update the sent flag to sent
$comment->updateSent();

// @TODO - Move this to a map comment function
$item = new CommentSimpleSchema;
$item->commentid = $comment->id;
$item->postid = $comment->post_id;
$item->title = $comment->title;
$item->text = EasyBlogCommentHelper::parseBBCode($comment->comment);
$item->textplain = strip_tags(EasyBlogCommentHelper::parseBBCode($comment->comment));
$item->created_date = $comment->created;
$item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime( $comment->created );
$item->updated_date = $comment->modified;

$this->plugin->setResponse( $comment );
// Author
$item->author->name = isset($comment->poster->nickname) ? $comment->poster->nickname : $comment->name;
$item->author->photo = isset($comment->poster->avatar) ? $comment->poster->avatar : 'default_blogger.png';
$item->author->photo = JURI::root() . 'components/com_easyblog/assets/images/' . $item->author->photo;
$item->author->email = $comment->email;
$item->author->website = isset($comment->poster->url) ? $comment->poster->url : $comment->url;

$this->plugin->setResponse( $item );

}}
}

public static function getName() {

Expand Down

0 comments on commit d5eccde

Please sign in to comment.