WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] WP-Members not blocking when using SEARCH (6 posts)

  1. plus4dBu
    Member
    Posted 3 years ago #

    Is there a way to ensure a post/page is blocked when using a search field in a wordpress theme?

    I've created a page containing keywords (for search) that is blocked. When I go directly to the page, it prompts me for login details... good.

    But when I use the search field to pull a keyword (from my blocked page), instead of being prompted with a restricted/login message, I can see the page directly.

    Any ideas?

    Also, is there a way to block certain content within a page?

    Thanks!

    http://wordpress.org/extend/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    In most cases, the search result is going to provide an excerpt for content in both pages and posts. If the content is protected, users will be prompted for login (if they aren't already) when they click to read the entire article.

    If you are getting full content and not excerpts in your search results, you may need to make some edits to your theme's search results template (or settings). There are many ways to do this. Depending on your theme, it may not be advisable to do direct edits (many themes are now upgradeable via the wp admin, and therefore any changes are likely to be overwritten). In that case, you might use some customizations added to your functions.php file.

    Here is a sample to set excerpts at a specific length:

    add_filter('excerpt_length', 'chg_excerpt_length');
    function chg_excerpt_length($length)
    {
        // set the number to whatever number of
        // words you want the excerpt to be.
        return 20;
    }

    Here's some that will trim it at the 'more' tag (must be using the 'more' tag on all protected content for this to work):

    add_filter('the_excerpt', 'get_excerpt_len');
    function get_excerpt_len()
    {
        $content = the_content;
        $len = strpos($content, 'more');
        $len = $len-10;
        return $len;
    }

    Hope this helps and/or gives you some ideas.

  3. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    oh, for your question about content within pages... at present it's an all-or-none kind of blocking, but I may in the future add a shortcode to block specific content within a post or page.

  4. plus4dBu
    Member
    Posted 3 years ago #

    CButler!
    Thank you for the reply.

    I actually figured a way around it. I installed a hide post/page plug in and utilized the MORE insertion tag. So far so good. ;)

    I have another question, off topic. I have installed the login into a sidebar widget.

    Is it possible to also include a link below (where the user login fields are) to a new user registration page?

    Currently, i have a login in a sidebar and a page with the <!--members-area--> tag. I'd like to omit the page, and just have all the info (login fields and new user registration link) in my sidebar.

    Thank you for the excellent plugin!

  5. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    The feature you mentioned is included in the upcoming 2.5.1 release. The revised login widget will have links for forgot password and new users register (provided the admin specifies the location of the members-area and register pages in the settings).

    I'm not sure when this update will be finalized for release, but I expect to have it done soon.

    (This update also includes new and improved table-less forms with more CSS control.)

  6. plus4dBu
    Member
    Posted 3 years ago #

    thanks! looking forward to the update.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags