<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Question2Answer Q&amp;A - Recent questions tagged functions</title>
<link>https://www.question2answer.org/qa/tag/functions</link>
<description>Powered by Question2Answer</description>
<item>
<title>Need help with a function - Urgent</title>
<link>https://www.question2answer.org/qa/103158/need-help-with-a-function-urgent</link>
<description>

&lt;p&gt;In the file qa-include/util/string.php there is this function:&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;function qa_string_to_words($string, $tolowercase = true, $delimiters = false, $splitideographs = true, $splithyphens = true)
&lt;br&gt;{
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;global $qa_utf8punctuation;
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ($tolowercase)
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $string = qa_strtolower($string);
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$string = strtr($string, $qa_utf8punctuation);
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$separator = QA_PREG_INDEX_WORD_SEPARATOR;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ($splithyphens)
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $separator .= '|\-';
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ($delimiters) {
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($splitideographs)
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $separator .= '|' . QA_PREG_CJK_IDEOGRAPHS_UTF8;
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else {
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $string = preg_replace(&quot;/(\S)'(\S)/&quot;, '\1\2', $string); // remove apostrophes in words
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($splitideographs) // put spaces around CJK ideographs so they're treated as separate words
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $string = preg_replace('/' . QA_PREG_CJK_IDEOGRAPHS_UTF8 . '/', ' \0 ', $string);
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return preg_split('/(' . $separator . '+)/', $string, -1, PREG_SPLIT_NO_EMPTY | ($delimiters ? PREG_SPLIT_DELIM_CAPTURE : 0));
&lt;br&gt;}&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&amp;nbsp;How can i create a new function for letters/characters instead of words. I want a new function like:&amp;nbsp;&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;
&lt;br&gt;&lt;strong&gt;function qa_string_to_letters&lt;/strong&gt;($string, $tolowercase = true, $delimiters = false, $splitideographs = true, $splithyphens = true)
&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I hope that someone of the developer like &lt;strong&gt;Puppi, Scott&lt;/strong&gt; or anyone else could help me with this. Thanks everybody.&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/103158/need-help-with-a-function-urgent</guid>
<pubDate>Sat, 27 Aug 2022 14:38:36 +0000</pubDate>
</item>
<item>
<title>How I can get all Q&amp;A's functions list?</title>
<link>https://www.question2answer.org/qa/53643/how-i-can-get-all-q%26as-functions-list</link>
<description>Hello everyone. &lt;br /&gt;
I want to develop my Q&amp;amp;A site and I need the list of all functions that used in the Q&amp;amp;A and there descriptions.&lt;br /&gt;
Anyone can help me, where I can get it?&lt;br /&gt;
Thanks a lot.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/53643/how-i-can-get-all-q%26as-functions-list</guid>
<pubDate>Mon, 05 Sep 2016 13:36:10 +0000</pubDate>
</item>
<item>
<title>How can i check if i am viewing my own profile or another user's profile ????</title>
<link>https://www.question2answer.org/qa/51985/how-can-check-if-am-viewing-own-profile-another-users-profile</link>
<description>Ok i think that i am very closed to find a solution for that but i cant figure it out how :(&lt;br /&gt;
What i want to do is to add a simple link at user's profile page that will be only visible to the owners of that page.&lt;br /&gt;
&lt;br /&gt;
I already overrided the function profile_page and i can display what i want to the profile page but i cant find what is the functions that checks if the logged in user is the owner of profile page or not&lt;br /&gt;
&lt;br /&gt;
To be more detailed i need a function to do something like that :&lt;br /&gt;
&lt;br /&gt;
If &amp;nbsp;(the_logged_in_user_is_the_owner_of_the_profile) {&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;LINK GOES HERE&amp;lt;/a&amp;gt; //Display the link&lt;br /&gt;
&lt;br /&gt;
}</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/51985/how-can-check-if-am-viewing-own-profile-another-users-profile</guid>
<pubDate>Fri, 03 Jun 2016 08:32:42 +0000</pubDate>
</item>
<item>
<title>How can i reposition a field of the user page ?</title>
<link>https://www.question2answer.org/qa/51979/how-can-i-reposition-a-field-of-the-user-page</link>
<description>Hi. In the profile user page i would like to reposition the &amp;quot;Website Field&amp;quot; and the &amp;quot;Send Message Button&amp;quot; &amp;nbsp;to the top of the page. How can i add do that ??&lt;br /&gt;
Can someone expert developer give me an example?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/51979/how-can-i-reposition-a-field-of-the-user-page</guid>
<pubDate>Thu, 02 Jun 2016 18:55:23 +0000</pubDate>
</item>
<item>
<title>qa_db_user_set() exists but qa_db_user_get() not yet</title>
<link>https://www.question2answer.org/qa/51211/qa_db_user_set-exists-but-qa_db_user_get-not-yet</link>
<description>Wished we could have this core function:&lt;br /&gt;
&lt;br /&gt;
qa_db_user_get($userid, $field)&lt;br /&gt;
&lt;br /&gt;
Would make it easier in some cases. I don't need always all the userdata like in qa_db_user_account_selectspec($userid, true)</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/51211/qa_db_user_set-exists-but-qa_db_user_get-not-yet</guid>
<pubDate>Thu, 07 Apr 2016 08:10:46 +0000</pubDate>
</item>
<item>
<title>Missing core function: qa_db_user_profile_get($userid, $field)</title>
<link>https://www.question2answer.org/qa/50965/missing-function-qa_db_user_profile_get-%24userid-%24field</link>
<description>I got really used to function qa_db_usermeta_get() and thought the same would exist for the userprofile fields. However, it does not yet.&lt;br /&gt;
&lt;br /&gt;
@Scott: Please consider adding:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// CUSTOM function added&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function qa_db_user_profile_get($userid, $field)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return qa_db_read_one_value(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qa_db_query_sub(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'SELECT content FROM ^userprofile&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE `userid` = #&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AND `title` = #',&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$userid, $field),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;true);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
Thanks.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/50965/missing-function-qa_db_user_profile_get-%24userid-%24field</guid>
<pubDate>Mon, 21 Mar 2016 08:31:09 +0000</pubDate>
</item>
<item>
<title>qa_db_query_sub with IN(#) not working?</title>
<link>https://www.question2answer.org/qa/50825/qa_db_query_sub-with-in-%23-not-working</link>
<description>

&lt;p&gt;When executing a query with IN(#)&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $eventsconsidered = '&quot;student_reserved&quot;, &quot;student_paid&quot;, &quot;tutor_accepted&quot;'';&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $eventlogs = qa_db_read_all_assoc(
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;qa_db_query_sub('SELECT datetime, userid, eventid, eventname, params
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;FROM `^booking_log`
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;WHERE eventid = #
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AND eventname &lt;span style=&quot;color:#FF0000&quot;&gt;IN(#)&lt;/span&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;', $eventid, $eventsconsidered)
&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;);&lt;/p&gt;

&lt;p&gt;it does not work.&lt;/p&gt;

&lt;p&gt;When putting the string directly instead of the &quot;#&quot; it works.&lt;/p&gt;

&lt;p&gt;What do I have to pass then?&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/50825/qa_db_query_sub-with-in-%23-not-working</guid>
<pubDate>Fri, 11 Mar 2016 01:20:15 +0000</pubDate>
</item>
<item>
<title>Add qa_update_blob() to core functions</title>
<link>https://www.question2answer.org/qa/50056/add-qa_update_blob-to-core-functions</link>
<description>I came across the situation that I am editing an image (a blob) that is already stored on the server (file system or db) and need to update the content of the blob (file system or db).&lt;br /&gt;
&lt;br /&gt;
For the DB I was using:&lt;br /&gt;
&lt;br /&gt;
qa_db_blob_set_content($blobid, $content)&lt;br /&gt;
&lt;br /&gt;
However, for the file system there does not seem to be such an update function (?)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
PS: qa_write_blob_file() gives me &amp;quot;failed to open stream: File exists&amp;quot;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/50056/add-qa_update_blob-to-core-functions</guid>
<pubDate>Sat, 30 Jan 2016 18:01:01 +0000</pubDate>
</item>
<item>
<title>Add qa_db_blob_size to core functions</title>
<link>https://www.question2answer.org/qa/50055/add-qa_db_blob_size-to-core-functions</link>
<description>

&lt;p&gt;Just saw that v1.7.2 has no way to determine a size of a blob.
&lt;br&gt;
&lt;br&gt;If the blob content is saved in the database it would be:&lt;/p&gt;

&lt;pre&gt;&lt;span style=&quot;font-size:12px&quot;&gt;// get size of image
$blobsize = qa_db_read_one_value(
    qa_db_query_sub('SELECT OCTET_LENGTH(content) FROM `^blobs`
                        WHERE blobid=# LIMIT 1', $blobrow['blobid']),
    true);&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;If the blob content is NULL and the file system is used it would be:&lt;/p&gt;

&lt;pre&gt;&lt;span style=&quot;font-size:12px&quot;&gt;if(empty($blobsize))
{
    $blobsize = filesize( qa_get_blob_filename($blobrow['blobid'], $blobrow['format']) );
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
&lt;br&gt;Hope that helps.
&lt;br&gt;
&lt;br&gt;Thx,
&lt;br&gt;Kai&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/50055/add-qa_db_blob_size-to-core-functions</guid>
<pubDate>Sat, 30 Jan 2016 17:27:58 +0000</pubDate>
</item>
<item>
<title>How to include qa-db.php functions in a new php file?</title>
<link>https://www.question2answer.org/qa/46294/how-to-include-qa-db-php-functions-in-a-new-php-file</link>
<description>I created a php file. What should i do to be able to use qa_db_query_sub() there?&lt;br /&gt;
&lt;br /&gt;
I tried with include, require_once but for some reason it doesn't work</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/46294/how-to-include-qa-db-php-functions-in-a-new-php-file</guid>
<pubDate>Tue, 07 Jul 2015 04:20:31 +0000</pubDate>
</item>
<item>
<title>How to move &quot;unanswered&quot; tab to be listed as a sub-category of &quot;questions&quot;.</title>
<link>https://www.question2answer.org/qa/42738/how-to-move-unanswered-tab-to-listed-sub-category-questions</link>
<description>How would I move &amp;quot;unanswered&amp;quot; tab to be listed as a sub-category of &amp;quot;questions&amp;quot;. &amp;nbsp;So unanswered would be along side &amp;quot;recent&amp;quot; &amp;quot;hot questions&amp;quot; etc. &amp;nbsp;Also, how to move make the &amp;quot;questions&amp;quot; tab and &amp;quot;q&amp;amp;a&amp;quot; tab switch spots? &amp;nbsp;Some type of function overriding I'm thinking? &amp;nbsp;Thanks.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/42738/how-to-move-unanswered-tab-to-listed-sub-category-questions</guid>
<pubDate>Wed, 07 Jan 2015 13:52:55 +0000</pubDate>
</item>
<item>
<title>Understanding qa_page_q_post_rules_base() - where is it defined?</title>
<link>https://www.question2answer.org/qa/41274/understanding-qa_page_q_post_rules_base-where-defined</link>
<description>

&lt;p&gt;
	I stumbled again over a question from 2012: &lt;a href=&quot;http://www.question2answer.org/qa/19535/event-module-not-listening&quot; rel=&quot;nofollow&quot;&gt;http://www.question2answer.org/qa/19535/event-module-not-listening&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;
	Gidgreen mentioned the override of qa_page_q_post_rules(), and that we should also call &lt;strong&gt;qa_page_q_post_rules_base()&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;
	I have found a plugin of NoahY that does this: &lt;a href=&quot;https://github.com/NoahY/q2a-expert-questions/blob/master/qa-expert-overrides.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/NoahY/q2a-expert-questions/blob/master/qa-expert-overrides.php&lt;/a&gt; - also with other functions.&lt;/p&gt;


&lt;p&gt;
	As I could not find any specified function for qa_page_q_post_rules_base() I assume that you can override all functions by adding _base.&lt;/p&gt;


&lt;p&gt;
	BREAK&lt;/p&gt;


&lt;p&gt;
	ouch ... myself ... RTFM: &lt;a href=&quot;http://www.question2answer.org/overrides.php&quot; rel=&quot;nofollow&quot;&gt;http://www.question2answer.org/overrides.php&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;
	...&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/41274/understanding-qa_page_q_post_rules_base-where-defined</guid>
<pubDate>Sun, 16 Nov 2014 09:32:27 +0000</pubDate>
</item>
<item>
<title>How to put variable or function inside $this-&gt;output or html??</title>
<link>https://www.question2answer.org/qa/27445/how-to-put-variable-or-function-inside-%24this-output-or-html</link>
<description>

&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;div&gt;
	

&lt;div&gt;
		I am thinking this is probably a syntax error?. &amp;nbsp;Basically all I want to do is put the search bar inside another div that is inside the login-bar div.&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		This is shortened version of the code&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		

&lt;blockquote&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;function body_header()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;$this-&amp;gt;output('&amp;lt;div id=&quot;qa-login-bar&quot;&amp;gt;&amp;lt;div id=&quot;qa-login-group&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;$this-&amp;gt;output ('&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$this-&amp;gt;search();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ');&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&amp;nbsp;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp;$this-&amp;gt;output('&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;');&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
			

&lt;div&gt;
				&lt;span style=&quot;color:#008080;&quot;&gt;&lt;span style=&quot;font-size:14px;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
		&lt;/blockquote&gt;
	&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	When I do this, I get a blank page. &amp;nbsp;Any suggestions of what I'm doing wrong? t/y&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/27445/how-to-put-variable-or-function-inside-%24this-output-or-html</guid>
<pubDate>Tue, 10 Sep 2013 05:25:07 +0000</pubDate>
</item>
<item>
<title>How to override functions</title>
<link>https://www.question2answer.org/qa/22234/how-to-override-functions</link>
<description>

&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;blockquote&gt;
	

&lt;p&gt;
		&amp;nbsp;&lt;/p&gt;
	

&lt;pre style=&quot;color: rgb(0, 119, 0); font-size: 14px; line-height: 21px;&quot;&gt;
So just to test it out, from here&amp;nbsp;&lt;span style=&quot;font-family: Arial, Verdana, sans-serif;&quot;&gt;http://www.question2answer.org/themes.php#theme 

I &lt;/span&gt;&lt;span style=&quot;font-family: Arial, Verdana, sans-serif;&quot;&gt;copy and pasted the example code to override functions...&lt;/span&gt;&lt;/pre&gt;
	

&lt;pre style=&quot;color: rgb(0, 119, 0); font-size: 14px; line-height: 21px;&quot;&gt;

		function nav_user_search() // reverse order from qa_html                _theme_base
		{
			$this-&amp;gt;search();
			$this-&amp;gt;nav('user');
		}&lt;/pre&gt;
	

&lt;p&gt;
		&amp;nbsp;&lt;/p&gt;
	

&lt;p&gt;
		&amp;nbsp;&lt;/p&gt;
	

&lt;p&gt;
		But it didn't change anything. &amp;nbsp;What gives? What am I doing wrong. &amp;nbsp;Thanks for any help.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/22234/how-to-override-functions</guid>
<pubDate>Fri, 15 Mar 2013 07:42:10 +0000</pubDate>
</item>
<item>
<title>Using a function from another plugin possible?</title>
<link>https://www.question2answer.org/qa/20905/using-a-function-from-another-plugin-possible</link>
<description>Hi, a couple of days ago I used a function from another plugin and it worked. (as far as i remember)&lt;br /&gt;
&lt;br /&gt;
Now I try to do the same with another plugin, and it does not work...&lt;br /&gt;
&lt;br /&gt;
Could it be that only a plugin function that is declared in one of the qa-plugin.php files, and that is &amp;quot;independent&amp;quot; from own methods (i.e. not calling other functions in its qa-plugins.php), can be used in other plugins?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Kai</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20905/using-a-function-from-another-plugin-possible</guid>
<pubDate>Sun, 27 Jan 2013 12:05:03 +0000</pubDate>
</item>
<item>
<title>History plugin and User-Activity-Plus plugin conflict</title>
<link>https://www.question2answer.org/qa/20654/history-plugin-and-user-activity-plus-plugin-conflict</link>
<description>

&lt;p&gt;
	Both plugins override the function &lt;strong&gt;q_list_and_form($q_list)&lt;/strong&gt; (see layer.php) as follows:&lt;/p&gt;


&lt;p&gt;
	&lt;a href=&quot;https://github.com/svivian/q2a-user-activity-plus/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/svivian/q2a-user-activity-plus/&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; function q_list_and_form($q_list)
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;qa_html_theme_base::q_list_and_form($q_list);
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$handle_raw = $this-&amp;gt;user_handle();
&lt;br&gt;
	
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// output activity links under recent activity
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ( $this-&amp;gt;template === 'user' )
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$this-&amp;gt;output(
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;lt;div class=&quot;qa-useract-page-links&quot;&amp;gt;',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;qa_lang_html('useractivity/more_activity') . ':',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;a href=&quot;' . qa_path('user-activity/questions/'.$handle_raw) . '&quot;&amp;gt;' . qa_lang_html('useractivity/all_questions') . '&amp;lt;/a&amp;gt;',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;amp;bull; ',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;a href=&quot;' . qa_path('user-activity/answers/'.$handle_raw) . '&quot;&amp;gt;' . qa_lang_html('useractivity/all_answers') . '&amp;lt;/a&amp;gt;',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;lt;/div&amp;gt;'
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;);
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	&lt;a href=&quot;https://github.com/NoahY/q2a-history&quot; rel=&quot;nofollow&quot;&gt;https://github.com/NoahY/q2a-history&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; function q_list_and_form($q_list)
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if($this-&amp;gt;template == 'user' &amp;amp;&amp;amp; qa_opt('user_act_list_active') &amp;amp;&amp;amp; qa_opt('user_act_list_replace'))
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;qa_html_theme_base::q_list_and_form($q_list);
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	&lt;strong&gt;q2a executes plugins by alphabetically order!&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;
	Having user-activity executed first and then history plugin, overrides the function above, and the useractivity/more_activity lines will not be printed.&lt;/p&gt;


&lt;p&gt;
	Any chance to prevent this?&lt;/p&gt;</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20654/history-plugin-and-user-activity-plus-plugin-conflict</guid>
<pubDate>Wed, 16 Jan 2013 11:08:41 +0000</pubDate>
</item>
<item>
<title>Q2A PULL: Experimental Project - Use For External Website</title>
<link>https://www.question2answer.org/qa/20597/q2a-pull-experimental-project-use-for-external-website</link>
<description>

&lt;p&gt;
	Hi All,&lt;/p&gt;


&lt;p&gt;
	While working on client project was though should start to expeiment this project. So here I go. I have started to create functions which allows to pull data from Q2A website and allows to display on other site &lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;on the same server&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;
	This is experimental project and development will be ongoing. Will add more functonality if not more than at least you can display most comon stuffs from Q2A to other website. Currently only one function is available to display &lt;strong&gt;recent questions&lt;/strong&gt; but by time I will add more functions to use. Before that I want to try and hear if any issue occur.&lt;/p&gt;


&lt;p&gt;
	Also developers&amp;nbsp;suggest me to make it more better and utilizable and feel free to contribute your idea.&lt;/p&gt;


&lt;p&gt;
	&lt;strong&gt;Here is the code:&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;
	&lt;a href=&quot;https://github.com/q2amarket/q2a-pull&quot; rel=&quot;nofollow&quot;&gt;https://github.com/q2amarket/q2a-pull&lt;/a&gt;&lt;/p&gt;</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20597/q2a-pull-experimental-project-use-for-external-website</guid>
<pubDate>Sun, 13 Jan 2013 13:55:14 +0000</pubDate>
</item>
<item>
<title>function colusion</title>
<link>https://www.question2answer.org/qa/20565/function-colusion</link>
<description>What will happen if I use a function in advance theme and another plugin overrides the same layer function?</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20565/function-colusion</guid>
<pubDate>Sun, 13 Jan 2013 12:50:00 +0000</pubDate>
</item>
<item>
<title>Incorrect function qa_cookie_get_create() ?</title>
<link>https://www.question2answer.org/qa/20534/incorrect-function-qa_cookie_get_create</link>
<description>

&lt;p&gt;
	I am checking the function qa_cookie_get_create() in qa-app-cookies.php, we have the following code there (v1.5.4):&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function qa_cookie_get_create()
&lt;br&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;require_once QA_INCLUDE_DIR.'qa-db-cookies.php';
&lt;br&gt;
	
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$cookieid=qa_cookie_get();
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (isset($cookieid) &amp;amp;&amp;amp; qa_db_cookie_exists($cookieid))
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;; // cookie is valid
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$cookieid=qa_db_cookie_create(qa_remote_ip_address());
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;setcookie('qa_id', $cookieid, time()+86400*365, '/', QA_COOKIE_DOMAIN);
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$_COOKIE['qa_id']=$cookieid;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return $cookieid;
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;
&lt;br&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	As far as I can see, in case that $cookieid is set already, it goes to line &lt;strong&gt;setcookie()&lt;/strong&gt; to set the cookie again?!&lt;/p&gt;


&lt;p&gt;
	Shouldn't it be that it returns the $cookieid immediately - &lt;strong&gt;without setting it anew!&lt;/strong&gt;
&lt;br&gt;
	Like that:&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isset($cookieid) &amp;amp;&amp;amp; qa_db_cookie_exists($cookieid))&lt;/span&gt;
&lt;br&gt;
	&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;return $cookieid;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt; // cookie is valid &lt;/span&gt;
&lt;br&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	Kai&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20534/incorrect-function-qa_cookie_get_create</guid>
<pubDate>Fri, 11 Jan 2013 03:56:43 +0000</pubDate>
</item>
<item>
<title>When to use qa_cookie_get() and qa_cookie_get_create() ?</title>
<link>https://www.question2answer.org/qa/20520/when-to-use-qa_cookie_get-and-qa_cookie_get_create</link>
<description>

&lt;p&gt;
	Both functions are defined in &lt;strong&gt;qa-app-cookies.php&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;
	function qa_cookie_get() → &quot;Return the user identification cookie sent by the browser for this page request, or null if none&quot;&lt;/p&gt;


&lt;p&gt;
	function qa_cookie_get_create() → &quot;Return user identification cookie sent by browser if valid, or create a new one if not.&amp;nbsp; &amp;nbsp; Either way, extend for another year (this is used when an anonymous post is created)&quot;&lt;/p&gt;


&lt;p&gt;
	
&lt;br&gt;
	This question originated from finding a &lt;a href=&quot;http://www.question2answer.org/qa/20376/solution-for-bug-headers-already-sent-theme-base-php-cookies&quot; rel=&quot;nofollow&quot;&gt;bug in the badges plugin&lt;/a&gt; where qa_cookie_get_create() is called:&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;color:#0000ff;&quot;&gt;qa_db_query_sub(
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;'INSERT INTO ^eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) '.
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;'VALUES (NOW(), $, $, $, #, $, $)',
&lt;br&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;qa_remote_ip_address(), $user_id, $handle, &lt;/span&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;qa_cookie_get_create()&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;, 'badge_awarded', 'badge_slug='.$badge_slug.($object_id?&quot;\t&quot;.'postid='.$object_id:'')
&lt;br&gt;
	);&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;
	I replaced &lt;span style=&quot;color:#ff0000;&quot;&gt;qa_cookie_get_create()&lt;/span&gt; with &lt;span style=&quot;color:#ff0000;&quot;&gt;qa_cookie_get() &lt;/span&gt;and would like to know about side effects.&lt;/p&gt;


&lt;p&gt;
	Thank you!
&lt;br&gt;
	Kai&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20520/when-to-use-qa_cookie_get-and-qa_cookie_get_create</guid>
<pubDate>Thu, 10 Jan 2013 09:47:17 +0000</pubDate>
</item>
</channel>
</rss>