Tag Info

New answers tagged

3

The short answer is that you can't force people to register a plugin. Because it's written in PHP, anyone with a modicum of PHP knowledge can get into the code and bypass any checks you put in there. That being said, there are three routes you can take to monetize it: Move some of the critical functionality to an external server. Users have to register to ...


0

Add this in functions.php This will automatically add a custom field to a user when they register on your site with a key of: user_registration_no add_action('user_register', 'add_user_registration_number'); function add_user_registration_number ($user_id) { $reg_number = date('y').date('m').'SY'.'0'.$user_id; ...


2

Instead of using wp_mail filter use action user_register: function fpw_new_user_post( $user_id ) { global $wpdb; update_user_meta( $user_id, $wpdb->base_prefix . 'capabilities', array( 'author' => TRUE ) ); $new_post = array ( 'post_title' => 'User ' . get_user_by( 'id', $user_id )->user_login . ' registered @ ' . date( ...


0

The hooks are important, no matter how we sorted form fields inside the function. Follow my inline comments. As of WordPress 4.2.2 we have plenty of hooks now: <?php /** * Declaring the form fields */ function show_my_fields( $user ) { $fetched_field = get_user_meta( $user->ID, 'my_field', true ); ?> <tr class="form-field"> ...


1

There might be more elegant way to do it, but from quick look at the code it seems quite easy to simply override the relevant option on login page: add_action( 'login_init', function () { add_action( 'pre_option_users_can_register', '__return_null' ); } );


0

The problem was not related at all with my plugin or with any kind of coding mistakes. When using W3 Total Cache the Database Cache seems to remove some data sent to functions, so the information about the username and password were not sent to the function causing the email to the user not to be sent (because there was no password given to the function) ...


0

I might be wrong but I think wp_insert_user function doesn't call wp_new_user_notification function. As your edit you need to call this function manually. As you are testing your plugin in a live site I presume the error reporting is turned off and hence you are not getting any error. if (empty($errors)) { $myplugin_newuser = wp_insert_user(array( ...



Top 50 recent answers are included