Hi.
I need to create some menu items which will vary based on whether a user has any nodes of a particular type.
If they have no nodes of type Example
- they would get a link to create a node of type Example.
If they have 1 node of type Example
- they would get 3 links which would have to change based on the actual node they created of that type.
--- View your Example
--- Edit your Example
--- Delete your Example
I've been told that I need to write a custom module to do this by several people. I understand that.
I'm hoping someone has done something similar and that someone has something I could look at as an example to work from as I have not written a module before and I am finding that doing so is very intimidating and complex.
I have a query that I think I can use to check how many nodes a user has of that type.
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE uid = %d AND type = %s", $user->uid, $type))
Comments
This was entered into a
This was entered into a block.
On one of my test accounts, I have a personal ad but I'm getting the create a personal ad link.
A beta tester has no personal ad, and he is getting view, edit and delete links.
on Admin (user 01) it has a create a personal ad link, which is correct. If I create a personal ad the menu doesn't change.
Code is thanks to cat omega
i think you mean >
i think you mean > 0.
if($count > 0)-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com