Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
populate_roles_160 example
// Clear expired transients.
delete_expired_transients
(
true
)
;
}
/** * Execute WordPress role creation for the various WordPress versions. * * @since 2.0.0 */
function
populate_roles
(
)
{
populate_roles_160
(
)
;
populate_roles_210
(
)
;
populate_roles_230
(
)
;
populate_roles_250
(
)
;
populate_roles_260
(
)
;
populate_roles_270
(
)
;
populate_roles_280
(
)
;
populate_roles_300
(
)
;
}
/** * Create the roles for WordPress 2.0 * * @since 2.0.0 */
function
upgrade_160
(
)
{
global
$wpdb
,
$wp_current_db_version
;
populate_roles_160
(
)
;
$users
=
$wpdb
->
get_results
(
"SELECT * FROM
$wpdb
->users"
)
;
foreach
(
$users
as
$user
)
:
if
(
!
empty
(
$user
->user_firstname
)
)
{
update_user_meta
(
$user
->ID, 'first_name',
wp_slash
(
$user
->user_firstname
)
)
;
}
if
(
!
empty
(
$user
->user_lastname
)
)
{
update_user_meta
(
$user
->ID, 'last_name',
wp_slash
(
$user
->user_lastname
)
)
;
}
if
(
!
empty
(
$user
->user_nickname
)
)
{
update_user_meta
(
$user
->ID, 'nickname',
wp_slash
(
$user
->user_nickname
)
)
;
}