allowing some users some days to write stories
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this? I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome. thanks -- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
hook_node_grants() has no effect on creating nodes. You probably want to have users register their birthday, then load that into the $user object. Then use hook_form_alter() to run an IF check on node creation forms. - Ken On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome.
thanks
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- -- -------------------------------------------------------------- DON'T MISS EARTH'S LARGEST GATHERING OF DRUPAL PROFESSIONALS! Drupalcon Boston 2008 · March 3-6, 2008 Learn more at http://boston2008.drupalcon.org Affordable sponsorship packages available --------------------------------------------------------------
This would require give story creation permissions to all users and then check if this is his/her birthday? On 04/02/2008, Ken Rickard <agentrickard@gmail.com> wrote:
hook_node_grants() has no effect on creating nodes.
You probably want to have users register their birthday, then load that into the $user object.
Then use hook_form_alter() to run an IF check on node creation forms.
- Ken
On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome.
thanks
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- -- -------------------------------------------------------------- DON'T MISS EARTH'S LARGEST GATHERING OF DRUPAL PROFESSIONALS! Drupalcon Boston 2008 · March 3-6, 2008 Learn more at http://boston2008.drupalcon.org Affordable sponsorship packages available --------------------------------------------------------------
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
Yes. You could create a specific node type for this -- call it "Birthday Post" -- and then give 'create birthday post' permissions to all users. Then use hook_form_alter() to check their birthdate. - Ken On Feb 4, 2008 10:16 AM, Lluís <enboig@gmail.com> wrote:
This would require give story creation permissions to all users and then check if this is his/her birthday?
On 04/02/2008, Ken Rickard <agentrickard@gmail.com> wrote:
hook_node_grants() has no effect on creating nodes.
You probably want to have users register their birthday, then load that into the $user object.
Then use hook_form_alter() to run an IF check on node creation forms.
- Ken
On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome.
thanks
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- -- -------------------------------------------------------------- DON'T MISS EARTH'S LARGEST GATHERING OF DRUPAL PROFESSIONALS! Drupalcon Boston 2008 · March 3-6, 2008 Learn more at http://boston2008.drupalcon.org Affordable sponsorship packages available --------------------------------------------------------------
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- -- -------------------------------------------------------------- DON'T MISS EARTH'S LARGEST GATHERING OF DRUPAL PROFESSIONALS! Drupalcon Boston 2008 · March 3-6, 2008 Learn more at http://boston2008.drupalcon.org Affordable sponsorship packages available --------------------------------------------------------------
Actually if you define your own node type rather than using the GUI (it's only about 30 lines of boilerplate code) then you can control the hook_access() implementation and put the check there. That would be much cleaner. --Larry Garfield On Mon, 4 Feb 2008 18:24:28 -0500, "Ken Rickard" <agentrickard@gmail.com> wrote:
Yes. You could create a specific node type for this -- call it "Birthday Post" -- and then give 'create birthday post' permissions to all users. Then use hook_form_alter() to check their birthdate.
- Ken
On Feb 4, 2008 10:16 AM, Lluís <enboig@gmail.com> wrote:
This would require give story creation permissions to all users and then check if this is his/her birthday?
On 04/02/2008, Ken Rickard <agentrickard@gmail.com> wrote:
hook_node_grants() has no effect on creating nodes.
You probably want to have users register their birthday, then load that into the $user object.
Then use hook_form_alter() to run an IF check on node creation forms.
- Ken
On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome.
thanks
I think that you can just add a hook_access implementation in a custom module for GUI created content types. node.module does not do that for you, thankfully. On Feb 5, 2008 11:19 AM, Larry Garfield <larry@garfieldtech.com> wrote:
Actually if you define your own node type rather than using the GUI (it's only about 30 lines of boilerplate code) then you can control the hook_access() implementation and put the check there. That would be much cleaner.
--Larry Garfield
On Mon, 4 Feb 2008 18:24:28 -0500, "Ken Rickard" <agentrickard@gmail.com> wrote:
Yes. You could create a specific node type for this -- call it "Birthday Post" -- and then give 'create birthday post' permissions to all users. Then use hook_form_alter() to check their birthdate.
- Ken
On Feb 4, 2008 10:16 AM, Lluís <enboig@gmail.com> wrote:
This would require give story creation permissions to all users and then check if this is his/her birthday?
On 04/02/2008, Ken Rickard <agentrickard@gmail.com> wrote:
hook_node_grants() has no effect on creating nodes.
You probably want to have users register their birthday, then load that into the $user object.
Then use hook_form_alter() to run an IF check on node creation forms.
- Ken
On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using hook_node_grants(), but I don't really get it; any hint is wellcome.
thanks
Has anyone successfully done this, adding a hook_access for a node type created through the GUI (in Drupal 5)? I tried this a week or two ago and couldn't get it working, so I would love to see an example of the right way to do it. -tao Moshe Weitzman wrote:
I think that you can just add a hook_access implementation in a custom module for GUI created content types. node.module does not do that for you, thankfully.
On Feb 5, 2008 11:19 AM, Larry Garfield <larry@garfieldtech.com> wrote:
Actually if you define your own node type rather than using the GUI (it's only about 30 lines of boilerplate code) then you can control the hook_access() implementation and put the check there. That would be much cleaner.
--Larry Garfield
On Mon, 4 Feb 2008 18:24:28 -0500, "Ken Rickard" <agentrickard@gmail.com> wrote:
Yes. You could create a specific node type for this -- call it "Birthday Post" -- and then give 'create birthday post' permissions to all users. Then use hook_form_alter() to check their birthdate.
- Ken
On Feb 4, 2008 10:16 AM, Lluís <enboig@gmail.com> wrote:
This would require give story creation permissions to all users and then check if this is his/her birthday?
On 04/02/2008, Ken Rickard <agentrickard@gmail.com> wrote:
hook_node_grants() has no effect on creating nodes.
You probably want to have users register their birthday, then load
that
into
the $user object.
Then use hook_form_alter() to run an IF check on node creation forms.
- Ken
On Feb 4, 2008 4:44 AM, Lluís <enboig@gmail.com> wrote:
I am trying to write a module to allow my web users to write stories just during their birthday web; how can I achieve this?
I am using Drupal5 and I suppose it is done using
hook_node_grants(),
but I don't really get it; any hint is wellcome.
thanks
My experience is that if you want hook_access, you must define the node type in your module. Once defined that way, you can configure the node type with Drupal's UI, and add CCK fields. There's been talk about an "access" op for hook_nodeapi, but I don't know what happened allong those lines. On Tuesday 05 February 2008, Tao Starbow wrote:
Has anyone successfully done this, adding a hook_access for a node type created through the GUI (in Drupal 5)? I tried this a week or two ago and couldn't get it working, so I would love to see an example of the right way to do it.
-tao
On Feb 5, 2008, at 10:33 PM, Dave Cohen wrote:
There's been talk about an "access" op for hook_nodeapi, but I don't know what happened allong those lines.
Sadly, it was postponed months ago. :( Now that 7.x is open, we could consider it again. However, I suspect all the DataAPI summit stuff might impact it, so I wouldn't spend time re-rolling the (trivial and amazingly useful and powerful) patch that we had going before. Nah, I'm not biased. ;) http://drupal.org/node/122173 http://drupal.org/node/143075 (duplicate, but big debate) http://drupal.org/node/196922 (another more complicated but potentially better approach) cheers, -derek (dww)
The example I posted isn't the real one, implementing a story-like or page-like node type is quite easy; what I was wondering was if I could allow certain users under certain circumstances to publish nodes like events, etc... I think Organic Groups manage to do so, but I didn't understand how it achieve this reading the code. On 06/02/2008, Derek Wright <drupal@dwwright.net> wrote:
On Feb 5, 2008, at 10:33 PM, Dave Cohen wrote:
There's been talk about an "access" op for hook_nodeapi, but I don't know what happened allong those lines.
Sadly, it was postponed months ago. :( Now that 7.x is open, we could consider it again. However, I suspect all the DataAPI summit stuff might impact it, so I wouldn't spend time re-rolling the (trivial and amazingly useful and powerful) patch that we had going before. Nah, I'm not biased. ;)
http://drupal.org/node/122173 http://drupal.org/node/143075 (duplicate, but big debate) http://drupal.org/node/196922 (another more complicated but potentially better approach)
cheers, -derek (dww)
-- *La paciència és un arbre d'arrels amargues però fruit dolç. *Hi han dues paraules que t'obriran totes les portes del món: "estira" i "empeny". *Quan fa 6x9? 42!!! (funciona en base 13) *Abans d'imprimir aquest missatge, pensa en el medi ambient.
participants (7)
-
Dave Cohen -
Derek Wright -
Ken Rickard -
Larry Garfield -
Lluís -
Moshe Weitzman -
Tao Starbow