"MDL-17143, don't display the user description at all when user isn't enrolled in any courses, backported to 1.6"

This commit is contained in:
dongsheng
2008-11-18 02:49:39 +00:00
parent ebad4013c8
commit e45607b491
7 changed files with 27 additions and 4 deletions
+3
View File
@@ -461,6 +461,9 @@ class configvarrss extends configvar {
$security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
/// profilesforenrolledusersonly
$security['profilesforenrolledusersonly'] = new configvar (get_string('configprofilesforenrolledusersonly', 'admin'), choose_from_menu ($noyesoptions, 'profilesforenrolledusersonly', $CFG->profilesforenrolledusersonly, '', '', '', true) );
/// runclamonupload
$security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
+1
View File
@@ -221,6 +221,7 @@ $string['pleaseregister'] = 'Please register your site to remove this button';
$string['pgcluster'] = 'PostgreSQL Cluster';
$string['pgclusterdescription'] = 'PostgreSQL version/cluster parameter for command line operations. If you only have one postgresql on your system or you are not sure what this is, leave this blank.';
$string['php50restricted'] = 'PHP 5.0.x has a number of known problems, please upgrade to 5.1.x or downgrade to 4.3.x or 4.4.x';
$string['configprofilesforenrolledusersonly'] = 'To prevent misuse by spammers, profile descriptions of users who are not yet enrolled in any course are hidden. New users must enrol in at least one course before they can add a profile description.';
$string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from the list below, copy them to your $a directory and unzip them manually.';
$string['serverchecks'] = 'Server Checks';
$string['sitelangchanged'] = 'Site language setting changed successfully';
+1
View File
@@ -1028,6 +1028,7 @@ $string['previewhtml'] = 'HTML Format Preview';
$string['previeworchoose'] = 'Preview or choose a theme';
$string['previous'] = 'Previous';
$string['profile'] = 'Profile';
$string['profilenotshown'] = 'This profile description will not be shown until this person is enrolled in at least one course.';
$string['publicdirectory'] = 'Public directory';
$string['publicdirectory0'] = 'Please do not publish this site';
$string['publicdirectory1'] = 'Publish the site name only';
+9
View File
@@ -251,6 +251,12 @@ if (isadmin()) {
</td>
</tr>
<?php } ?>
<?php
$can_edit_user = isadmin();
if (empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !record_exists('user_students', 'userid', $userid)&& !record_exists('user_teachers', 'userid', $userid) && !$can_edit_user) {
// prevent user editing description
} else {
?>
<tr>
<th><?php print_string("userdescription") ?>:</th>
<td><?php
@@ -263,6 +269,9 @@ if (isadmin()) {
?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" style="text-align: center;"><input type="submit" value="<?php print_string("updatemyprofile") ?>" /></td>
</tr>
+3 -2
View File
@@ -427,8 +427,9 @@ function find_form_errors(&$user, &$usernew, &$err, &$um) {
if (over_bounce_threshold($user) && $user->email == $usernew->email)
$err['email'] = get_string('toomanybounces');
if (empty($usernew->description) and !isadmin())
$err["description"] = get_string("missingdescription");
if (empty($usernew->description) and !isadmin()) {
//$err["description"] = get_string("missingdescription");
}
if (empty($usernew->city))
$err["city"] = get_string("missingcity");
+9 -1
View File
@@ -136,8 +136,16 @@
// Print the description
var_dump($CFG->profilesforenrolledusersonly);
if ($user->description && !isset($hiddenfields['description'])) {
echo format_text($user->description, FORMAT_MOODLE)."<hr />";
$has_courseid = ($course->id != SITEID);
if (!$has_courseid && !empty($CFG->profilesforenrolledusersonly)
&& !record_exists('user_students', 'userid', $id)
&& !record_exists('user_teachers', 'userid', $id)) {
echo get_string('profilenotshown', 'moodle').'<hr />';
} else {
echo format_text($user->description, FORMAT_MOODLE)."<hr />";
}
}
// Print all the little details in a list
+1 -1
View File
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2006050580; // YYYYMMDD = date of the 1.6 branch (don't change)
$version = 2006050581; // YYYYMMDD = date of the 1.6 branch (don't change)
// X = release number 1.6.[0,1,2,3...]
// Y = micro-increments between releases