11

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?

Cayce K
  • 2,288
  • 1
  • 22
  • 35
Ivan Bravo Carlos
  • 1,650
  • 3
  • 15
  • 22
  • If you can figure out where your users are created in Wordpress you could post directly to the link using a plain form. All you would need to do is get the url add that to your form url and post. You could also possibly do a post to laravel use that information to add the user to your laravel app then redirect in some way as a post (this isn't a normal HTTP action, but it may be possible if you read [this](http://laravel.io/forum/04-23-2014-redirectintended-with-routepost). – Cayce K Jul 22 '15 at 16:31
  • Are you able to solve this issue with adding data in `wp_users` and `wp_usersmeta` table..?? – hhsadiq Jul 28 '15 at 09:04

1 Answers1

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.

hhsadiq
  • 2,871
  • 1
  • 25
  • 39