User Photo plugin not working? – try this…

Once again, I recently ran into a situation where something cool that I was developing worked just fine when run locally using MAMP. But then, when i uploaded everything to my server, things did not work as expected.

This will be a short one.

In this case I am using the User Photo plugin v.0.9.4 and WordPress v.3.0.4. I have a place on my single post page(s) (single.php) where I want to show a tumbnail of the author’s photo using the following code…

<?php userphoto_the_author_thumbnail(); ?>

…and it just was not working. After doing the usual bit of googling, I discovered this thread on the WordPress support forums where I found my solution – thanks to user dragunoff (Ivaylo Draganov). It turns out the issue is apparrently linked to wether or not a user photo should be held for moderation or not depending on their user level.

the fix…

At approximately line 120 in the User Photo plugin file “user-photo.php”, located at /wp-content/plugins/user-photo/, there is a function called userphoto__get_userphoto. About 3 or 4 lines down in that function you’ll see this line of code…

if(($userdata->userphoto_approvalstatus == USERPHOTO_APPROVED) &&

All we need to do is add 2 forward slashes – “//” – after the first open parentheses to comment out this first condition in the “if” statement, like so…

if( // ($userdata->userphoto_approvalstatus == USERPHOTO_APPROVED) &&

…and all should work fine.

What we’re really doing is removing the check for approval status from administrator moderation. So, don’t use this hack if you have a site where users could potentially upload some “questionable” user photos.  😉


update: 02.18.11 – this also works with User Photo plugin v.0.9.5 and WordPress v.3.0.5.

3 thoughts on “User Photo plugin not working? – try this…

Leave a Reply

Your email address will not be published. Required fields are marked *