• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP useredit_update_interests函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中useredit_update_interests函数的典型用法代码示例。如果您正苦于以下问题:PHP useredit_update_interests函数的具体用法?PHP useredit_update_interests怎么用?PHP useredit_update_interests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了useredit_update_interests函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: file_postupdate_standard_editor

 // Description editor element may not exist!
 if (isset($usernew->description_editor) && isset($usernew->description_editor['format'])) {
     $usernew = file_postupdate_standard_editor($usernew, 'description', $editoroptions, $personalcontext, 'user', 'profile', 0);
 }
 // Pass a true old $user here.
 if (!$authplugin->user_update($user, $usernew)) {
     // Auth update failed.
     print_error('cannotupdateprofile');
 }
 // Update user with new profile data.
 user_update_user($usernew, false, false);
 // Update preferences.
 useredit_update_user_preference($usernew);
 // Update interests.
 if (isset($usernew->interests)) {
     useredit_update_interests($usernew, $usernew->interests);
 }
 // Update user picture.
 if (empty($CFG->disableuserimages)) {
     useredit_update_picture($usernew, $userform, $filemanageroptions);
 }
 // Update mail bounces.
 useredit_update_bounces($user, $usernew);
 // Update forum track preference.
 useredit_update_trackforums($user, $usernew);
 // Save custom profile fields data.
 profile_save_data($usernew);
 // Trigger event.
 \core\event\user_updated::create_from_userid($user->id)->trigger();
 // If email was changed and confirmation is required, send confirmation email now to the new address.
 if ($emailchanged && $CFG->emailchangeconfirmation) {
开发者ID:ket-ed,项目名称:ketmoodle-core-changes,代码行数:31,代码来源:edit.php


示例2: useredit_update_interests

     // Trigger event.
     \core\event\user_created::create_from_userid($user->id)->trigger();
     $upt->track('status', $struseradded);
     $upt->track('id', $user->id, 'normal', false);
     $usersnew++;
     // make sure user context exists
     context_user::instance($user->id);
     if ($bulk == UU_BULK_NEW or $bulk == UU_BULK_ALL) {
         if (!in_array($user->id, $SESSION->bulk_users)) {
             $SESSION->bulk_users[] = $user->id;
         }
     }
 }
 // Update user interests.
 if (isset($user->interests) && strval($user->interests) !== '') {
     useredit_update_interests($user, preg_split('/\\s*,\\s*/', $user->interests, -1, PREG_SPLIT_NO_EMPTY));
 }
 // add to cohort first, it might trigger enrolments indirectly - do NOT create cohorts here!
 foreach ($filecolumns as $column) {
     if (!preg_match('/^cohort\\d+$/', $column)) {
         continue;
     }
     if (!empty($user->{$column})) {
         $addcohort = $user->{$column};
         if (!isset($cohorts[$addcohort])) {
             if (is_number($addcohort)) {
                 // only non-numeric idnumbers!
                 $cohort = $DB->get_record('cohort', array('id' => $addcohort));
             } else {
                 $cohort = $DB->get_record('cohort', array('idnumber' => $addcohort));
                 if (empty($cohort) && has_capability('moodle/cohort:manage', context_system::instance())) {
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:index.php


示例3: create_user


//.........这里部分代码省略.........
             $record['firstname'] = 'Firstname' . $i;
         } else {
             if (!isset($record['lastname'])) {
                 $record['lastname'] = 'Lastname' . $i;
             }
         }
     }
     if (!isset($record['firstnamephonetic'])) {
         $firstnamephonetic = rand(0, 59);
         $record['firstnamephonetic'] = $this->firstnames[$firstnamephonetic];
     }
     if (!isset($record['lastnamephonetic'])) {
         $lastnamephonetic = rand(0, 59);
         $record['lastnamephonetic'] = $this->lastnames[$lastnamephonetic];
     }
     if (!isset($record['middlename'])) {
         $middlename = rand(0, 59);
         $record['middlename'] = $this->firstnames[$middlename];
     }
     if (!isset($record['alternatename'])) {
         $alternatename = rand(0, 59);
         $record['alternatename'] = $this->firstnames[$alternatename];
     }
     if (!isset($record['idnumber'])) {
         $record['idnumber'] = '';
     }
     if (!isset($record['mnethostid'])) {
         $record['mnethostid'] = $CFG->mnet_localhost_id;
     }
     if (!isset($record['username'])) {
         $record['username'] = 'username' . $i;
         $j = 2;
         while ($DB->record_exists('user', array('username' => $record['username'], 'mnethostid' => $record['mnethostid']))) {
             $record['username'] = 'username' . $i . '_' . $j;
             $j++;
         }
     }
     if (isset($record['password'])) {
         $record['password'] = hash_internal_user_password($record['password']);
     } else {
         // The auth plugin may not fully support this,
         // but it is still better/faster than hashing random stuff.
         $record['password'] = AUTH_PASSWORD_NOT_CACHED;
     }
     if (!isset($record['email'])) {
         $record['email'] = $record['username'] . '@example.com';
     }
     if (!isset($record['confirmed'])) {
         $record['confirmed'] = 1;
     }
     if (!isset($record['lang'])) {
         $record['lang'] = 'en';
     }
     if (!isset($record['maildisplay'])) {
         $record['maildisplay'] = $CFG->defaultpreference_maildisplay;
     }
     if (!isset($record['mailformat'])) {
         $record['mailformat'] = $CFG->defaultpreference_mailformat;
     }
     if (!isset($record['maildigest'])) {
         $record['maildigest'] = $CFG->defaultpreference_maildigest;
     }
     if (!isset($record['autosubscribe'])) {
         $record['autosubscribe'] = $CFG->defaultpreference_autosubscribe;
     }
     if (!isset($record['trackforums'])) {
         $record['trackforums'] = $CFG->defaultpreference_trackforums;
     }
     if (!isset($record['deleted'])) {
         $record['deleted'] = 0;
     }
     if (!isset($record['timecreated'])) {
         $record['timecreated'] = time();
     }
     $record['timemodified'] = $record['timecreated'];
     $record['lastip'] = '0.0.0.0';
     if ($record['deleted']) {
         $delname = $record['email'] . '.' . time();
         while ($DB->record_exists('user', array('username' => $delname))) {
             $delname++;
         }
         $record['idnumber'] = '';
         $record['email'] = md5($record['username']);
         $record['username'] = $delname;
         $record['picture'] = 0;
     }
     $userid = $DB->insert_record('user', $record);
     if (!$record['deleted']) {
         context_user::instance($userid);
     }
     $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
     if (!$record['deleted'] && isset($record['interests'])) {
         require_once $CFG->dirroot . '/user/editlib.php';
         if (!is_array($record['interests'])) {
             $record['interests'] = preg_split('/\\s*,\\s*/', trim($record['interests']), -1, PREG_SPLIT_NO_EMPTY);
         }
         useredit_update_interests($user, $record['interests']);
     }
     return $user;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:101,代码来源:data_generator.php


示例4: test_get_users_by_id

    /**
     * Test get_users_by_id
     */
    public function test_get_users_by_id() {
        global $USER, $CFG;

        $this->resetAfterTest(true);

        $user1 = array(
            'username' => 'usernametest1',
            'idnumber' => 'idnumbertest1',
            'firstname' => 'First Name User Test 1',
            'lastname' => 'Last Name User Test 1',
            'email' => '[email protected]',
            'address' => '2 Test Street Perth 6000 WA',
            'phone1' => '01010101010',
            'phone2' => '02020203',
            'icq' => 'testuser1',
            'skype' => 'testuser1',
            'yahoo' => 'testuser1',
            'aim' => 'testuser1',
            'msn' => 'testuser1',
            'department' => 'Department of user 1',
            'institution' => 'Institution of user 1',
            'description' => 'This is a description for user 1',
            'descriptionformat' => FORMAT_MOODLE,
            'city' => 'Perth',
            'url' => 'http://moodle.org',
            'country' => 'au'
            );
        $user1 = self::getDataGenerator()->create_user($user1);
        if (!empty($CFG->usetags)) {
            require_once($CFG->dirroot . '/user/editlib.php');
            require_once($CFG->dirroot . '/tag/lib.php');
            $user1->interests = array('Cinema', 'Tennis', 'Dance', 'Guitar', 'Cooking');
            useredit_update_interests($user1, $user1->interests);
        }
        $user2 = self::getDataGenerator()->create_user();

        $context = context_system::instance();
        $roleid = $this->assignUserCapability('moodle/user:viewdetails', $context->id);

        // Call the external function.
        $returnedusers = core_user_external::get_users_by_id(array(
                    $USER->id, $user1->id, $user2->id));

        // We need to execute the return values cleaning process to simulate the web service server.
        $returnedusers = external_api::clean_returnvalue(core_user_external::get_users_by_id_returns(), $returnedusers);

        // Check we retrieve the good total number of enrolled users + no error on capability.
        $this->assertEquals(3, count($returnedusers));

        // Do the same call as admin to receive all possible fields.
        $this->setAdminUser();
        $USER->email = "[email protected]";

        // Call the external function.
        $returnedusers = core_user_external::get_users_by_id(array(
                    $USER->id, $user1->id, $user2->id));

        // We need to execute the return values cleaning process to simulate the web service server.
        $returnedusers = external_api::clean_returnvalue(core_user_external::get_users_by_id_returns(), $returnedusers);

        foreach($returnedusers as $enrolleduser) {
            if ($enrolleduser['username'] == $user1->username) {
                $this->assertEquals($user1->idnumber, $enrolleduser['idnumber']);
                $this->assertEquals($user1->firstname, $enrolleduser['firstname']);
                $this->assertEquals($user1->lastname, $enrolleduser['lastname']);
                $this->assertEquals($user1->email, $enrolleduser['email']);
                $this->assertEquals($user1->address, $enrolleduser['address']);
                $this->assertEquals($user1->phone1, $enrolleduser['phone1']);
                $this->assertEquals($user1->phone2, $enrolleduser['phone2']);
                $this->assertEquals($user1->icq, $enrolleduser['icq']);
                $this->assertEquals($user1->skype, $enrolleduser['skype']);
                $this->assertEquals($user1->yahoo, $enrolleduser['yahoo']);
                $this->assertEquals($user1->aim, $enrolleduser['aim']);
                $this->assertEquals($user1->msn, $enrolleduser['msn']);
                $this->assertEquals($user1->department, $enrolleduser['department']);
                $this->assertEquals($user1->institution, $enrolleduser['institution']);
                $this->assertEquals($user1->description, $enrolleduser['description']);
                $this->assertEquals(FORMAT_HTML, $enrolleduser['descriptionformat']);
                $this->assertEquals($user1->city, $enrolleduser['city']);
                $this->assertEquals($user1->country, $enrolleduser['country']);
                $this->assertEquals($user1->url, $enrolleduser['url']);
                if (!empty($CFG->usetags)) {
                    $this->assertEquals(implode(', ', $user1->interests), $enrolleduser['interests']);
                }
            }
        }
    }
开发者ID:verbazend,项目名称:AWFA,代码行数:90,代码来源:externallib_test.php


示例5: get_course_user_profiles_setup

 public function get_course_user_profiles_setup($capability)
 {
     global $USER, $CFG;
     $this->resetAfterTest(true);
     $return = new stdClass();
     // Create the course and fetch its context.
     $return->course = self::getDataGenerator()->create_course();
     $return->user1 = array('username' => 'usernametest1', 'idnumber' => 'idnumbertest1', 'firstname' => 'First Name User Test 1', 'lastname' => 'Last Name User Test 1', 'email' => '[email protected]', 'address' => '2 Test Street Perth 6000 WA', 'phone1' => '01010101010', 'phone2' => '02020203', 'icq' => 'testuser1', 'skype' => 'testuser1', 'yahoo' => 'testuser1', 'aim' => 'testuser1', 'msn' => 'testuser1', 'department' => 'Department of user 1', 'institution' => 'Institution of user 1', 'description' => 'This is a description for user 1', 'descriptionformat' => FORMAT_MOODLE, 'city' => 'Perth', 'url' => 'http://moodle.org', 'country' => 'AU');
     $return->user1 = self::getDataGenerator()->create_user($return->user1);
     if (!empty($CFG->usetags)) {
         require_once $CFG->dirroot . '/user/editlib.php';
         $return->user1->interests = array('Cinema', 'Tennis', 'Dance', 'Guitar', 'Cooking');
         useredit_update_interests($return->user1, $return->user1->interests);
     }
     $return->user2 = self::getDataGenerator()->create_user();
     $context = context_course::instance($return->course->id);
     $return->roleid = $this->assignUserCapability($capability, $context->id);
     // Enrol the users in the course.
     $this->getDataGenerator()->enrol_user($return->user1->id, $return->course->id, $return->roleid, 'manual');
     $this->getDataGenerator()->enrol_user($return->user2->id, $return->course->id, $return->roleid, 'manual');
     $this->getDataGenerator()->enrol_user($USER->id, $return->course->id, $return->roleid, 'manual');
     return $return;
 }
开发者ID:dg711,项目名称:moodle,代码行数:23,代码来源:externallib_test.php



注:本文中的useredit_update_interests函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP useredit_update_picture函数代码示例发布时间:2022-05-23
下一篇:
PHP useredit_shared_definition函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap