I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like wpmu_create_user and wpmu_create_blog.
My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functions and update the db with new blog info.
wordpress uses a phpass function -
This worked for me as I had a password and the hash in a table (migrated wp users) and had to find a way to check login details -
Grab this download here - https://github.com/sunnysingh/phpass-starter
all u need is this basic function to check a text password to a WordPress hash:
All credits to Sunny Singh!
Following is the code I am using:
I've got universal solution that will work in any php file inside
wp-content
folder without any adjustments or needing to know what is misterious'path/to/wordpress'
It just automatically goes up to root of wordpress and loads wp-load.php
You can just paste it anywehre no matter if its plugin or theme file and it will work.
I think stuff like
../../../..
looks extremely bad and when you modify structure of your folders of theme/plugin you can get crazy.Note: This solution assumes you didn't rename your
wp-content
folder.For wordpress 3.1, I had to specify the host/domain because wp-includes/ms-settings.php:100 needs it or it dies. So my script looks something like (note I am using it for a network/multiblog site):
include wp-load.php file (in the root of your wordpress installation) in your php script file like so,
you will have to provide the abspath of the wp-load file, now you can use all the functions of wordpress in your php script
This should work:
i.e. When the php script is on the same server and WP is installed on the root. As most cases are.