Replies
Ah thanks Brajesh… sorry I didn’t realise (and you guys have always been so helpful with other things). Perhaps I should be using MediaPress instead 😉
@Ravi… you’re a star! That works like a dream…
I thought there might be a relatively easy way but Google certainly wasn’t being much help 😉
Thank you so much for the prompt attention, I really appreciate it.
I’m definitely enjoying it so far. Always fun to learn new things and figure out how they tick, and I really like the way Buddypress is so flexible (once you get the hang of it).
Once this particular project is finished, I’m hoping I can persuade some of my other existing clients that they’d like to add similar features so I can build on that knowledge and extend things a bit more 😉
Yes indeed. I’m fairly new to Buddypress, though definitely not to WordPress and I’ll keep an eye on bporg trac myself in future, though really appreciate your support here too.
I’ll mark this topic as resolved.
Ah many thanks to both of you… haven’t tried it yet but that definitely explains the issue.
I’d worked out that it was the validate_file that was causing the problem but just couldn’t see exactly how to fix it.
Will give it a go in the next couple of days but happy to have a promising solution.
Oops… just realised that although the above allows the image to be displayed upon update, it disappears again when the page is refreshed so clearly simply ignoring validate_file is not a viable fix 😉
Just checked this theory by removing the validate_file clause (ie. efffectively changing line 1317 back to what it was previously) and everything else works fine so that’s obviously the culprit.
Since the path obviously exists (or the image couldn’t be displayed), I’m not sure why the validation is failing but maybe something to do with the fact that the server is localhost?
Ah thank you Brajesh… we’re definitely on the right tracks here.
Comparing the previous and updated versions of that file, I see that line 1317 has been changed from –
if ( ! is_dir( $cover_dir ) ) {
to
if ( 0 !== validate_file( $cover_dir ) || ! is_dir( $cover_dir ) ) {
Not yet sure what that validate_file is checking but I assume it must be failing somehow…
The only other significant difference in the two files is function bp_attachments_cover_image_ajax_delete() which may perhaps also have something to do with it I guess.
With many thanks again for any thoughts.
Warm regards
NikHi Brajesh
Yes the directory is created… the image is even uploaded to the correct directory eg. wp-content/uploads/buddypress/members/1/cover-image/correct.jpg. It just doesn’t appear on the page – possibly no record (or incorrect path) created in the database?
Not sure off the top of my head where that info would be stored in the database but I’ll see if I can find it tomorrow…
I’m using Windows 10.
Warm regards
NikHi Ravi
Yes normal WordPress media uploads are working perfectly fine… indeed,as mentioned above, I can even upload a Buddypress profile photo with no problem. It’s just the cover photo that seems to be causing a problem.
Regards
Nik