开发者

Plugin to create new user (Upon plugin activation)

开发者 https://www.devze.com 2023-03-13 11:05 出处:网络
I am trying to use the function reference wp_insert_user (as documented here http://codex.wordpress.org/Function_Reference/wp_insert_user#Usage) to create a new user account when the plugin is run.

I am trying to use the function reference wp_insert_user (as documented here http://codex.wordpress.org/Function_Reference/wp_insert_user#Usage) to create a new user account when the plugin is run.

How do I specify what privledges the account has as well as the login name / pass?

My plugin code currently looks like this:

http://oi51.tinypic.com/i74i8w.jpg

UPDATE

I tried to test the plugin as is , and at the moment it doesn't create the account.

At first, it broke WordPress and would cause none of the pages (even admin panel) not to load.

I added the function myplugin_activate() line and since then it doesnt break WordPress.

Anyone开发者_开发百科 have any insight on getting the account created upon activation?


Well, the link you have posted contains information about how to specify login, password and so on :) just look at the notes section, all possible options are listed.

User is not created because your function is not called, simple as that. You need to register a hook. Add this line before ?> :

register_activation_hook( __FILE__ ,'myplugin_activate');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号