Using parameters in Actions

I need to do an add_action to a signup function, but my function is going to need all the values of from signup. How do I pass a parameter to my function, even if it’s just the new blog id, which I can use to get everything else? I don’t see any way of passing a parameter to an action/filter function.

In fact, is the blog Id even available on signup or is created once the blog is activated?

Thanks

  • Andrew
    • Champion of Loops

    In fact, is the blog Id even available on signup or is created once the blog is activated?

    Should be available only after the blog is activated.

    Is there a reason the new blog action hook won’t work? Take a look at our default theme plugin for a usage example.

    Thanks,

    Andrew

  • erealestatemu
    • Flash Drive

    Thanks, I think that might work. Great example! I think I can use the user_id to get what I need because I actually store all my fields in the meta property of the signup. I modified the wp-signup.php file directly (had no choice) so I put them there. Like your PayToBlog plugin, I can read it out of the signup from within the function I hook to wpmu_new_blog and write it to my table. I’ll try it.

    In short, I store a lot of field with the signup and didn’t want to append them all together into the custom field of the PayPal request (just storing blog_id) so I’m writing them to my own table (one-to-one with wp_blogs). When PayPal returns, it will give me the blog id which I can use to get all my data back.

    Thanks again about wpmu_new_blog. Very good to know.