Blogs are a feature of a 'social-network' style site I am making, so each user can have their own. I have not used the blog module, so needed some way to create the pagers and limit them to the author only (ie authors prev and next blog post).

This should be a rather simple feature to implement, as I already did a little hack to this module to use have this functionallity on my site. All I had to do was edit the prev_next.module, find function _prev_next_add($nid), and tweak the db_query_range strings. In my case, I hard coded it, but it would be nice feature to have the option on the settings page.

At the top of the function, I added $uid = db_query_range("SELECT uid FROM {node} WHERE nid = :nid", 0, 1, array(':nid' => $nid))->fetchField(); . It isn't very elegant considering there is already a db_query for the node type, but Im not sure how to get 2 values at once like that.
Then I tweaked the queries to add the uid in. Here is an example for when the search criteria is nid
$next_nid = db_query_range("SELECT nid FROM {node} WHERE nid > :nid AND status = 1 AND uid = :uid $cond ORDER BY nid ASC", 0, 1, array(':nid' => $nid, ':uid' => $uid))->fetchField(); So it is pretty basic, but works as expected.

If this feature were implemented, I think it would also be a good idea to implement multiple indexes, so you could have one index of all blog posts, and one of the users blog posts. All you would need to do is add an index column to the table, and have the ability to query this. So the db queries would be along the lines SELECT next_nid FROM {prev_next_node} WHERE nid = :nid AND indexid = :iid

Comments

tribsel’s picture

yeah, this would be a nice addition... i could use it too - ability to create index for nodes of specific type by each specific user.