Plugin working when accessed from browser, but not from PHP. (RoleModel::roles() issue)
I'm guessing I'm missing something obvious, or going about this the wrong way. What I'm trying to accomplish is that when somebody creates an account for my site, that site's registration PHP script also calls a custom Vanilla plugin (UserCreator) which, in turn, sets up a forum account with the same username, password and e-mail address.
The plugin I made works fine when I access it at http://localhost/path/to/forum/plugin/usercreator?username=bob/. It creates the account and sets up its permissions, or throws an error if it failed.
To call this through PHP, I wanted to avoid having to build and install separate HTTP extensions, so I figured I might emulate it using file_get_contents("http://".$_SERVER['SERVER_NAME']."/path/to/forum/plugin/usercreator?username=bob/");. This, however, gives me the following error: Call to undefined method RoleModel::roles().
Does anyone know what could be causing this, or know of a better way to go about it?
Small update: The error now appears when accessing the plugin from the browser as well, despite me having changed anything. So... yay for uniformity, I guess?
Maybe that discussion could give you a hint: http://vanillaforums.org/discussion/24362/how-do-i-post-a-comment-using-an-external-php-script-in-vanilla
I'm quite sure I've read about something like that before. You can try and use Google to find some answers: https://www.google.de/#q=site:vanillaforums.org+use+vanilla+external
Oh man, seems my Google-fu really failed me there; thanks for helping me get on track!
For those reading this in the future, here's how I solved my issue:
Thanks for the help! Cheers!