Support » Plugin: WP-Members: Membership Framework » need to securiy attachment rather than the_content; what code do I change?

  • I’m trying to allow the post content to remain visible, but require a login to download the attachment to a page. I see that line 146 of wp-members.php puts security on the_content:
    add_filter( ‘the_content’, ‘wpmem_securify’, 1, 1 ); // securifies the_content

    With what do I replace “the_content” in that line to securify the attachment instead?


Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chad Butler


    Don’t take this the wrong way, but your question is the equivalent of, “How do I change my Jet Ski to be a Snowmobile? What do I change on the throttle to make it run on snow?”

    The line of code you want to change is a specific hook in WordPress. It passes the_content through the function wpmem_securify.

    That function is designed specifically to filter the value of the_content and return results based on various criteria. You can’t change what wpmem_securify is hooked to an expect a valid result.

    If what you want to do is hide a link from non-logged in users, you can do that with the plugin’s status shortcode (i.e. [wp-members status=”in”]some text here[/wp-members] ). However, that does not prevent the link from being accessed if it is known. For that you need to prevent access to the file with something like .htaccess.

    That makes sense…and I think the shortcode you mentioned will help me with what I need. (I didn’t see that anywhere in the documentation) Thanks so much for the help!

    Actually, what is the equivalent php code for that shortcode? If it’s in the documentation, can you guide me to where I can find it? (I need to place it in a post template file)

    Thanks again. 🙂

    Sorry for the multiple replies…I just tried the shortcode, but it simply hides the content without prompting the user for a login, which doesn’t fit what is needed. Do you know of any possible solutions to require a login for something other than the main page text?

    Plugin Author Chad Butler


    If you want to prompt for login, add the login page shortcode nested in a status=”out” shortcode. So altogether for this page you have:

    [wp-members status=”in”]some text here[/wp-members]
    [wp-members status=”out”]
    [wp-members page=”login”]

    Thanks! How would I utilize that as a php function (rather than a shortcode), to conditionally append code/text to the_content in a php file?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘need to securiy attachment rather than the_content; what code do I change?’ is closed to new replies.