Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Mar 2015 at 05:55 UTC
Updated:
13 Apr 2015 at 08:14 UTC
Jump to comment: Most recent
Comments
Comment #1
guptas89 commentedComment #2
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxsiddharth892452719git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
guptas89 commentedComment #4
kunalkursija commentedHey Siddarth,
I just cloned this project and enabled on local and tried uploading image on a certain role.
per_role_picture.admin.inc file:
1) Line 72 generates a fatal error.
DOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uid' in 'field list': INSERT INTO {per_role_picture} (rid, fid, uid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 6 [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 1 ) in per_role_picture_form_submit() (line 72You are trying to insert "uid" in $record -> which is later entered into per_role_picture schema.
But this column does not exist there.
Reference.
Comment #5
vbouchetHi Guptas89,
Please find my findings:
- [Blocker] As noticed by kunal.kursija, it's currently impossible to upload a picture to a role due to the critical error.
- [Blocker] You should probably alter the form on admin/people/permissions/roles instead of creating a new one. If another module is enabled and altering this form, you basically by-pass it.
- [Blocker] Some functions are not following coding standard naming:
For example, a future update of Drupal core may provide a user_picture() function in User module.
- Missing empty line between per_role_picture_help() and per_role_picture_menu() comment's.
- Some functions would be easier to read with some additional blank lines or comments (theme_per_role_picture_admin_roles(), per_role_picture_user_load(), theme_per_role_picture_role_order_settings() for example).
- I'm not sure
is very useful, you can use $file->uri directly.
- Typo mistake in "Submit hadler for set role weight." (~l 130 in per_role_picture.admin.inc).
- I'm not exactly sure what this line
is supposed to do (~l 173 in per_role_picture.admin.inc) but it's adding a wired blank line at the end of the table.
- The link "picture" in admin/people/permissions/roles may be easier to understand with "edit role picture's" or "edit picture".
- I haven't been able to upload a picture but I think it would be great to had image preview near the upload field (like image fields in node for example).
- [Q] Why do you provide a new admin interface to set the role order instead of using the existing weight field available on admin/people/permissions/roles ?
Comment #6
guptas89 commentedHi vbouchet,
Please find my comments below in Bold/Italic:
- [Blocker] As noticed by kunal.kursija, it's currently impossible to upload a picture to a role due to the critical error.
FIXED.
- [Blocker] You should probably alter the form on admin/people/permissions/roles instead of creating a new one. If another module is enabled and altering this form, you basically by-pass it.
I have created a new form for upload picture like provided by the core to edit the Role/Permission. For adding a new link 'edit picture' I need to override theme function, Because default links 'edit role/permissions' links not created by the form so I think hook_form_alter will not work here, links are actually render by theme function i.e theme_user_admin_roles in user.admin.inc @see: https://api.drupal.org/api/drupal/modules!user!user.admin.inc/function/t....
- [Blocker] Some functions are not following coding standard naming:
role_picture_delete()
user_picture()
upload_picture_access()
For example, a future update of Drupal core may provide a user_picture() function in User module.
Added module name as a prefix in module function name.[FIXED]
- Missing empty line between per_role_picture_help() and per_role_picture_menu() comment's.
[FIXED]
- Some functions would be easier to read with some additional blank lines or comments (theme_per_role_picture_admin_roles(), per_role_picture_user_load(), theme_per_role_picture_role_order_settings() for example).
Added comments in functions.
- I'm not sure
is very useful, you can use $file->uri directly.
Used directly [FIXED]
- Typo mistake in "Submit hadler for set role weight." (~l 130 in per_role_picture.admin.inc).
[FIXED]
- I'm not exactly sure what this line
is supposed to do (~l 173 in per_role_picture.admin.inc) but it's adding a wired blank line at the end of the table.
Removed this php code, cause of extra row in table[FIXED]
- The link "picture" in admin/people/permissions/roles may be easier to understand with "edit role picture's" or "edit picture".
Rename with 'edit picture'[FIXED]
- I haven't been able to upload a picture but I think it would be great to had image preview near the upload field (like image fields in node for example).
Role order configuration page have preview for each image against each role. I think user can see preview of all the images from configuration page.
- [Q] Why do you provide a new admin interface to set the role order instead of using the existing weight field available on admin/people/permissions/roles ?
Because many other modules use that order, If you can see on creating a new user role checkboxes will display on admin/people/permissions/roles order. So I think it's better to maintain the order on separate page because in this module order/priority of roles is very important.
Thanks kunal.kursija to catch-up the fatal error.
Thanks vbouchet for your great insights.
Comment #7
joshi.rohit100@Review
Looks good to me just one thing as your module is mostly (almost) depends on the user picture, you can use hook_requirements to check whether user picture is enabled or not. So that you dont have to write more access checks.
Comment #8
klausiThat sounds like an improvement but not an application blocker, anything else that you found or should this be RTBC instead?
Comment #9
joshi.rohit100@klausi - Yes
This method is not defined so causing fatal error while removing image. Also, there should be an message when image is removed. And I think, this is kind of blocker.
Comment #10
joshi.rohit100changing status
Comment #11
guptas89 commented@joshi.rohit100
I have fixed this error please review it.
This method is not defined so causing fatal error while removing image. Also, there should be an message when image is removed. And I think, this is kind of blocker.
[FIXED]
@joshi.rohit100 thanks for testing.
Comment #12
nesta_ commentedHi :)
in .module not use function t(), why?
Add function t() in description and titles please!
example:
.module
Line 39 'description' => 'Set order of role in which user picture will be display. If a user have multiple role then role with lesser weight will be on high priority for user picture.',
Comment #13
guptas89 commentedHi @nguerrero
In D7 you should NOT be using t() in your menu declarations. Menu automatically pushes title and description through t().
@see: https://api.drupal.org/comment/51103#comment-51103
Comment #14
guptas89 commentedComment #15
svnindia commentedhi,
Manual Review
Individual user account - yes
No duplication - yes, there was no module available similar to this
Master Branch - yes
README.txt - yes, required information given
Code long/complex enough for review - yes
Coding style & Drupal API usage - yes
It looks RTBC to me
Comment #16
pkapils commentedHi guptas89,
Thanks for this wonderful module.
I started playing with your module on local setup (Drupal 7.34) and found a bug. Below are the steps to replicate
BUG : If the role pic is deleted from settings, the user pic (came from role pic) is still alive.
Step 1: Add a role pic to "authenticated user" role
Step 2: Visit any authenticated user(who has no user picture set), will have the role pic now (as per functionality)
Step 3: Go to user edit page and simply save it.
Step 4: Delete the role pic now.
Step 5: Now visit the corresponding authenticated user, the role pic still remains in his profile.
You need to handle differently when the user is edited and saved. As there are also some bug which happens after the user is edited and saved.
Hope this will help you more to make it as a stable release.
Comment #17
pkapils commentedChanging Status
Comment #18
guptas89 commentedHi pkapils,
Thanks for review the module and great thanks to provide the detail steps to reproduce the issue.
I have fixed the issue mentioned by you. Now user default role picture will be treated as a user default picture, If you edit your user then save the form. Remove role picture from role setting page then picture will not be show on user view/edit page.
Please test it and let me know If something needs to do more.
Comment #19
franksj commentedManual Review
Here is a summary of the preferred format:
===/---to the length of the heading, followed by a newline.Enable module - drush en -y per_role_picture
Ensure user pictures enabled - drush vset user_pictures 1
Edit picture for authenticated user role - admin/people/permissions/roles/picture/2
Upload picture
Save
Visit My account.
Picture not displayed. Alt text "admin's picture".
Create new user "Jack" with role authenticated user.
Log in with new user.
Visit My account.
Picture not displayed. Alt text "Jack's picture"
Check role picture settings - admin/config/people/per-role-picture
Picture missing. per_role_picture_preprocess_user_picture user->picture is always coming back null.
This review uses the Project Application Review Template.
This looks like a piece of cool functionality, but it isn't working in a clean D7.35 environment.
Comment #20
guptas89 commentedHi @franksj
I have fixed issues mentioned by you in previous comment. Please find my comments in bold/italic:
README.txt/README.md
No: Does not follow the guidelines for in-project documentation and/or the README Template.
Here is a summary of the preferred format:
Headings in all caps.
Headings underlined with ===/--- to the length of the heading, followed by a newline.
Two lines prior to headings (except the first one).
Bullets denoted by asterisks (*) with hanging indents.
Numbered lists indented 4 spaces.
Bulleted lists indented 1 space.
Text manually word-wrapped within around 80 cols.
[FIXED] Match all the formatting and structure with core modules and README template.
Coding style & Drupal API usage:
[FIXED]Tested on preview.sh
I experienced a blocker issue.
Blocker: Pictures aren't showing up. Steps to reproduce:
Enable module - drush en -y per_role_picture
Ensure user pictures enabled - drush vset user_pictures 1
Edit picture for authenticated user role - admin/people/permissions/roles/picture/2
Upload picture
Save
Visit My account.
Picture not displayed. Alt text "admin's picture".
Create new user "Jack" with role authenticated user.
Log in with new user.
Visit My account.
Picture not displayed. Alt text "Jack's picture"
Check role picture settings - admin/config/people/per-role-picture
Picture missing. per_role_picture_preprocess_user_picture user->picture is always coming back null
I have followed the same steps mentioned by you but not able to reproduce the issue. I am successfully able to upload the pictute and picture is visible on user account detail/edit page for admin as well as new authenticated user. I suggest please check your files folder permission OR image styles settings because this module used image styles. I have downloaded vanila drupal 7.35 an everything looks good for me.
Picture missing. per_role_picture_preprocess_user_picture user->picture is always coming back null: User picture property will be NULL until user do not upload the picture on there user edit page. If you can see the structure of user default picture provided by the Drupal core $user->picture always has NULL value. So for default picture this property will always have the NULL value.
Great thanks to review the module and provide detail steps to reproduce the issue.
Comment #21
joshi.rohit100Now it looks good to me. Marking RTBC
Comment #22
klausimanual review:
But otherwise looks good to me.
Thanks for your contribution, guptas89!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #23
guptas89 commentedHi @klausi
I have removed per_role_picture_upload_picture_access() function and specify the permission in hook_menu.
A Great thanks to you for review the project and give me permissions to promote it in full project. This is my first contributed module on Drupal.org. :-)