wp_new_user_notification and Custom Post Data Issue
This is kind of a complicated question so please bear with me. I am writing a plugin for personal use that overrides the default functionality of wp_new_user_notification so I can automatically send different user roles a different message when they sign up, a simple theory.
So far it works fine, the roles are determined by my other (published) plugin get_user_role() and the correct message is selected. The problem arises when I’m trying to use some post information to populate certain details within these emails.
The user registration is handled by Gravity Forms and there is a custom post type set up as well which is facilitated by Custom Post Types for Gravity Forms so it stores a lot of other information besides the basic user information. Now I want some of this information to be available to send out in the welcome email but here’s the issue. Sometimes it works and sometimes it doesn’t! I can run the form 10 times and it’ll work 4 or 5 times and fail the rest. I can find no consistency or pattern to it and can only assume it is due to the way in which the posts are stored resulting in them not always being available to the code as.
Here’s my code: http://pastie.org/5448784
Does anyone have any ideas how I can validate this so it waits a few fractions of a second longer until it finds the correct information or whatever else the problem is please? It’s driving me nuts!
If someone can help and needs to see the live site I will pm them as I don’t want the test site details mentioned here.
- The topic ‘wp_new_user_notification and Custom Post Data Issue’ is closed to new replies.