Title: Clone users from template through API
Last modified: October 1, 2018

---

# Clone users from template through API

 *  Resolved [cjsdfw](https://wordpress.org/support/users/cjsdfw/)
 * (@cjsdfw)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/clone-users-from-template-through-api/)
 * Hi,
    First of all thanks for your wonderful plugin.
 * I am getting a strange behavior when cloning from a template through the API 
   and want to find out if is expected behavior or not:
 * If I clone from template using the NS Cloner GUI the new cloned site includes
   the user defined in the template: in my case is the super admin.
 * However, I clone a site using the same template from the API: making the call
   from within another plugin, then the user is not cloned or is deleted (no way
   for me to tell) but the super admin user is not defined in the new site.
 * I am using the Free version, in case it makes a difference. Also it seems to 
   me this just stated happening as off Version 3.1.0 though I am not sure as I 
   don’t have the previous install available.
 * Please advice. Thanks ahead for your reply.
    Carlos
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fclone-users-from-template-through-api%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/clone-users-from-template-through-api/#post-10752005)
 * Hello! Thanks for the feedback and the question. Whether it’s called from the
   GUI or from custom code running in another plugin the Cloner’s ns_wp_create_site()
   function which is part of the default core create_site step calls the wp_get_current_user()
   in order to pass that to WP’s wpmu_validate_blog_signup() function. The only 
   thing I can think of is that for some reason wp_get_current_user() might not 
   be able to get the current user during the context in which it’s running. Otherwise,
   the Cloner’s behavior between GUI and remote call should be identical in most
   cases unless something else interfere’s with the standard WP functions it relies
   on like wp_get_current_user().
 * It’s important to note that the Free version will NOT copy users. So, if there’s
   an admin / super admin on the source site and the Cloner is called remotely as
   a different user, only the different user will be added to the new site. This
   is expected behavior.
 * Also, if you are calling Cloner remotely from a non-user context like wp-cron
   or some other automated method, it’s possible that no user will be added to the
   new clone site which is also expected.
 * Hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘Clone users from template through API’ is closed to new replies.

 * ![](https://ps.w.org/ns-cloner-site-copier/assets/icon-256x256.gif?rev=2323308)
 * [NS Cloner - Site Copier](https://wordpress.org/plugins/ns-cloner-site-copier/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ns-cloner-site-copier/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ns-cloner-site-copier/)
 * [Active Topics](https://wordpress.org/support/plugin/ns-cloner-site-copier/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ns-cloner-site-copier/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ns-cloner-site-copier/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * 1 reply
 * 2 participants
 * Last reply from: [Never Settle](https://wordpress.org/support/users/neversettle/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/clone-users-from-template-through-api/#post-10752005)
 * Status: resolved