Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
319 views
in Q2A Core by
edited by

It would be nice to show the user some "options" he has, directly after he posted a question.

E.g. "share this question now!" as a button below the question or options within an overlaying div.

How can I achieve this? :)

by
edited by
This might help somehow: http://www.question2answer.org/qa/15565/how-to-check-on-question-view-page-if-post-is-by-logged-in-user

+ qa-app-format, see from line 223:
//    Useful stuff used throughout function

$postid=$post['postid'];
$isquestion=($post['basetype']=='Q');
$isanswer=($post['basetype']=='A');
$isbyuser=qa_post_is_by_user($post, $userid, $cookieid);
$anchor=urlencode(qa_anchor($post['basetype'], $postid));
$elementid=isset($options['elementid']) ? $options['elementid'] : $anchor;
$microformats=@$options['microformats'];
$isselected=@$options['isselected'];

1 Answer

0 votes
by
edited by

got it!

if you can rely only on cookies, you can use that:

// works for anonymous
$cookieid_poster = $this->content['q_view']['raw']['cookieid'];
$cookieid_user = qa_cookie_get();

// works for logged in users
$useridReader = qa_get_logged_in_userid();
$useridPoster = $this->content['q_view']['raw']['userid'];

if( ( $cookieid_poster == $cookieid_user ) || ($useridReader == $useridPoster) ) {
   ...
}

 

...