谢谢你的Bainternet代码
如果有人想更新我快速破解的所有用户,那么你可以检查多个用户并更改他们的角色,然后再更改回来,你就可以更新所有的配置文件
add_action( \'set_user_role\', function( $user_id, $role, $old_roles)
{
$user_added = get_userdata( $user_id );
// foreach($user_id as $user) {
if ($role != $old_roles) {
$args = array(
\'post_type\' => \'user_profile_page\',
\'author\' => $user_id,
);
$posts = get_posts($args);
if (!$posts) {
$profile_page = wp_insert_post(array(
\'post_title\' => $user_added->user_login.\'Profile\', // Text only to Map those page @ admin
\'post_type\' => "user_profile_page", // Custom Post type which you have created
\'post_status\' => \'publish\',
\'post_author\' => $user_id,
));
/**
* Save the Profile Page id into the user meta
*/
if (!is_wp_error($profile_page))
add_user_meta($user_id, \'user_profile_page\', $profile_page, TRUE);
}
}
// }
}, 10, 3 );