Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function _myplugin_user_edit_user_page()
- {
- global $wpdb;
- $table_name = 'myplugin_users';
- if(isset($_GET['operation'])){
- if($_GET['operation'] == 'delete'){
- $wpdb->delete( $table_name, array( 'myplugin_user_id' => $_GET['id']) );
- }
- }
- }
- public function _myplugin_user_registration()
- {
- global $wpdb;
- $table_name = 'myplugin_users';
- if( get_option('myplugin_user_option_name') != null){
- $myplugin_user_name = get_option('myplugin_user_option_name')['myplugin_user_first_name'];
- $myplugin_user_first_name = get_option('myplugin_user_option_name')['myplugin_user_first_name'];
- $myplugin_user_last_name = get_option('myplugin_user_option_name')['myplugin_user_last_name'];
- $myplugin_user_email = get_option('myplugin_user_option_name')['myplugin_user_email'];
- $random_password = wp_hash_password( wp_generate_password( $length=12, $include_standard_special_chars=false ) );
- $get_user = $wpdb->get_results('SELECT myplugin_user_login FROM myplugin_users WHERE myplugin_user_email="' . $myplugin_user_email . '" LIMIT 1', ARRAY_A);
- $user_exist = array_column($get_user, 'myplugin_user_login');
- if( !in_array($myplugin_user_name, $user_exist) ){
- $wpdb->insert(
- $table_name,
- array(
- 'myplugin_user_login' => $myplugin_user_name,
- 'myplugin_user_first_name' => $myplugin_user_first_name,
- 'myplugin_user_last_name' => $myplugin_user_last_name,
- 'myplugin_user_pass' => $random_password,
- 'myplugin_user_nice_name' => $myplugin_user_name,
- 'myplugin_user_email' => $myplugin_user_email,
- 'myplugin_user_url' => null,
- 'myplugin_user_registrated' => current_time( 'mysql' ),
- 'myplugin_user_activation_key' => null,
- 'myplugin_user_status' => 0,
- 'myplugin_display_name' => $myplugin_user_name
- )
- );
- }
- } else {
- $user_error_msg['_myplugin_existing_user_email'] = 'The user is already registered!';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement