Browse Source

Home page with first user action

Vova Tkach 6 years ago
parent
commit
5ff4029c38
1 changed files with 22 additions and 0 deletions
  1. 22 0
      modules/module_index.go

+ 22 - 0
modules/module_index.go

@@ -562,6 +562,28 @@ func (this *Modules) RegisterAction_IndexFirstUser() *Action {
 			return
 		}
 
+		// Add home page
+		_, err = wrap.DB.Query(
+			`INSERT INTO pages SET
+				user = ?,
+				name = ?,
+				alias = ?,
+				content = ?,
+				datetime = ?,
+				active = ?
+			;`,
+			1,
+			"Home",
+			"/",
+			"Hello World from Fave CMS!",
+			utils.GetCurrentUnixTimestamp(),
+			1,
+		)
+		if err != nil {
+			wrap.MsgError(err.Error())
+			return
+		}
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})