I have 2 projects, one in WordPress, and the other one in Laravel 4.2.
Recently i had to merge both projects into one Laravel 4.2 App using jgrossi/corcel. This was my only option.
Everything works fantastic! I can even post directly into WordPress without logging into WordPress to get posts, comments, etc.
But there is something I can’t figure out. WordPress is using Jetpack for subscribers. The laravel app needs a field to add more subscribers. I have very little experience in WordPress.
Is it possible to add subscribers from outside WordPress directly into the database? If not, is there a way to use a Jetpack plugin outside of WordPress?
Yes you can add new users in database with subscribers role.
WordPress stores the users data in
wp_users
table and its meta info inwp_usermeta
. So follow the following stepswp_users
table. As a sample here is entry from mywp_users
table. You can submit values for these attributes using your normal laravel form with post request.wp_usermeta
table. Here you need to set two key value attributes againstuser_id
of newly inserted record.meta_key = wp_capabilites
andmeta_value = a:1:{s:10:"subscriber";b:1;}
. As you can note themeta_value
forwp_capabilities
is in serialzed form.meta_key = show_admin_bar_front
andmeta_value = true
.So you added a new user with subscriber role.