PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
	All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
 [Pro User] Issue/Bug with Free Registration using Pro Forms
 [Pro User] Issue/Bug with Free Registration using Pro Forms










<?php
add_action ("init", "s2_fix_user_names");
function s2_fix_user_names ()
    {
        if (!empty ($_GET[__FUNCTION__]))
            {
                foreach (get_users () as $user)
                    {
                        if (($user = new WP_User ($user->ID)) && !$user->first_name && !$user->last_name && $user->display_name)
                            {
                                list ($first_name, $last_name) = preg_split ("/ +/", $user->display_name, 2);
                                wp_update_user (array ("ID" => $user->ID, "first_name" => $first_name, "last_name" => $last_name));
                            }
                    }
                exit ("All fixed!");
            }
    }
?>http://yoursite.com/?s2_fix_user_names=yes



















<?php
add_action ("init", "s2_fix_user_names");
function s2_fix_user_names ()
    {
        if (!empty ($_GET[__FUNCTION__]))
            {
                foreach (get_users () as $user)
                    {
                        if (($user = new WP_User ($user->ID)))
                            {
                                if (!$user->first_name && !$user->last_name && $user->display_name)
                                    {
                                        list ($first_name, $last_name) = preg_split ("/ +/", $user->display_name, 2);
                                        wp_update_user(array ("ID" => $user->ID, "first_name" => $first_name, "last_name" => $last_name));
                                        echo 'Updated User ID: ' . $user->ID . ' First Name: ' . $first_name . ', Last Name: ' . (($last_name) ? $last_name : '[empty]') . '<br />';
                                    }
                                else if ($user->first_name || $user->last_name)
                                    echo 'Skipping User ID: ' . $user->ID . '. User already has a First and/or Last name recorded.<br />';
                                /**/
                                else if (!$user->display_name)
                                    echo 'Skipping User ID: ' . $user->ID . '. User has no Display name on record, unable to parse.<br />';
                            }
                    }
                exit("All fixed!");
            }
    }
?>



Users browsing this forum: Yahoo [Bot] and 0 guests