[pLog-svn] r1350 - plog/trunk/class/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Tue Mar 8 22:06:33 GMT 2005


Author: oscar
Date: 2005-03-08 22:06:32 +0000 (Tue, 08 Mar 2005)
New Revision: 1350

Modified:
   plog/trunk/class/dao/users.class.php
Log:
added support for fetching only user blogs that are in a certain status (all of them by default)

Modified: plog/trunk/class/dao/users.class.php
===================================================================
--- plog/trunk/class/dao/users.class.php	2005-03-08 13:05:50 UTC (rev 1349)
+++ plog/trunk/class/dao/users.class.php	2005-03-08 22:06:32 UTC (rev 1350)
@@ -187,14 +187,18 @@
          * @param userId Identifier of the user
          * @return An array of BlogInfo objects to whom the user belongs.
          */
-        function getUsersBlogs( $userid )
+        function getUsersBlogs( $userid, $status = BLOG_STATUS_ALL )
         {
             $usersBlogs = Array();
             $blogs = new Blogs();
 
             // check if the user is the owner of any blog
-            $owner = "SELECT * FROM ".$this->getPrefix()."blogs WHERE owner_id = ".$userid.";";
-            $result = $this->Execute( $owner );
+            $owner = "SELECT * FROM ".$this->getPrefix()."blogs WHERE owner_id = ".$userid;
+			
+			if( $status != BLOG_STATUS_ALL ) 
+				$owner .= " AND status = '".Db::qstr( $status )."'";
+            
+			$result = $this->Execute( $owner );
 
             // return an empty array if the user is assigned to no blog
             if( !$result )




More information about the pLog-svn mailing list