hello
i am developing module for our laboratory members profiles. i dont want to use profile module (or usernode) by default, because several actions will be possible with the newly created content. anyway...
the idea is to create a node type. this is not so hard at all, but the problem is, i dont know how to ensure to allow users to create only one content of this type. i tryed to do this with the hook_access for the operation create with the lines like this:
if( $op == 'create' )
{
$query = db_query( 'SELECT * FROM {labteam} WHERE uid = %d', $user->uid );
if( db_num_rows( $query ) != 0 )
return( false );
else
return user_access( 'create content' );
}
the idea was good, but not working the way i want to, because it works only once good way ;) (hmm... preloading of access control?)
so - if you have any idea, how to manage it, it will be helpful for me.
have a nice day
mirek
Comments
I suspect the issue with the way the menu works
The menu is cached, so I suspect once the user logs in the menu is built and the cached version used from that point forward. As such changing the permission as no impact though you could clear the menu cache after inserting content of this type. This should force the menu to rebuild.
great! it works ;) something
great! it works ;) something new for me ;) thanks for help. but...
... maybe one more question - i create new node without the title, but i want to set it. i am creating the profile of the person, so the $node->name should be the combinaction of $node->firstname and $node->surname. but - how can i make it? where to put such line - in hook_validate? hook_prepare? not sure about...
mirek
I would suggest the submit hook
I would suggest the submit hook, it gets called before both the insert and update and also allows you to modify the node contents before it is saved. So it would look something like
thanks one more time ;)
thanks one more time ;) finaly - i got the module the way i originaly wanted to ;)
thanks ;)
mirek
I'm looking for this too. Any
I'm looking for this too. Any way I can get a finished copy of your module?
I'm looking for this too
I'm looking for this too.. on d6.
Thanks, federico
I'm looking for this as well!
I'm looking for this as well!
Please do consider submitting this as a module. :)
I'm looking for this as well!
Please submit a copy :)