Search:

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”). 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.

 

comments

2 Responses to “User Photo plugin not working? – try this…”

  1. shawn on February 3rd, 2011

    thanks. worked!

  2. JOn on February 22nd, 2012

    PERFECT! Man this was driving me NUUUUUUUUUUUUUTS!!!!!!!

Leave a Reply




 
     
  • need my help?

    Interested in having me be a consultant on your next project?  to email me.

  •  
  • what i’m reading...

  • Run Windows on Mac OS X with no reboot!ING DIRECT Orange Savings Account- Apply Today!
    BasecampGo Daddy $6.99.com sale 125x125

    Order DIRECTV Today for $29.99 a month