I like the logic of approval queue in this module, however, there is a handful of various code issues that make this module useless at its current state. I debugged those in my setup. The attached patch addresses the following issues:

#437802: Approved Avatar not appearing in User's Profile
#716402: Broken avatar images in approval queue if site uses Private uploads
#716470: Compatibility with avatar_selection.module
[somehow "check all" update in CVS not showing in -dev]

Community, please review the patch and report here.

Maintainers, please let everyone know if this module is not abandoned. If it is abandoned (no response in 4 weeks), I will request to reassign ownership to myself.

CommentFileSizeAuthor
avatarapproval.fixes100218.patch5.01 KBiva2k

Comments

mikejonesok’s picture

See no changes in regard to the avatar_selection.module. I still have approve each of the avys that I have setup in that module.

iva2k’s picture

@mikejonesok
Interesting... Code that skips approvals is in the patch, and it works on my site:

@@ -129,6 +139,11 @@ function avatarapproval_user($op, &$edit
     case 'update':
       //If an image has been uploaded
       if(file_exists($edit['picture'])) {
+        // Check if some other module is supplying avatars.
+	// Our assumption that other module takes care of approvals, 
+	// so we don't stand in the way.
+	if (FALSE === strstr($edit['picture'], avatarapproval_get_directory())) return;

Can you verify that the patch applied completely? If yes, what is your version of avatar_selection module?

mikejonesok’s picture

iva2k, I am sorry. I should of double check myself. I forgot to rename the module.orig and replace the old module. Great job, works great. I'll keep you posted.

dalad’s picture

Status: Needs review » Closed (fixed)

iva2k, the various fixes you have pointed out have been integrated in the latest beta version now downloadable.
I want to thank you for your contribution. Please try it and give me feedback.
You made me aware that there is some CVS issue and the downloadable dev package is not in synch with the latest version in the repository. I sent a mail to the support and I'm waiting their reply.

I'm going to close this thread, if you find any bug regarding #437802, #716402 or #716470, please continue the discussion in the respective issue.

iva2k’s picture

Status: Closed (fixed) » Needs work

@dalad
Thanks for updating the module!

Sorry, did not notice your post right away - once closed, the issue disappears from the radar. I usually set my issues to "fixed" and let the system automatically close them in two weeks.

I downloaded the latest module and checked it on my site. #437802 and #716470 fixes are working, but your version of fix for #716402 does not work - images in the approval queue are back to broken.

I reinserted this code:

// [iva2k] fixing #716402:
      '#value' => theme('image', file_create_url($picture_directory . $avatar->md5 . '.' . $avatar->extension), '', '', '', FALSE));

into avatarapproval_admin_overview_form() function and it works again.

I think the problem with function avatarapproval_file_download() is that it only can change content type or disallow viewing the file, but the actual image url stays broken without the above fix, which ensures proper path by applying file_create_url().

I took the liberty of reopening this issue so the submitted patch can be tracked until it is resolved. I suggest moving to individual issues if only a separate patch needs to be submitted. Of course if you want otherwise - that's fine with me too.

dalad’s picture

What you say is really suprising me. Would you believe me if I say that your fix was not able to resolve 716402 on my system? Awaiting approval pictures in user profile were still broken so I had to resolve with file_download()...
I'm using a fedora 12 host with drupal 6.15 and php 5.2.12. Just for curiosity, what's your setup?
Really weird. At this point, good thing is to apply both fixes.
I will correct this and implement a couple of feature request in a few days, as soon as I have time.
Thanks for the suggestion on setting issues to fixed, I will.

iva2k’s picture

@dalad
> What you say is really suprising me. Would you believe me if I say that your fix was not able to resolve 716402 on my system?
I'm not surprised at all - perhaps there are two separate issues that can cause broken images with private uploads.

My setup is Ubuntu/LAMP, PHP 5.2.6-2ubuntu4.2 with drupal 6.15, just upgraded to 6.16. I have .htaccess customization in sites/default/files:

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

# Redirect all files from public to private download. Private download must be enabled.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /system/files
  RewriteCond %{REQUEST_URI} !^/sites/default/files/color/.*$
  RewriteCond %{REQUEST_URI} !^/sites/default/files/css/.*$
  RewriteCond %{REQUEST_URI} !^/sites/default/files/js/.*$
  RewriteCond %{REQUEST_URI} !^/sites/default/files/ctools/.*$
  RewriteRule ^(.*)$ $1 [L,R=301]
</IfModule>

> At this point, good thing is to apply both fixes.
I agree. I don't see any adverse effects of file_download(), and it makes sense to have it since intermediate files are created by Avatar Approval, so it has to respond to this hook to let the file system know what to do with these files.

dalad’s picture

@iva2k
It seems that file_create_url doesn't work for a default installation (meaning: only with .htaccess in base path).
It resolves to system/files/... but there is no hook_file_download to cover that requests
On your setup it gets rewritten to the right path, but in my case I get a broken link.

The possible solutions i can think of is to pass all the avatar approval images through avatarapproval_file_download, just like the "awaiting approval avatar" file. I think this would be the correct way to make it work on both setups

iva2k’s picture

@dalad
Makes perfect sense. So I gather you agreed to include the other fix (file_create_url) - did I get that right?

dalad’s picture

Yes. I think file_create_url plus hook_file_download will do the trick

iva2k’s picture

Ok, I'll wait for the snapshot or release to come out and will try it.

dalad’s picture

beta2 is out. Try to see if it behaves correctly

dalad’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.