mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
Changes to user profile pages to edit/display interest tags
This commit is contained in:
parent
d5581d97d8
commit
1e1c51a3b7
@ -35,6 +35,12 @@
|
||||
error('User ID was incorrect');
|
||||
}
|
||||
|
||||
//user interests separated by commas
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
$user->interests = tag_names_csv(get_item_tags('user',$userid));
|
||||
}
|
||||
|
||||
// remote users cannot be edited
|
||||
if (is_mnet_remote_user($user)) {
|
||||
redirect($CFG->wwwroot . "/user/view.php?course={$course->id}");
|
||||
@ -65,11 +71,13 @@
|
||||
//Load custom profile fields data
|
||||
profile_load_data($user);
|
||||
|
||||
|
||||
//create form
|
||||
$userform = new user_edit_form();
|
||||
$userform->set_data($user);
|
||||
|
||||
if ($usernew = $userform->get_data()) {
|
||||
|
||||
add_to_log($course->id, 'user', 'update', "view.php?id=$user->id&course=$course->id", '');
|
||||
|
||||
$authplugin = get_auth_plugin($user->auth);
|
||||
@ -90,7 +98,12 @@
|
||||
|
||||
//update preferences
|
||||
useredit_update_user_preference($usernew);
|
||||
|
||||
|
||||
//update interests
|
||||
if (!empty($CFG->usetags)) {
|
||||
useredit_update_interests($usernew, $usernew->interests);
|
||||
}
|
||||
|
||||
//update user picture
|
||||
if (!empty($CFG->gdversion) and empty($CFG->disableuserimages)) {
|
||||
useredit_update_picture($usernew, $userform);
|
||||
|
@ -52,6 +52,12 @@
|
||||
//Load custom profile fields data
|
||||
profile_load_data($user);
|
||||
|
||||
//user interests separated by commas
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
$user->interests = tag_names_csv(get_item_tags('user',$userid));
|
||||
}
|
||||
|
||||
//create form
|
||||
$userform = new user_editadvanced_form();
|
||||
$userform->set_data($user);
|
||||
@ -108,6 +114,11 @@
|
||||
//update preferences
|
||||
useredit_update_user_preference($usernew);
|
||||
|
||||
// update tags
|
||||
if (!empty($CFG->usetags)) {
|
||||
useredit_update_interests($usernew, $usernew->interests);
|
||||
}
|
||||
|
||||
//update user picture
|
||||
if (!empty($CFG->gdversion)) {
|
||||
useredit_update_picture($usernew, $userform);
|
||||
@ -116,7 +127,7 @@
|
||||
// update mail bounces
|
||||
useredit_update_bounces($user, $usernew);
|
||||
|
||||
/// update forum track preference
|
||||
// update forum track preference
|
||||
useredit_update_trackforums($user, $usernew);
|
||||
|
||||
// save custom profile fields data
|
||||
|
@ -54,6 +54,11 @@ function useredit_update_trackforums($user, $usernew) {
|
||||
}
|
||||
}
|
||||
|
||||
function useredit_update_interests($user, $cvs_tag_names)
|
||||
{
|
||||
update_item_tags('user', $user->id, $cvs_tag_names);
|
||||
}
|
||||
|
||||
function useredit_shared_definition(&$mform) {
|
||||
global $CFG;
|
||||
|
||||
@ -216,6 +221,12 @@ function useredit_shared_definition(&$mform) {
|
||||
|
||||
}
|
||||
|
||||
if( !empty($CFG->usetags)) {
|
||||
$mform->addElement('header', 'moodle_interests', get_string('interests'));
|
||||
$mform->addElement('static', 'helptextinterests', '' , get_string('enteryourinterests'));
|
||||
$mform->addElement('textarea', 'interests', get_string('interests'), 'cols="45" rows="3"');
|
||||
}
|
||||
|
||||
/// Moodle optional fields
|
||||
$mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
|
||||
$mform->setAdvanced('moodle_optional');
|
||||
@ -255,6 +266,8 @@ function useredit_shared_definition(&$mform) {
|
||||
|
||||
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
|
||||
$mform->setType('address', PARAM_MULTILANG);
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
require_once("../config.php");
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT); // user id
|
||||
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
|
||||
$enable = optional_param('enable', ''); // enable email
|
||||
@ -371,6 +373,18 @@
|
||||
}
|
||||
/// End of printing groups
|
||||
|
||||
/// Printing Interests
|
||||
if( !empty($CFG->usetags)) {
|
||||
$interests = get_item_tags('user', $user->id);
|
||||
|
||||
$instereststr = tag_links_csv($interests);
|
||||
|
||||
if ($interests) {
|
||||
print_row(get_string('interests').": ",rtrim($instereststr));
|
||||
}
|
||||
}
|
||||
/// End of Printing Interests
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "</td></tr></table>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user