Skip to content

Instantly share code, notes, and snippets.


Q2A Market q2amarket

View GitHub Profile
q2amarket / q2am-block-category.php
Last active Jan 2, 2016
Override main() function to display question view page content only for looged in user for defined category. If condition fails than we will throw error message and provide login link to user for better usability.
View q2am-block-category.php
* Q2A Market Block Category Content for Loggedin user
* @author Q2A Market
* @category Hook
* @Version: 1.00
* @author URL:
q2amarket / q2am-question-excerpt.php
Last active Jul 26, 2018
Question2Answer: Get excerpt of the question to display on the question list. Make sure your q2a function should get post id in array otherwise this code won't work.
View q2am-question-excerpt.php
$pid = $q_item['raw']['postid'];
$query = qa_db_query_sub("SELECT postid, content, format FROM ^posts WHERE postid = $pid");
$cont = qa_db_read_one_assoc($query);
$blockwordspreg = qa_get_block_words_preg();
$text=qa_viewer_text($cont['content'], $cont['format'], array('blockwordspreg' => $blockwordspreg));
$text=qa_shorten_string_line(qa_html($text), 200); //200 is the length