WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
Comments Links (6 posts)

  1. tnandrick
    Member
    Posted 3 years ago #

    Hi,

    I'm not sure if this is a bug or a plugin conflict, but...

    In the comments section, the link that should allow the user to "Reply" always displays "Log-in to reply". Login attempts go to the backend login, and then are redirected to the page, but w/the same "Log-in to reply" link displayed.

    I'm using Atahualpa, and also switched to default Twenty Ten to see if that made a difference. It did not.

    Tim

  2. tnandrick
    Member
    Posted 3 years ago #

    Follow up from testing:

    I went the long way around on this, but here goes...

    I checked this against a "vanilla" install of WP that had no plugins, a test site that I maintain to check for stuff like this. Still the behavior persisted. (Bang head against wall)

    Then I dug back into manage options on WP-Members. With the "Block posts by default" on, this went away. There was a choice to "reply" again. If custom fields were added to "unblock" specific posts, then it reverts back to the old behavior.

    Perhaps this isn't a bug, maybe it is the desired behavior of the plug-in?

    In my case, this isn't the behavior I would want. I would like most posts "open", and the ability to read comments, but only allow registered users to post comments.

    As of right now, the plug-in uses a kind of "all or nothing" approach. Commenting is either open to everyone (if users must be registered to comment is set "off"), or closed to everyone except registered users. And it is a real problem if registered users cannot reply to a comment that is "open" to the public.

  3. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    The plugin only manages comments in so far as they are viewable or not. The intention is that if a post is blocked, then the only users that can view the comments are registered users. If the post is open to the public, then the comments are viewable.

    All of the rest of the comment action is managed by WordPress. If you set the WordPress options to "Users must be registered and logged in to comment," then only registered users may comment. When this setting is set, only registered users may comment and that action is true on both blocked and unblocked posts, but only registered users may view comments on posts that are blocked.

    As far as the issue of the links, that is somewhat dependent upon WordPress and somewhat dependent upon your theme. The plugin has to remain as plug-and-play as possible, and due to the current complex nature of today's theming evironment, where themes attempt to be much more than just design, there are limits to what can be put in place. So the plugin determines the user's login state, the block/unblock status of the content, and shows or doesn't show based on that. The rest is up to the theme and WordPress.

    If one is comfortable with working within the theme (preferably a child theme), it is fairly simple to take things a step further. For example, somewhere in every theme you are likely to have the following call:

    <?php comments_template( '', true ); ?>

    Instead, you could check the user's login state and decide what to show them based on that:

    <?php if ( is_user_logged_in() ) {
    
    	comments_template( '', true );
    
    } else { ?>
    
    	<p>Whatever you want to say about being logged in to participate in the discussion.<a href="#">A link to login or something else</a></p>
    
    <?php } ?>

    The plugin is flexible in this regard because it is only determining whether or not to show users the comments. I hope this clears some things up and gives you some ideas of getting to the behavior that you are looking for.

  4. tnandrick
    Member
    Posted 3 years ago #

    Thank you for the response, Chad.
    For the sake of argument, let's throw away what I *want*... if I feel I need to change something, I'll dig into the code and do it, but to me this seems to be an issue of functionality. Perhaps I was not clear enough before, so here are the factors:

    1. Post is public
    2. Comments are set to "must be logged in to post comments"
    3. I am logged in
    4. I can post new comments (comment form is displayed, says "you're are logged in as user "X"), but...
    5. The reply link says, "you must be logged in to reply"
    6. If you click the reply link, it takes you to the backend to login
    7. When you come back, the reply link says, "you must be logged in to reply"

    Bottom line: No matter what the settings for public/private status of posts, comment, etc., it is a real problem if a logged in user cannot reply to a comment.

    I understand what you are saying about different theme factors, but like I said in my first post, the reply link is like this in Twenty Ten too. Somewhere between the theme and the plugin, it is not recognizing that a user is logged in to reply.

    Thanks,
    Tim

  5. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    Ahhh... I think I follow this now. You can post a new comment, but the reply link is not recognized is where I was getting tripped up. I am running a test system with Twenty Ten and I could post a new comment so I was wondering where the problem was, but I see I am getting an issue with the reply as well. I will look into that and get back to you.

    Also, on a side note, I thought of this regarding the direction to the backend login is created from a wp function login_url, which you can filter. If you created a login page with the plugin using the shortcode, you could filter to go there (although it does not currently redirect back - maybe that'll get changed in the future).

    function my_login_url($login_url = '') {
    	$login_url = 'http://yourdomain.com/login-shortcode-page';
    	return $login_url;
    }
    add_filter('login_url', 'my_login_url');

    Just a general thought - it may give you some additional ideas.

    I'll look into this other thing over the weekend and get back to you.

  6. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    Ok, I have the short term fix for this. In wp-members-core.php, at line 131, you should find:

    } elseif ( is_user_logged_in() && get_option('comment_registration') == 1 ) {
    
    		global $user_ID;
    		$user_ID = '';
    
    	}

    Fix this by commenting out or removing this line:

    $user_ID = '';

    This is one of those things that you look at and say, "What was I thinking when I put this in?" I had been working on some changes to the core in this version that would allow the comments to be handled appropriately without having to add any code snippets to the theme's comments.php file (as previous versions had done). This was obviously part of that process, but honestly, this part of it - looking at it now, doesn't make any sense. So I'm not sure how it made it in.

    I'm working on a bug fix release 2.5.3 that will include some bug fixes for the registration process. I'll work on fixing the comments as well and include that in this release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags