Issue Details (XML | Word | Printable)

Key: MDL-17143
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dongsheng Cai
Reporter: Martin Dougiamas
Votes: 2
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-17107

Don't display the user description at all when user isn't enrolled in any courses

Created: 06/Nov/08 01:01 PM   Updated: 17/Feb/09 10:46 AM
Return to search
Component/s: Administration
Affects Version/s: 1.9.3
Fix Version/s: 1.6.9, 1.7.7, 1.8.8, 1.9.4

File Attachments: 1. Text File MDL-17143.patch (7 kB)

Issue Links:
Relates
 

Participants: Dongsheng Cai, Eloy Lafuente (stronk7), Helen Foster, Jerome Mouneyrac, Martin Dougiamas and Petr Skoda
Security Level: None
QA Assignee: Jerome Mouneyrac
Difficulty: Easy
Resolved date: 19/Nov/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
1. Add a new config variable profilesforenrolledusersonly = true (by default)

2. When showing the profile page, if a courseid isn't defined (this is the public view) AND the user is not enrolled in any courses AND profilesforenrolledusersonly = true then replace the profile description with something like "This profile description will not be shown until this person is enrolled in at least one course".

3. When editing the profile page, if the description is blank AND the user is not enrolled in any courses AND profilesforenrolledusersonly = true then completely hide the description field from the editing page.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas made changes - 07/Nov/08 02:35 PM
Field Original Value New Value
Assignee Martin Dougiamas [ dougiamas ] Dongsheng Cai [ dongsheng ]
Dongsheng Cai added a comment - 10/Nov/08 11:14 AM
a patch against 1.9

Dongsheng Cai made changes - 10/Nov/08 11:14 AM
Attachment MDL-17143.patch [ 15602 ]
Dongsheng Cai made changes - 10/Nov/08 11:50 AM
Attachment MDL-17143.patch [ 15602 ]
Dongsheng Cai added a comment - 10/Nov/08 11:51 AM
The new patch allows administrators editing description anytime

Dongsheng Cai made changes - 10/Nov/08 11:51 AM
Attachment MDL-17143.patch [ 15605 ]
Dongsheng Cai committed 6 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 10/Nov/08 11:57 AM
"MDL-17143, don't display the user description at all when user isn't enrolled in any courses"
MODIFY lang/en_utf8/moodle.php   Rev. 1.141.2.46    (+2 -1 lines)
MODIFY user/view.php   Rev. 1.168.2.20    (+8 -2 lines)
MODIFY user/edit_form.php   Rev. 1.24.2.6    (+6 -1 lines)
MODIFY user/editadvanced_form.php   Rev. 1.14.2.6    (+8 -1 lines)
MODIFY admin/settings/security.php   Rev. 1.21.2.7    (+4 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.154.2.63    (+6 -0 lines)
Dongsheng Cai committed 6 files to 'Moodle CVS' - 10/Nov/08 12:06 PM
"MDL-17143, don't display the user description at all when user isn't enrolled in any courses, merged and modified from 1.9"
MODIFY admin/settings/security.php   Rev. 1.31    (+4 -1 lines)
MODIFY user/view.php   Rev. 1.194    (+8 -2 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.238    (+6 -0 lines)
MODIFY user/editadvanced_form.php   Rev. 1.22    (+8 -1 lines)
MODIFY user/edit_form.php   Rev. 1.32    (+7 -1 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.207    (+1 -0 lines)
Dongsheng Cai added a comment - 10/Nov/08 12:07 PM
Committed to 1.9 and HEAD, please review.

Dongsheng Cai added a comment - 10/Nov/08 12:15 PM
Please review.

Dongsheng Cai made changes - 10/Nov/08 12:15 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Petr Skoda added a comment - 11/Nov/08 04:10 PM
you can not use get_record('role_assignments', 'userid', $userid) if there are multiple role assignments - it should some debugging error

instead please use record_exists()


Petr Skoda made changes - 11/Nov/08 04:10 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Petr Skoda added a comment - 11/Nov/08 04:16 PM
also please reorder the if condition so that the record_exists() is executed only when really needed

Mitsuhiro Yoshida committed 3 files to 'Lang CVS' - 11/Nov/08 04:27 PM
MDL-17143 Translated new strings for the user description protection..
MODIFY ja_utf8/moodle.php   Rev. 1.324    (+2 -1 lines)
MODIFY ja_utf8/README   Rev. 1.863    (+1 -1 lines)
MODIFY ja_utf8/admin.php   Rev. 1.314    (+6 -1 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 12/Nov/08 03:31 AM
MDL-17143 Avoid notices caused by not existing profilesforenrolledusersonly setting
MODIFY user/editadvanced_form.php   Rev. 1.14.2.7    (+2 -2 lines)
MODIFY user/view.php   Rev. 1.168.2.21    (+3 -2 lines)
MODIFY user/edit_form.php   Rev. 1.24.2.7    (+2 -2 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 12/Nov/08 03:34 AM
MDL-17143 deleting one line that shouldn't be in core. Sorry.
MODIFY user/view.php   Rev. 1.168.2.22    (+0 -1 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' - 12/Nov/08 03:39 AM
MDL-17143 Avoid notices caused by not existing profilesforenrolledusersonly setting. Merged from 19_STABLE
MODIFY user/editadvanced_form.php   Rev. 1.23    (+2 -2 lines)
MODIFY user/view.php   Rev. 1.195    (+2 -2 lines)
MODIFY user/edit_form.php   Rev. 1.33    (+2 -2 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 12/Nov/08 04:00 AM
MDL-17143 Some improvements suggested by Petr applied.
MODIFY user/editadvanced_form.php   Rev. 1.14.2.8    (+2 -2 lines)
MODIFY user/view.php   Rev. 1.168.2.23    (+1 -2 lines)
MODIFY user/edit_form.php   Rev. 1.24.2.8    (+2 -2 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' - 12/Nov/08 04:06 AM
MDL-17143 Some improvements suggested by Petr applied. Merged from 19_STABLE
MODIFY user/view.php   Rev. 1.196    (+2 -3 lines)
MODIFY user/edit_form.php   Rev. 1.34    (+2 -2 lines)
MODIFY user/editadvanced_form.php   Rev. 1.24    (+2 -2 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 12/Nov/08 04:09 AM
MDL-17143 Bump version to force new profilesforenrolledusersonly setting
MODIFY version.php   Rev. 1.563.2.305    (+1 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 12/Nov/08 04:13 AM
MDL-17143 Bump version to force new profilesforenrolledusersonly setting ; merged from 19_STABLE
MODIFY version.php   Rev. 1.875    (+1 -1 lines)
Eloy Lafuente (stronk7) added a comment - 12/Nov/08 04:19 AM
Oki, I've:
  • Added some empty() checks to avoid some notices about the $CFG->profilesforenrolledusersonly not defined.
  • Changed get_record() to record_exists() and moved it to last condition.
  • Bump 19_STABLE and HEAD versions to force the setting to be displayed/defined.

TODO:

1) I'd fix the setting help text a bit, indicating it's an anti-spam measure in some way. Right now the justification of the setting isn't clear IMO.
2) Add it to the anti SPAM Moodle Docs.
3) Backport from 19_STABLE to 1.8, 1.7 and 1.6

Helen can you take a look to 1 & 2, plz...
Dongsheng can backport it to be ready next weekly?

Thanks everybody!
Thanks and ciao


Dongsheng Cai committed 3 files to 'Moodle CVS' - 12/Nov/08 10:51 AM
"MDL-17143, use record_exists"
MODIFY user/view.php   Rev. 1.197    (+2 -2 lines)
MODIFY user/edit_form.php   Rev. 1.35    (+2 -2 lines)
MODIFY user/editadvanced_form.php   Rev. 1.25    (+2 -2 lines)
Dongsheng Cai committed 6 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 12/Nov/08 11:21 AM
MDL-17143
don't display the user description at all when user isn't enrolled in any courses, backported to 1.8
MODIFY user/view.php   Rev. 1.143.2.25    (+8 -2 lines)
MODIFY user/edit_form.php   Rev. 1.19.2.7    (+8 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.103.2.27    (+7 -1 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.105.2.25    (+2 -1 lines)
MODIFY user/editadvanced_form.php   Rev. 1.6.2.6    (+10 -1 lines)
MODIFY admin/settings/security.php   Rev. 1.13.2.5    (+3 -1 lines)
Dongsheng Cai committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 12/Nov/08 11:24 AM
"MDL-17143, bump version to set new profilesforenrolledusersonly setting"
MODIFY version.php   Rev. 1.425.2.288    (+1 -1 lines)
Dongsheng Cai committed 7 files to 'Moodle CVS' on branch 'MOODLE_17_STABLE' - 12/Nov/08 12:50 PM
MDL-17143
don't display the user description at all when user isn't enrolled in any courses, backported to 1.7
MODIFY admin/settings/security.php   Rev. 1.9.2.3    (+2 -1 lines)
MODIFY version.php   Rev. 1.406.2.25    (+1 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.55.2.27    (+7 -1 lines)
MODIFY user/view.php   Rev. 1.123.2.10    (+9 -2 lines)
MODIFY user/edit.php   Rev. 1.126.2.8    (+4 -3 lines)
MODIFY user/Attic/edit.html   Rev. 1.94.2.4    (+12 -2 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.65.2.18    (+2 -1 lines)
Helen Foster added a comment - 12/Nov/08 09:09 PM
1) How about:

$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.';


Helen Foster added a comment - 12/Nov/08 09:28 PM

Eloy Lafuente (stronk7) added a comment - 13/Nov/08 06:35 PM
Looks perfect for me, Helen. +1

Thanks!


wildgirl committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 13/Nov/08 08:22 PM
profilesforenrolledusersonly setting: MDL-17143 lang string rewording
MODIFY lang/en_utf8/admin.php   Rev. 1.154.2.64    (+1 -5 lines)
wildgirl committed 1 file to 'Moodle CVS' - 13/Nov/08 08:23 PM
profilesforenrolledusersonly setting: MDL-17143 lang string rewording
MODIFY lang/en_utf8/admin.php   Rev. 1.239    (+1 -5 lines)
wildgirl committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 13/Nov/08 08:33 PM
profilesforenrolledusersonly setting: MDL-17143 lang string rewording
MODIFY lang/en_utf8/admin.php   Rev. 1.103.2.28    (+2 -6 lines)
Helen Foster added a comment - 13/Nov/08 08:39 PM
Thanks Eloy, reworded lang string added to HEAD, 1.9 and 1.8.

Eloy Lafuente (stronk7) added a comment - 14/Nov/08 02:59 AM
Great! BTW... looking commits... I thin the setting has been backported to 1.7 too.

Ciao


Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 14/Nov/08 03:09 AM
MDL-17143 Updated a translated string for admin based on lang/en_utf8 rewording.
MDL-17083 Translated new strings.
MODIFY ja_utf8/admin.php   Rev. 1.316    (+2 -5 lines)
MODIFY ja_utf8/role.php   Rev. 1.79    (+1 -1 lines)
MODIFY ja_utf8/lesson.php   Rev. 1.75    (+13 -4 lines)
MODIFY ja_utf8/glossary.php   Rev. 1.46    (+2 -1 lines)
MODIFY ja_utf8/moodle.php   Rev. 1.326    (+16 -10 lines)
wildgirl committed 1 file to 'Moodle CVS' on branch 'MOODLE_17_STABLE' - 14/Nov/08 07:21 AM
profilesforenrolledusersonly setting: MDL-17143 lang string rewording
MODIFY lang/en_utf8/admin.php   Rev. 1.55.2.28    (+2 -6 lines)
Helen Foster added a comment - 14/Nov/08 07:25 AM
Thanks Eloy, I've added the reworded lang string to 1.7 too and have updated the documentation.

Dongsheng Cai added a comment - 14/Nov/08 09:50 AM
Hi, everyone, 1.6 is quite different from the other versions. Where should I place the profilesforenrolledusersonly setting in "Administration Page"?

martignoni committed 2 files to 'Lang CVS' - 16/Nov/08 09:17 PM
MDL-17143, strings added
MODIFY fr_utf8/moodle.php   Rev. 1.254    (+2 -1 lines)
MODIFY fr_utf8/admin.php   Rev. 1.313    (+3 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 16/Nov/08 09:44 PM
MDL-17143 tweaked string
MODIFY fr_utf8/admin.php   Rev. 1.314    (+2 -1 lines)
Eloy Lafuente (stronk7) added a comment - 17/Nov/08 07:13 PM
Good question... hehe.

I think it used to be a "security" section under "config variables" or something like that. That was the place where things like $CFG->secureforms or $CFG->loginhttps were defined... hope it helps.


Dongsheng Cai committed 1 file to 'Moodle CVS' on branch 'MOODLE_17_STABLE' - 18/Nov/08 11:21 AM
"MDL-17143, remove debug code"
MODIFY user/view.php   Rev. 1.123.2.11    (+1 -2 lines)
Dongsheng Cai committed 7 files to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 18/Nov/08 11:49 AM
"MDL-17143, don't display the user description at all when user isn't enrolled in any courses, backported to 1.6"
MODIFY version.php   Rev. 1.347.4.11    (+1 -1 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.29.4.3    (+2 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.18.6.4    (+2 -1 lines)
MODIFY user/view.php   Rev. 1.107.2.4.2.2    (+10 -2 lines)
MODIFY admin/Attic/configvars.php   Rev. 1.32.6.2    (+4 -1 lines)
MODIFY user/edit.php   Rev. 1.112.2.4.2.3    (+4 -3 lines)
MODIFY user/Attic/edit.html   Rev. 1.88.2.3.2.2    (+9 -0 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 19/Nov/08 12:44 AM
MDL-17143 deleting some debug code.
MODIFY user/view.php   Rev. 1.107.2.4.2.3    (+1 -2 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 19/Nov/08 01:12 AM
MDL-17143 setting default (to true) for profilesforenrolledusersonly.
MODIFY lib/Attic/defaults.php   Rev. 1.80.6.2    (+2 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 19/Nov/08 01:21 AM
MDL-17143 Using existing $user->id instead of unexisting $userid
MODIFY user/Attic/edit.html   Rev. 1.88.2.3.2.3    (+1 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 19/Nov/08 01:32 AM
MDL-17143 description now is mandatory again for normal (enroled) users. Previous commit broke that.
MODIFY user/edit.php   Rev. 1.112.2.4.2.4    (+6 -2 lines)
Eloy Lafuente (stronk7) added a comment - 19/Nov/08 01:39 AM
I've performed some changes in the 16_STABLE version committed some hours ago:
  • Set new setting default to true (securer).
  • clean some debug code that was left there.
  • fixed use of undefined $userid
  • fixed logic so description field continues being mandatory for normal (enrolled) users. Was broked in prev commit.

Seems to be working fine now. Resolving as fixed. Someone else, please, review this. Ciao

PS: And please, try to perform some test when committing things to stable branches. This was simply broken in too many places to be acceptable IMO. TIA!


Eloy Lafuente (stronk7) made changes - 19/Nov/08 01:39 AM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Petr Skoda added a comment - 19/Nov/08 05:52 AM
hmm,

1/ I am not sure this should be on by default - when adding new user the description field "disappears" ??

2/ I can see this in 1.6.x when I view my own profile and description already there, but not enrolled: "This profile description will not be shown until this person is enrolled in at least one course." and not enrolled yet. This does not seem like correct English.

Anyway, reopening and going to fix more coding problems there...

Petr


Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_16_STABLE' - 19/Nov/08 05:56 AM
MDL-17143 fixed undefined $userid
MODIFY user/edit.php   Rev. 1.112.2.4.2.5    (+2 -2 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_17_STABLE' - 19/Nov/08 06:09 AM
MDL-17143 fixed undefined $userid, in any case moodle/user:editprofile is not usable - so this will not probably work anyway
MODIFY user/Attic/edit.html   Rev. 1.94.2.5    (+1 -1 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 19/Nov/08 06:32 AM
MDL-17143 fixed use of $userid in definition_after_data() - problem in 1.8.x is that the definition_after_data() is called 2x ;-)
MODIFY user/edit_form.php   Rev. 1.19.2.8    (+8 -8 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 19/Nov/08 06:40 AM
MDL-17143 $CFG->profilesforenrolledusersonly does not belong into advanced user edit form - it was removing description if user had only create user cap
MODIFY user/editadvanced_form.php   Rev. 1.6.2.7    (+1 -10 lines)
Petr Skoda added a comment - 19/Nov/08 06:43 AM
1/ fixed undefined 2x $userid in 1.6.x

2/ fixe 1x undefined $userid in 1.7.x, BUT the use of non-existent capability moodle/user:editprofile will not probably work in all cases - this was a know problem fixed in 1.8.x only - maybe it is the right time to close 1.7.x branch and not commit anything there at all

3/ in 1.8.x the new code in definition_after_data() MUST verify that $userid is valid (changed in 1.9.x) - it was removing the description field always - this was totally untested, right?

4/ the restriction does not belong into advanced user edit form - it was removing the description if user had only create user cap


Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 19/Nov/08 06:43 AM
MDL-17143 $CFG->profilesforenrolledusersonly does not belong into advanced user edit form - it was removing description if user had only create user cap
MODIFY user/editadvanced_form.php   Rev. 1.14.2.9    (+1 -8 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 19/Nov/08 06:45 AM
MDL-17143 $CFG->profilesforenrolledusersonly does not belong into advanced user edit form - it was removing description if user had only create user cap
MODIFY user/editadvanced_form.php   Rev. 1.26    (+1 -8 lines)
Petr Skoda made changes - 09/Feb/09 07:25 AM
Link This issue has been marked as being related by MDL-18178 [ MDL-18178 ]
Jerome Mouneyrac made changes - 17/Feb/09 10:12 AM
QA Assignee jerome
Jerome Mouneyrac added a comment - 17/Feb/09 10:46 AM
Tested on 1.9. It works fine, thanks everybody.

Jerome Mouneyrac made changes - 17/Feb/09 10:46 AM
Status Resolved [ 5 ] Closed [ 6 ]