blog / tags: MDL-17900 Use the new tags field type to tag users' interests.
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@
|
||||
// User interests separated by commas
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
$user->interests = tag_get_tags_csv('user', $user->id, TAG_RETURN_TEXT);
|
||||
$user->interests = tag_get_tags_array('user', $id);
|
||||
}
|
||||
|
||||
// remote users cannot be edited
|
||||
|
||||
@@ -67,10 +67,10 @@
|
||||
//Load custom profile fields data
|
||||
profile_load_data($user);
|
||||
|
||||
//user interests separated by commas
|
||||
//User interests
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
$user->interests = tag_get_tags_csv('user', $id, TAG_RETURN_TEXT); // formslib uses htmlentities itself
|
||||
$user->interests = tag_get_tags_array('user', $id);
|
||||
}
|
||||
|
||||
//create form
|
||||
|
||||
+5
-6
@@ -70,8 +70,8 @@ function useredit_update_trackforums($user, $usernew) {
|
||||
}
|
||||
}
|
||||
|
||||
function useredit_update_interests($user, $csv_tag_names) {
|
||||
tag_set('user', $user->id, explode(',', $csv_tag_names));
|
||||
function useredit_update_interests($user, $interests) {
|
||||
tag_set('user', $user->id, $interests);
|
||||
}
|
||||
|
||||
function useredit_shared_definition(&$mform) {
|
||||
@@ -248,11 +248,10 @@ function useredit_shared_definition(&$mform) {
|
||||
|
||||
}
|
||||
|
||||
if ( !empty($CFG->usetags) && has_capability('moodle/tag:create', get_context_instance(CONTEXT_SYSTEM)) ) {
|
||||
if (!empty($CFG->usetags)) {
|
||||
$mform->addElement('header', 'moodle_interests', get_string('interests'));
|
||||
$mform->addElement('textarea', 'interests', get_string('interestslist'), 'cols="45" rows="3"');
|
||||
$mform->setHelpButton('interests', array('interestslist', get_string('helpinterestslist'),
|
||||
false, true, false));
|
||||
$mform->addElement('tags', 'interests', get_string('interestslist'), array('display' => 'noofficial'));
|
||||
$mform->setHelpButton('interests', array('interestslist', get_string('helpinterestslist'), false, true, false));
|
||||
}
|
||||
|
||||
/// Moodle optional fields
|
||||
|
||||
Reference in New Issue
Block a user