如何使用profile_save_profile?Drupal 6:以编程方式更改用户值
foreach ($users as $user) { //list of users to act on
$by_user = views_get_view_result('attendance', 'page_3', array($user->uid)); //view containing info about this user
$edit = array('profile_attendance_short_term' => substr(count($by_user)/count($general), 0, 5)); //calculation
profile_save_profile($edit, $user->uid, 'Fencing Information', TRUE); //update user profile???
}
我在做什么错?
编辑:这也将失败:
$edit = array('profile_attendance_short_term' => 9001);
profile_save_profile($edit, user_load(3), 'Fencing Information', TRUE);
是发生在$计算编辑分配线工作正常(没有除零或类似的东西)?你能分享错误讯息吗? – 2009-08-18 12:44:07
计算打印0和1之间的数字。没有错误消息。它曾经说“你只能通过引用传递变量”,我通过直接使用变量$ edit而不是array()来解决这个问题。 – 2009-08-18 16:07:09