Skip to content
Browse files

credit each post to its author

push 'author' field to database, using the logged-in user name.
  • Loading branch information...
1 parent 6431054 commit 02cbb98238f0e0019b81b4f435ab4d64134a24c9 @gbenison committed Mar 2, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 schwordpress.cgi
View
15 schwordpress.cgi
@@ -128,7 +128,10 @@ exec guile -s $0 2>>guile-error.log
"Log in as a different user"))
`((span "Not logged in")
(a (@ (href "schwordpress.cgi?request=login"))
- "Log in"))))))))))
+ "Log in")))))
+ (p (a (@ (id "new-post-button")
+ (href "schwordpress.cgi?request=new-post"))
+ "NEW POST")))))))
(define (->string x)
(with-output-to-string (lambda ()(write x))))
@@ -182,15 +185,13 @@ exec guile -s $0 2>>guile-error.log
(query
(format
#f
- "INSERT INTO posts (title, timestamp, content) VALUES (~a, now(), ~a)"
+ "INSERT INTO posts (title, timestamp, content, author) VALUES (~a, now(), ~a, ~a)"
(->string title)
- (->string content))))
+ (->string content)
+ (->string (session-get-user session)))))
(dbi-query cn query)))
(standard-page-with-content
- '(p (a (@ (id "new-post-button")
- (href "schwordpress.cgi?request=new-post"))
- "NEW POST"))
- (map post->paragraph (gather-posts cn 999))))
+ (map post->paragraph (gather-posts cn 999))))
(define (new-post)
(standard-page-with-content

0 comments on commit 02cbb98

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