On Friday 05 October 2007 03:02:22 Neil: esl-lounge.com wrote:
How would I find out if User A had authored a node of type X?
I have a link "View Story" that I would like to be "Create Story" if that member hasn't yet created that node type.
Is that a complicated db query to do?
Probably something like this would do it:
global $user; $node_type = 'story'; if (db_num_rows(db_query("SELECT * FROM {node} WHERE type='%s' AND uid=%d", $node_type, $user->uid))) { print(t("View story")); } else { print(t("Create story")); }
Note: that is totally untested code and is likely to contain one or more errors.