[pLog-svn] r742 - plog/trunk/class/summary/action

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Jan 13 15:06:04 GMT 2005


Author: oscar
Date: 2005-01-13 15:06:04 +0000 (Thu, 13 Jan 2005)
New Revision: 742

Modified:
   plog/trunk/class/summary/action/dofinishregister.class.php
Log:
fixed bug 136 (http://bugs.plogworld.net/view.php?id=136) quite a tricky one if you ask me. I have removed setTemplate because it's not needed, we can set the blog template at the same time that we're creating it (we just need to specify it in the BlogSettings object or use BlogInfo::setTemplate()) 
This also had some strange side effect of changing the template used in blog id number 1, and don't ask me why


Modified: plog/trunk/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/trunk/class/summary/action/dofinishregister.class.php	2005-01-13 14:35:02 UTC (rev 741)
+++ plog/trunk/class/summary/action/dofinishregister.class.php	2005-01-13 15:06:04 UTC (rev 742)
@@ -39,13 +39,9 @@
         function perform()
         {
             $userId = $this->createUser();
-            if($userId){
-                $blogId = $this->createBlog($userId);
-            }
-            if($blogId){
-                $this->setTemplate($blogId);
-            }
+            $blogId = $this->createBlog($userId);
 
+
             // FIXME:what if blog creation failed?
             // how to throw an exception and roll back?
 
@@ -68,7 +64,7 @@
 			$user = new UserInfo( $this->userName, 
                         $this->userPassword, 
                         $this->userEmail, 
-                        "n/a", // about myself
+                        "", // about myself
                         $this->userFullName );
 
             // if user registration need email confirm, that is
@@ -100,6 +96,8 @@
         function createBlog($userId){
             $this->blogName = $this->_request->getValue("blogName");
             $this->blogLocale = $this->_request->getValue("blogLocale");
+            $this->templateId = $this->_request->getValue("templateId");
+		
 
             $this->log->debug("blogName is ".$this->blogName);
             $this->log->debug("blogLocale is ".$this->blogLocale);
@@ -119,6 +117,7 @@
 
 			$locale = Locales::getLocale( $this->blogLocale );
 			$blogInfo->setLocale( $locale );
+			$blogInfo->setTemplate( $this->templateId );
             $newblogId = $blogs->addBlog( $blogInfo );
 
             if( !$newblogId ) {
@@ -154,35 +153,6 @@
         }
         //}}}
 
-        //{{{function setTemplate($blogId){
-        /**
-         * set blog template
-         */
-        function setTemplate($blogId){
-            $this->templateId = $this->_request->getValue("templateId");
-			// and now simply save the settings after loading (and hopefully finding!)
-			// the information about the blog
-			$blogs = new Blogs();
-			$blogInfo = $blogs->getBlogInfo( $blogId );
-			
-			// make sure we actually loaded the blog...
-			if( !$blogInfo ) {
-                $this->log->debug("set blog template failed,blog id is ".$blogId.",template id is  ".$this->templateId);
-                $this->_view = new SummaryView( "registererror" );
-                $this->_view->setValue( "message", $this->_locale->tr("error_fetching_blog"));
-                return false;
-			}
-			
-			$ts = new TemplateSets();
-			$blogInfo->setTemplate( $this->templateId );
-			
-			// update the blog settings in the db
-			$blogs->updateBlog( $blogInfo->getId(), $blogInfo );
-
-            return true;
-        }
-        //}}}
-
         //{{{function doneRegister(){
         /**
          * finished registaration
@@ -258,4 +228,4 @@
      * vim600:  et sw=4 ts=4 fdm=marker expandtab
      * vim<600: et sw=4 ts=4 expandtab
      */
-?>
\ No newline at end of file
+?>




More information about the pLog-svn mailing list