All pastes #798424 Raw Edit

RCCWP.20070806.diff

public diff v1 · immutable
#798424 ·published 2007-11-26 20:26 UTC
rendered paste body
Index: RCCWP_Application.php===================================================================--- RCCWP_Application.php	(revision 16416)+++ RCCWP_Application.php	(working copy)@@ -26,7 +26,10 @@ 	function GetWpCategories() 	{ 		global $wpdb;-		$sql = "SELECT cat_ID, cat_name FROM $wpdb->categories ORDER BY cat_name";+		if ($wpdb->terms != '')+			$sql = "SELECT t.term_id AS cat_ID, t.name AS cat_name FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id WHERE tt.taxonomy = 'category' ORDER BY t.name";+		else+			$sql = "SELECT cat_ID, cat_name FROM $wpdb->categories ORDER BY cat_name"; 		$results = $wpdb->get_results($sql); 		if (!isset($results)) 			$results = array();                return $results;	 }Index: RCCWP_CustomWritePanel.php===================================================================--- RCCWP_CustomWritePanel.php	(revision 16416)+++ RCCWP_CustomWritePanel.php	(working copy)@@ -150,9 +150,20 @@ 	function GetAssignedCategories($customWritePanelId) 	{ 		global $wpdb;-		$sql = "SELECT rc.cat_id, cat_name FROM " . RC_CWP_TABLE_PANEL_CATEGORY . -			" rc JOIN $wpdb->categories wp ON rc.cat_ID = wp.cat_ID" . -			" WHERE panel_id = " . $customWritePanelId;+		+		if ($wpdb->terms != '')+		{+			$sql = "SELECT rc.cat_id, wp.name AS cat_name FROM " . RC_CWP_TABLE_PANEL_CATEGORY . +				" rc JOIN $wpdb->terms wp ON rc.cat_ID = wp.term_id" . +				" WHERE panel_id = " . $customWritePanelId;+		}+		else+		{+			$sql = "SELECT rc.cat_id, cat_name FROM " . RC_CWP_TABLE_PANEL_CATEGORY . +				" rc JOIN $wpdb->categories wp ON rc.cat_ID = wp.cat_ID" . +				" WHERE panel_id = " . $customWritePanelId;+		}+			 		$results = $wpdb->get_results($sql); 		if (!isset($results)) 			$results = array();                return $results;	  }