[resolved] How to make the Articles and Category lists visible to members (5 posts)

  1. Nadege78
    Posted 3 years ago #

    Good morning,

    I try to make a private blog.
    I'm using WP-members to restrein access and declare all my articles as Private.
    That works perfectly but members can not see the list of Recent articles and the Caterogy List.
    How could I modify this ?

    I'd also like Members to go directly to the Articles section once logged in.

    I am not a developper and require help on those subjects.

    Thank you in advance for your kind cooperation.

  2. Chad Butler
    Posted 3 years ago #

    First, since what you want to do is outside of how the plugin is designed to flow, you'll need to get some WordPress development knowledge. You'll need to understand how templates work in the theme and how The Loop works withing the template. Start with these:

    What you'll need to do is make some customizations to your template that displays your lists of articles. Here is an article that pertains to customizing the template in a similar way, although not specifically to this purpose. Essentially, what you need is something like this:

    <?php if( is_user_logged_in() ) {
        // the loop goes here
    } else {
        // the user is not logged in
        // display the user login and registration
        if( function_exists( 'wpmem_securify' ) )
            // display login prompt as on other pages
    } ?>

    (Note: this is not a plug-and-play code snippet - you'll need to figure out what is going to work with your specific situation, theme, etc.)

    As for the redirect on login, that's easy as the new 2.7.1 version has a redirect filter hook. All you need for that is something like this in your theme's functions.php file:

    add_filter( 'wpmem_login_redirect', 'my_login_redirect' );
    function my_login_redirect()
    	// change the url to where you are redirecting to
    	$url = 'http://yourdomain.com/your-page'
    	return $url;
  3. Nadege78
    Posted 3 years ago #

    Thank you, Chad, for your quick answer.

    I do not think I have the required knowledge to modify the templates or the loop.

    If I choose to protect all my pages, it's because you can access any page or article through the category list though, "I checked the Block Posts" by default and "Block Pages by default" options.
    You can check at http://www.clubmedgymmyblog.com (I unprotected my pages and articles).

    Is that normal ??? What is wrong with my blog ?

    Even if I get rid of the side bard, anybody can use permalinks to access to the blog...

    As I told you I know little about php...

    Thank you in advance for your anwser

  4. Chad Butler
    Posted 3 years ago #

    The plugin is designed to have a certain type of process flow which is generally to give users teaser content using post excerpts and require login for the full article. (It does not appear that you are using the 'more' tag in your posts, which is what creates the post excerpt.) Although there are users that use the various features in different ways, that is the basic flow.

    For what you have described, it's going to take some modifications on your end, as I pointed out earlier. Without any php knowledge, that is going to be difficult.

  5. Nadege78
    Posted 3 years ago #

    Good evening Chad,

    I found an easier solution to solve my problem.
    I simply installed S. Matern's plugin Capa that protects Category and Pages.

    Hope that information could help someone.

Topic Closed

This topic has been closed to new replies.

About this Topic