Scheduled posts don’t trigger publish_post
, only updating the post itself will do that.
Add an action for future_to_publish
, see the reference on post status transitions. I don’t believe that you’ll have access to the user-object in that case, so you might want to refactor that.
Alternatively, just get the images when the user saves the post, not when it gets published. Use the save_post
action.