WordPress.org

Ready to get started?Download WordPress

Forums

Membership
[resolved] show_moretag_protection on single posts only (2 posts)

  1. Chris Van Patten
    Member
    Posted 1 year ago #

    I'm using Membership Lite (latest version as of this post), and specifically the ability to hide content after a "more tag" to non-members.

    I've set up the text I want to show to non-members in the "Options > Content Protection > No access message" area, and that works fine.

    My problem is that this "No access message" displays on archive pages and my site's front page. I'd prefer that archive pages and blog pages look completely identical for registered and non-registered users, but Single posts display the message as appropriate.

    I've hacked this into place myself, in the file membership/membershipincludes/classes/membershippublic.php. Line 135 originally read:

    add_filter('the_content_more_link', array(&$this, 'show_moretag_protection'), 99, 2);

    I've just added a conditional around that:

    if ( is_single() ) {
    add_filter('the_content_more_link', array(&$this, 'show_moretag_protection'), 99, 2);
    }

    This fix makes the "more tag" capability work as desired.

    Obviously though, editing the plugin directly is (to put it mildly) not ideal. So my question, I suppose, is this: is there a hook I can use to override the show_moretag_protection function, or is this a feature that could be added to the plugin? There could be a checkbox option that says "Show 'No access message' on single posts only", or something to that effect.

    Thanks in advance for the help!

    http://wordpress.org/extend/plugins/membership/

  2. Mike
    WPMU DEV Support Staff
    Posted 1 year ago #

    Hi @Chris Van Patten

    This isn't something that is configurable but I'll mention it to the developer.

    Instead of modifying the plugin files, how about adding a remove_filter and re-declaring it in your functions.php, this means that you won't lose the change when updating.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.