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.

CommentFileSizeAuthor
blog.module_3.patch4.5 KBJohn Hwang

Comments

ksoonson’s picture

Dear 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?

ksoonson’s picture

Hi 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...

dries’s picture

Status: Needs review » Needs work

Coding 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).

mathieu’s picture

This seems interesting, but patch doesn't apply anymore (not on head, anyway). :(

John Hwang’s picture

It'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.

magico’s picture

Version: 4.6.5 » x.y.z

Is a feature and as John said, he will work on it.

LAsan’s picture

Version: x.y.z » 7.x-dev

John Hwang: any news about this?
Feature request go to cvs

casey’s picture

Version: 7.x-dev » 8.x-dev

D7 is in alpha fase already.

jody lynn’s picture

Status: Needs work » Closed (won't fix)

This feature request is 5 years old... (pre-views)