Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added postid to query

  • Loading branch information...
commit 07b212e0369f2497de9054ce518f411dab6dce94 1 parent de631f7
NoahY authored September 04, 2012

Showing 1 changed file with 30 additions and 2 deletions. Show diff stats Hide diff stats

  1. 32  qa-history-layer.php
32  qa-history-layer.php
@@ -143,7 +143,22 @@ function user_activity_form() {
143 143
 		else $last_visit = time();
144 144
 		
145 145
 		$events = qa_db_query_sub(
146  
-			'SELECT event, BINARY params as params, UNIX_TIMESTAMP(datetime) AS datetime FROM ^eventlog WHERE userid = # AND DATE_SUB(CURDATE(),INTERVAL # DAY) <= datetime ORDER BY datetime DESC'.(qa_opt('user_act_list_max')?' LIMIT '.(int)qa_opt('user_act_list_max'):''),
  146
+			"SELECT 
  147
+				e.event, 
  148
+				BINARY e.params as params, 
  149
+				UNIX_TIMESTAMP(e.datetime) AS datetime,
  150
+				p.postid AS postid
  151
+			FROM 
  152
+				^eventlog AS e
  153
+			LEFT JOIN
  154
+				^posts AS p
  155
+				ON e.params LIKE CONCAT('%postid=', p.postid, '\t%' ) OR e.params LIKE CONCAT('%postid=', p.postid)
  156
+			WHERE
  157
+				e.userid=#
  158
+				AND
  159
+				DATE_SUB(CURDATE(),INTERVAL # DAY) <= datetime
  160
+			ORDER BY datetime DESC"
  161
+			.(qa_opt('user_act_list_max')?" LIMIT ".(int)qa_opt('user_act_list_max'):""),
147 162
 			$userid, qa_opt('user_act_list_age')
148 163
 		);
149 164
 
@@ -209,6 +224,19 @@ function user_activity_form() {
209 224
 		while ( ($event=qa_db_read_one_assoc($events,true)) !== null ) {
210 225
 			$type = $event['event'];
211 226
 			
  227
+
  228
+
  229
+			// these calls allow you to deal with deleted events; 
  230
+			// uncomment the first one to skip them
  231
+			// uncomment the second one to build your own routine based on whether they are deleted.
  232
+
  233
+			// if(!in_array($type, $nopost) && $event['postid'] == null)
  234
+			//	continue;
  235
+
  236
+			// $deleted = (!in_array($type, $nopost) && $event['postid'] == null);
  237
+
  238
+
  239
+			
212 240
 			// hide / show exceptions
213 241
 			
214 242
 			if(qa_get_logged_in_level()<QA_USER_LEVEL_ADMIN) {
@@ -321,7 +349,7 @@ function user_activity_form() {
321 349
 				$activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'),null,$anchor);
322 350
 				$link = '<a href="'.$activity_url.'">'.$parent['title'].'</a>';
323 351
 			}
324  
-			else {
  352
+			else { // question
325 353
 
326 354
 				if(!isset($params['title'])) {
327 355
 					$params['title'] = qa_db_read_one_value(

0 notes on commit 07b212e

Please sign in to comment.
Something went wrong with that request. Please try again.