[development] allowing some users some days to write stories
Tao Starbow
starbow at citris-uc.org
Tue Feb 5 18:23:23 UTC 2008
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 at 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 at 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 at 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 at 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 at 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
>>>>>>
>>
More information about the development
mailing list