Support » Plugin: BuddyPress Docs » Document Attachments Redirecting Issue

  • Hello all,

    We are having a strange issue with our BuddyPress Docs plugin where users are redirected to the home page of the website when clicking on .pdf, .png, .jpg, .doc, .docx, .xlsx attachement files on a BuddyPress doc we created. At the end of the URL query string this is there “action=bpnoaccess”

    However when clicking on a .mp3, .txt, .wav, or .ppt the file downloads correctly on the same BuddyPress doc that the other attachments are on.

    Any ideas on why the redirection would happen and how to resolve this issue.

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author David Cavins

    (@dcavins)

    Hi @e_durose-

    That _is_ strange. So all of these attachments are attached to the same doc? Can you browse the file structure of your WP installation? If so, take a look in /wp-content/uploads/bp-attachments/{id of the doc} and verify that all of the files are there. Also report back what the .htaccess file in that directory contains.

    What server operating system are you running?

    Thanks!

    -David

    Hi @dcavins,

    Thanks for replying!

    Yes, all of the various file types are attached to the same doc. I was troubleshooting why our .mp3 docs would allow the download and would redirect our .pdfs then I uploaded a host of other file types to try to find a pattern.

    Yes, I can access the file structure. One URL for a file that redirects is “/docs/ninja-notes-aud/?bp-attachment=2017_AUD_NINJA_Notes.pdf, where one that downloads is “/docs/ninja-notes-aud/?bp-attachment=transcript.txt.

    In wp-content->uploads->bp-attachements->1793 both files above are there but they don’t have an ID they are listed using their file names.

    There are other folders in the bp-attachements containing files from our other doc pages.

    The .htaccess file in the folder 1793 says
    # BEGIN BuddyPress Docs
    RewriteEngine On
    RewriteBase /docs/aud-testing/
    RewriteRule (.+) ?bp-attachment=$1 [R=302,NC]
    # END BuddyPress Docs

    We’re hosting with a company called Pressidium and we are on Linux, don’t know the exact version but can find out.

    Thanks again,

    Eric

    Plugin Author Boone Gorges

    (@boonebgorges)

    This is indeed perplexing.

    The ‘action=bpnoaccess’ suggests that you’re being redirected using BP’s bp_core_no_access() function. This function is used in a number of places throughout BuddyPress and related plugins. Seeing which of these plugins is responsible for the function call is the first step in figuring out what’s going on.

    Here’s a small plugin you can use to help you debug. I’ve written it to send an email (so you don’t have to mess with server logs). Drop it in wp-content/mu-plugins, replace the email with your own email address, and visit one of the problematic URLs. You should get an email that has a stack trace. Once you do, remove the file from mu-plugins, so it doesn’t fill your inbox. Then, share the information from the email here.

    https://gist.github.com/boonebgorges/695e1eccf44b35dba7de11501eb9d057

    Hi @boonebgorges,

    Thank you very much for making this for me.

    After looking at the log it seems that the files that redirect don’t think the user is logged in.

    We have Memberium installed and do have content protected but not this doc page or any file types in particular.

    Here is the dump.

    Thanks again for your helping out on this one!

    [ 1,300+ lines completely redacted ]

    • This reply was modified 8 months, 2 weeks ago by  Jan Dembowski.
    • This reply was modified 8 months, 2 weeks ago by  Jan Dembowski.
    Moderator Jan Dembowski

    (@jdembowski)

    Brute Squad and Volunteer Moderator

    @e_durose Anything past 10 lines doesn’t work here. Can you please instead paste that into https://pastebin.com/ and just share the link to that paste?

    Moderator Jan Dembowski

    (@jdembowski)

    Brute Squad and Volunteer Moderator

    Wait! I owe Boone for saving me from a viscous coffee withdrawal fate at WCNYC. His LEGENDARY actions saved me. Who knows what fate awaited me!

    *DRINKS MORE COFFEE*

    @e_durose Here’s the link. http://pastebin.com/J5JYasGG

    @jdembowski Thank you!

    @boonebgorges does this give any indication why unprotected content is being redirected?

    http://pastebin.com/J5JYasGG

    Thanks again for your help!

    Plugin Author David Cavins

    (@dcavins)

    Hi @e_durose-

    There are some template redirects in the backtrace caused by a quiz plugin (sfwd something?). Are the files accessible when that plugin is deactivated?

    Plugin Author Boone Gorges

    (@boonebgorges)

    @jdembowski 😀

    Hi @e_durose – Nothing is jumping out as an obvious culprit, though at least we can see where the redirect is originating – BP_Docs::protect_doc_access(). You mentioned that Docs thinks that you’re not logged in. How are you determining this? What does get_current_user_id() tell you in BP_Docs::protect_doc_access()?

    I have a suspicion that something in your webserver configuration is causing a redirect or something like that, during which WordPress’s authentication cookies are being lost. Are you aware of anything on your server that’s configured to handle the problematic file types in a specific way? If you’re running Apache, the places to look are .htaccess (in the WP web root) and httpd.conf (in your global Apache config directory).

    Hi @boonebgorges,

    The reason I suspected it was a login issue were due to the lines below in the log file.

    [redirect] => http://dojo.ninjacpareview.com/docs/ninja-notes-aud/
    [root] => http://dojo.ninjacpareview.com
    [message] => You must log in to access the page you requested.

    I’ve been doing more troubleshooting and I’m pretty sure my issue is some type of discrepancy w/ Memberium content protection and BuddyPress docs.

    When I do not protect the document post using Memberium and set the doc access “who can read this doc” to “anyone” all file types download correctly.

    If I change ONLY the doc access “who can read this doc” to “logged-in” users the .pdfs redirect even when logged in. However .txt, .mp3/4s file types download correctly.

    If I protect the doc post using Memeberium, .pdfs redirect no matter the doc access setting. And .txt, .mp3/4’s download correctly as they did in the above example.

    Trying to find that setting that isn’t liking the .pdf file type.

    Thank you guys again for your help figuring out our issue.

    Eric

    • This reply was modified 8 months, 1 week ago by  e_durose.
    • This reply was modified 8 months, 1 week ago by  e_durose.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Document Attachments Redirecting Issue’ is closed to new replies.