WordPress Subscriptions in laravel (corcel)

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.

Read More

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?

Related posts

1 comment

  1. Yes you can add new users in database with subscribers role.

    WordPress stores the users data in wp_users table and its meta info in wp_usermeta. So follow the following steps

    1. Add a new entry in wp_users table. As a sample here is entry from my wp_users table. You can submit values for these attributes using your normal laravel form with post request. enter image description here
    2. Add its related data in wp_usermeta table. Here you need to set two key value attributes against user_id of newly inserted record.
      1. meta_key = wp_capabilites and meta_value = a:1:{s:10:"subscriber";b:1;}. As you can note the meta_value for wp_capabilities is in serialzed form.
      2. meta_key = show_admin_bar_front and meta_value = true.

    So you added a new user with subscriber role.

Comments are closed.