bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

Plugin: Avatar Upload

(111 posts)
  • Started 1 year ago by louisedade
  • Latest reply from agl666
  • This topic is not resolved
  1. I have a problem and I'm not that good at html. Can anyone help me? I can't seem to add an avatar to my profile. Also, the sample avatar corsses borders with the name of the member in the post below the post where the avatar is depicted. Follow the link to see an example:

    http://www.jaspertjong.nl/bbnederdraken/topic.php?id=10&page&replies=4

    And this is the error:

    move_uploaded_file(/var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/avatars/aranamarunda.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/avatar-upload.php on line 130

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/www/g29802/jaspertjong.nl/tmp/phpsjhS0i' to '/var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/avatars/aranamarunda.jpg' in /var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/avatar-upload.php on line 130

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/avatar-upload.php:130) in /var/www/g29802/jaspertjong.nl/HTML/bbnederdraken/bb-includes/functions.php on line 1819

    Posted 1 year ago #
  2. You need to change the permissions of the avatars folder I think.
    http://faq.wordpress.net/view.php?p=54

    The avatars cross the next poster's names because they're that's how the CSS is set up. You could change the HTML and CSS structure, or if that's perhaps too much you could open kakumei's style.css, find #thread li { ... } and add this to it:

    min-height: 120px;

    That should make sure the post box is big enough that the next post box doesn't interfere with the avatar. Change the number if you want it differently.

    Posted 1 year ago #
  3. Oops, I ought to add the permissions information into the help file - maybe add a permissions check so plugin dies gracefully.

    Posted 1 year ago #
  4. Thank you very much. Such a polite reply! I'm amazed at the helpfulness on this forum. It is all working now :D If you are dutch, come and join the forum :D It is for dutch role playing only... Sorry :S

    (no intention or commercial interest, just see the above as a polite invitation, no spam intended.)

    Posted 1 year ago #
  5. I get this error when trying to upload avatars (the plugin is installed and activated)

    The file could not be saved to the 'avatars' folder.

    I changed the permissions of the avatars folder ot '666' as the information file explained, but to no avail. Doe's anyone have any idea of why this might be happening, and how to fix it?

    I also tried leaving the folder permissions as is but this did not work either.

    Posted 1 year ago #
  6. Hello, the specific error you have reported could be a permissions problem - although if you tried settings permission to 666 and it still failed, I'm stumped. Alternatively, it could be some other problem with PHP's move_uploaded_file() function.

    What might be helpful is what error PHP returns itself (I've suppressed PHP errors in the plugin). You need to temporarily show the PHP error for the function in question by removing the @ symbol from in front of it.

    Find the following line in avatar_upload.php (~ #99) and remove the @ symbol before the move_upload_file function.

    if ($img_errs == 0 && !@move_uploaded_file($img_temp, BBPATH .$config->avatar_dir . $user_filename) )

    .
    Then upload the file to the server, chmod the avatars folder to 666 and try uploading an avatar again -- please report the full error message you get, including the PHP error.

    Oh and I have to ask this, just in case: are all the configuration settings in my-plugins/bb-avatar-upload.php correct? Is the avatars folder in the root and is the $this->avatar_dir config setting pointing to the correct location? I'm sure they are, but I have to check.

    Posted 1 year ago #
  7. For those of you who have your wordpress and bbpress installs together and would like have the avatars display in the wordpress side as well...

    Here is some code you can add... This is what I use in the sidebar over at yourkahil.com

    <?php global $user_identity;
    get_currentuserinfo();

    if ($user_identity == '') {
    echo('Welcome Guest');
    } else {
    echo('<img src="/forum/avatars/' . strtolower($user_identity) . '" alt="avatar" />');
    }
    ?>

    This will work if you would like to display the avatar outside of the loop in bbpress as well. All you have to do is change the image source line to reflect where you have your avatars stored...

    Hope that helps some people!!!

    Posted 1 year ago #
  8. Hey there, i've just installed Avatar Upload and it works brilliantly i must say! However identicon for bb-press as posted by louisedade (created by fel) gives me an unexpected error when i try to activate, running this outside of the plugin centre or whatever you want to call it, it gives:
    Fatal error: Call to undefined function: add_action() in /home/bblocked/public_html/www/forums/my-plugins/identicon.php on line 286

    Inside the plugin centre it just says fatal error :-P

    I have identicon installed on my wordpress blog and bbpress retrieves all functions from wordpress etc etc intergrated bla bla bla :-P Any ideas?

    EDIT: When editing out add_action at the bottom it doesn't produce any errors... so i don't know what bbpress's problem is :-/ anyway of getting it to give more info? "Fatal Error" doesn't explain much lol

    Posted 1 year ago #
  9. I found visitors were getting really hassled by the filename restrictions so I decided to relax them while still keeping some safety since you already check mime types & file extensions

    instead of:
    !eregi("^([-a-z0-9_]+)\.([a-z]+)$", $img_name)

    I reduced it to only exclude the four bad characters I can think of:
    eregi("\#|\?|\&|\%", $img_name)

    What do you think? Safe enough?

    Is your mime check from the physical file itself or just the sent headers? Hopefully the physical file or it's not secure enough.

    My change allows people to click browse and enter a url into their file browser, which forces Windows to pull down the file first, then upload it to the site. Not sure what other OS's will do. Windows adds [1] to the filename in the temp area, so your name filter was blocking it from uploading.

    My next ideas are to give lazy people a section of default avatars to choose from instead, and to allow members several stored avatars to chose from (your table should allow multiple entries per member I think, though the code to deal with it will have to be changed of course).

    Posted 1 year ago #
  10. @Beaver6813:
    The error sounds like it's trying to call the add_action() function when either the file containing the function (wp-functions.php) isn't included for some reason, or the plugin is being called before it has been included.

    I do not know why this might occur, although the fact you are using an integrated WordPress/bbPress combo might be a factor. We really need somebody who knows more about the internals of both system to help.

    Anyway, by commenting out the add_action() function all you have done is prevent the plugin from automatically creating an identicon for newly registered users. So, it's not such a biggie while trying to solve the problem.

    @_ck_
    Feel free to hack the script however you see fit -- I realise I have been rather too strict with the filenames, especially as it is really only a first-stage precaution (the file gets renamed n the server anyway). Also, I believe some browsers add the whole path to the uploaded filename (something I neglected to address).

    A solution I am adding to the next version will be to extract the actual filename from the path before checking.

    $img_name = basename($img['name']);

    Then, the number of necessary characters to allow is greatly reduced. I just prefer to approach it from the other end, block everything except what I explicitly allow. But as I said, feel free to hack it to suit your needs.

    I was completely unaware that you could enter a URL into a file input ("browse") field? You indicate that it forces Windows to download the file, but I am wondering whether it is a browser specific feature and whether it is supposed to work like that? I would not rely on it.

    The mime-type comes from the uploaded file in $_FILES which, you are right should not be trusted. I'm experimenting with checking whether the uploaded file is areally an image doing something like imagecreatefromjpeg() - obviously using the appropriate function for the reported file extension (so if it's all wrong/missing/forged an error will result). Alternatively, a simple solution might be to use getimagesize() (just the one function for all types), which I already use later in the code.

    Posted 1 year ago #
  11. I have posted several changes and fixes, over here since there seems to be two threads on this plugin (and apparently bbpress won't be able to merge topics anytime soon)
    http://bbpress.org/plugins/topic/46/page/2?replies=34#post-352

    #4 is a doozy. You might want to make that a priority in the next version. Filenames *must* be unique for every uploaded change to ensure proper caching and then image updates in the browser when the image changes.

    Posted 1 year ago #
  12. A new version of Avatar Upload is now available - for changes see the plugin browser thread:

    http://bbpress.org/plugins/topic/46/page/2?replies=34#post-373

    Posted 1 year ago #
  13. I have found and fixed a bug that was preventing the display of the newly uploaded avatar:

    http://bbpress.org/plugins/topic/46/page/3?replies=48#post-400

    (no more sleep(3) needed)

    Posted 1 year ago #
  14. Hi,

    I just upgraded to the last version and now my forum prints this message:


    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'stdClass::has_cap' was given in /home/ficcion/public_html/wp-includes/capabilities.php on line 454

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'stdClass::has_cap' was given in /home/ficcion/public_html/wp-includes/capabilities.php on line 454

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'stdClass::has_cap' was given in /home/ficcion/public_html/wp-includes/capabilities.php on line 454

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'stdClass::has_cap' was given in /home/ficcion/public_html/wp-includes/capabilities.php on line 454

    Sadly i don't know what it is. :(

    Posted 1 year ago #
  15. Hi, the error you are reporting appears to be a problem with the bbPress core code, specifically the user 'capabilities' class.
    Have I understood this correct:

    - You are using the latest bbPress version (0.8.2.1) ?
    - The error only appeared AFTER you upgraded to the latest Avatar Upload plugin to version (0.6.2)?
    - Does the error appear on EVERY page, or just the Avatar Upload template in the profile area?

    Posted 1 year ago #
  16. It appears just in the upload avatar template. Everything else works fine :)

    Posted 1 year ago #
  17. Ok - in that case it must be something to do with the capabilities checking I do to ensure the current user has permission to edit the avatar. I'll look in to it and get back to you.

    Posted 1 year ago #
  18. thanks!

    Posted 1 year ago #
  19. Might be related. Installing with the "Plugin Browser" will not install as the version the in SVN gives a fatal error on install.

    Trent

    Posted 1 year ago #
  20. @Trent

    I'm pretty sure that is a problem with your version of the Plugin Browser. Versions less than 0.1.5 don't handle directories within plugins. Upgrade the Plugin Browser to 0.1.5 (you can do this within the Plugin Browser itself without problems), then you should be able to install Avatar Upload.

    * EDIT *

    Now I get what you mean, you mean it fatally errors when activating in the normal plugin page?

    Actually it has to with the way the plugin is laid out. It expects you to shuffle around and edit a few files before activation. The plugin browser will only help you get the files in this case.

    Posted 1 year ago #
  21. Well, yes, the plugin includes a file that must be placed into the bbPress root as well as another file that must be moved into the templates folder (either bb-templates/kakumei or my-templates/template-name). Not to mention the creation of the avatars folder and uploading of the default avatar.

    I can not see any way around this other than uploading all files to the my-plugins/avatar-upload folder and then using the script to move them to the right locations. Although, the file that remains in the my-plugins would still need to be manually edited to set the plugin's options. Likewise, the folder creation could be done with a script rather than the current manual creation (as SamBauers suggested on the Plugin Browser thread).

    Is there a hook for when a plugin is activated? Looking around bbPulp I found the following...

    bb_deactivate_pluginXXX
    bb_activate_plugin_XXX

    ... but no information on how they are used.

    Posted 1 year ago #
  22. @louisedade

    I've made a few additions to the plugin which I think will help with a few of these issues that are coming up. They are:

    1. Added an admin page for configuration.
    2. Moved the actual plugin files to the root of the plugin.
    3. Moved all other files except the readme.txt to an "additional-files" folder.
    4. Removed the plugin header from the file "avatar-upload.php", this can now be kept only in the main plugin file (this was the root cause of the activation error that Trent reported).
    5. Updated readme.txt to reflect these changes.

    Grab it here and review it, I think it is a good first step to easing installation of the plugin, and making it more compatible with the Plugin Browser.

    http://www.network.net.au/bbpress/avatar-upload.0.7.zip

    Posted 1 year ago #
  23. I have also added the ability to view installed plugins readme.txt files in the Plugin Browser. This should help with plugins like this one that have extra installation instructions.

    Posted 1 year ago #
  24. Sounds great Sam! Wow!

    Trent

    Posted 1 year ago #
  25. awesome update, thanks!

    Posted 1 year ago #
  26. Thanks Sam! That's awsome. I've downloaded and reviewed the code and I've made a couple of small modifications - added an option to the admin page and a tiny bit of validating (so that you can't have a non-numerical or zero max_width etc -- actually setting the sizes to zero will now reset the options to their "factory defaults").

    @Plugin Users: I'm adding an unsharp mask routine to the reszing code before I commit the updates, so it might not be ready until tomorrow. If you've downloaded Sam's update, you will have to do another update later.

    Posted 1 year ago #
  27. @louisedade - I found an image upload class the other day... it allows watermarking, resizing, bunches of other stuff, rather simple implementation. Looks pretty decent.

    http://www.verot.net/php_class_upload.htm

    I integrated it into your plugin ages ago, as well as an account picture upload feature with custom-definable dimensions for both avatar and account picture. I didn't really want to upload it here, as there are oodles of plugins that have similar features. Would you like a peek at the source?

    Posted 1 year ago #
  28. @box87, be aware that single upload class is larger than most of the the entire bbpress core code itself - massive overkill unless you really, really really need it's extra features?

    @louisedade - I found a major caching bug where you are not taking advantage of user meta data that has already been loaded previously in the same execution - this causes 10-30 extra mysql queries for every topic that is displayed depending on how many posts are displayed at once.

    Here's a hacked workaround, though I am not sure it's a good idea to tap into the user_cache directly. I'd otherwise suggest nicely using bb_get_user() as it checks the cache first but the problem with that is it fetches ALL the data if not in the cache which is overkill. Too bad there isn't a bb_get_user_meta($id,'metaname') but oh well - for now replace this top section of code:

    function avatarupload_get_avatar($id, $fulluri=1, $force_db=0)
    {
    	global $bbdb, $user,  $bb_user_cache;
    
    	if ($force_db == 0 && ($id == $user->ID ||  !empty($bb_user_cache[$id])) )
    	{
    		if (!empty($user->avatar_file)) {
    			$a = explode("|", $user->avatar_file);
    		} else {
    			if (!empty($bb_user_cache[$id]->avatar_file)) {
    				$a = explode("|", $bb_user_cache[$id]->avatar_file);
    			}
    			else {return false;}
    		}
    	}
    	else

    Drops my topic queries by 20 per page while still functioning correctly in all other cases.

    Discovered this problem via bb-benchmark

    Posted 1 year ago #
  29. Ok, version 0.7 is released: including the changes by SamBauers as well as an image sharpening (unsharp mask) function.

    @Sam - Using the latest version of your plugin, I tried installing the new version of Avatar Uplaod, but it still wouldn't read the additional-files directory. This is what it looks like over FTP: screenshot (NOTE: if there is a problem viewing it -- error 403 -- try cutting and pasting the URL instead - it's probably my over-zealous image-hotlinking prevention).

    Posted 1 year ago #
  30. @Box87 - thanks, but I think the class has far too many features for an avatar upload script. It would be fantastic for a fully-fledged image/photo album/file-browser plugin, but I'm not interested in going down that route.

    Avatar Upload now already has the two chief functions it lacked: resizing (including maintaining aspect ratio) and sharpening of resized truecolor images (unsharp mask). I want to keep it as simple as possible.

    I onced used a forum where the avatar feature was integrated with a generic image upload browser and my users got a bit confused. They didn't realise it was one and the same place (they hardly EVER uploaded anything that wasn't an avatar) - you uploaded an image and had to select the one to use as an avatar - it was possible to select an image that was too big etc. So I hacked the plugin to make it more specifically for avatars (making my own for this particular forum would have been a right-Royal pain in the [gr]ass), but I was never really happy with the forum software and ditched it for another one -- until bbPress arrived!

    @_ck_ thanks, I'll look into it. My primary concern right now is getting the plugin to play nicely with the Plugin Browser plugin.

    Posted 1 year ago #

RSS feed for this topic

Reply »

You must log in to post.

Code is Poetry.