ksoonson's Description
In building multiuser blog site, I want to provide an optional block which shows comments of that user's blog and that block is shown only in that user's blog pages. (user can choose whether he/she wants the block be displayed in his/her blog or not also)
And I want to provide a user-defined block which is shown only in that user's blog too.
I found a module where each user can choose their own theme for his/her blog but did not find module with the above features. I think this kind of functionality is essential for multiuser blog.
------
John Hwang's Updates
Well... I'm uploading a patch to the comment.module which displays the recent comments for a user's blog.
This essentially checks if the user is viewing a blog or a node. If the user is viewing a blog it checks for the blog's uid then retrieves 10 most recent comments made on the blog using the following sql statement.
$result = db_query_range(db_rewrite_sql("SELECT c.nid, c.*
FROM {comments} c
INNER JOIN {node} n ON c.nid = n.nid
INNER JOIN {users} u ON n.uid = u.uid
WHERE c.status = 0
AND u.uid = $uid
AND n.status = 1
AND n.type = 'blog'
ORDER BY c.timestamp DESC", 'c'), 0, 10);
If the user is viewing a node, it loads the node then retrieves the node uid. It then does pretty much same as the above code.
| Comment | File | Size | Author |
|---|---|---|---|
| blog.module_3.patch | 4.5 KB | John Hwang |
Comments
Comment #1
ksoonson commentedDear John, thank you very much for the patch and I briefly tested this but not much luck yet.
I patched the blog.module using this patch and created a new user, added blog entry using that id, added comment and visited this user's blog page as well as that blog entry expecting that only the comments of this user would show up in this case instead of the whole existing comments but the comments block where all the same.
Is there anything I forgot to apply?
Comment #2
ksoonson commentedHi John, sorry for misleading post.
Your patch works fine. I did not know that 'recent comments' block and 'recent blog comments' block were different one. I tried with 'recent comments' block and that's why I couldn't get what I wanted.
It works fine and I hope this can be merged to HEAD.
By the way, it looks like this patch does not allow user-defined block like adding google adsense block for each users' blog page. I think I'd post a separate issue request.
Thanks very much...
Comment #3
dries commentedCoding style needs work: spaces, tabs, and some strings can't be translated properly. The SQL query looks vulnerable to SQL injection attacks ($uid is taken from the query string without any input checking).
Comment #4
mathieu commentedThis seems interesting, but patch doesn't apply anymore (not on head, anyway). :(
Comment #5
John Hwang commentedIt's my fault b/c I didn't follow up on Dries' comments. I'll try to fix it this weekend and post a patch that secure and works with HEAD.
Comment #6
magico commentedIs a feature and as John said, he will work on it.
Comment #7
LAsan commentedJohn Hwang: any news about this?
Feature request go to cvs
Comment #8
casey commentedD7 is in alpha fase already.
Comment #9
jody lynnThis feature request is 5 years old... (pre-views)