do_action is not passing objects as arguments correctly
I wrote a plugin that creates a very customized user profile page, with custom fields interspersed among default fields. I used the files profile.php and user_edit.php as templates so I could incorporate the necessary code from them.
All seems to work well until I get to these lines:
if ( IS_PROFILE_PAGE ) do_action( 'show_user_profile', $profileuser ); else do_action( 'edit_user_profile', $profileuser );
This triggers an error when another plugin tied to those actions tries to treat $profileuser as an object, even though it has successfully been treated as an object throughout my plugin.
To troubleshoot, I caused the other plugin to
var_dump($profileuser)and found that it returns null. But when the default profile page is loaded, the other plugin successfully dumps the object. This leads me to believe that the object $profileuser is not being passed correctly as an argument in my do_action line.
Any ideas on what I should check? Thank you.
- The topic ‘do_action is not passing objects as arguments correctly’ is closed to new replies.