[development] Can I Indicate failure from hook_user?

Sam Boyer drupal at samboyer.org
Wed Sep 3 12:20:52 UTC 2008


On Wednesday 03 September 2008 06:47:21 Pushyamitra Navare wrote:
> On Wed, Sep 3, 2008 at 3:08 PM, FGM <fgm at osinet.fr> wrote:
> > I think you can make sure of this by defining the weight of your module
> > as
> >
> > > 0. It will then be invoked after all core modules and all contrib
> > > modules
> >
> > with lower weights. See includes/module.inc#module_list to see how Drupal
> > builds and orders the list of modules invoked in a module_invoke_all
> > call.
>
> Cool! Much simpler than I thought.
>
> Looking at code in module.inc I can see that one way to adjust weight is by
> changing value in system table in database. Just to confirm, is there other
> way to change weight for a module (like defining weight in module.info file
> etc.)?
>
> - Pushya

No, there is no other way to change your module's weight. The standard 
practice is to change the module's weight in hook_install() (which also means 
writing a hook_update() if necessary).

Sam

>
> > ----- Original Message ----- From: "Pushyamitra Navare" <
> > pushyamitra at gmail.com>
> > To: <development at drupal.org>
> > Sent: Wednesday, September 03, 2008 11:25 AM
> > Subject: Re: [development] Can I Indicate failure from hook_user?
> >
> >
> > Hello there,
> >
> >
> > On Mon, Jul 21, 2008 at 3:53 PM, Steven Jones <darthsteven at gmail.com
> > <mailto:darthsteven at gmail.com>> wrote:
> > Always good to see someone new to Drupal.
> >
> > You'll probably want to do something with the $op == "validate"
> > argument of hook_user. Throw an error if you don't want the
> > update/insert to continue.
> >
> >
> > I am back with a question related to this.
> >
> > What is order in which hooks are called? For e.g. let's say there's a
> > captcha module. Now as I see on my machine, hook_user is called first.
> > After that, validation of captcha happens.
> >
> > Is there any way I can control the sequence in which validations occur?
> > What I want to do is, after all other modules have done their validations
> > and everything is ok, only then should my function be called, in the end.
> > My validation function should be final validation function. Is there any
> > way to do it?
> >
> > Any help on this appreciated. Any document which explains how actually
> > hooks are called would help too.
> >
> > Thanks, Pushya

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.drupal.org/pipermail/development/attachments/20080903/336255f8/attachment.pgp 


More information about the development mailing list