• Resolved tamritz

    (@tamritz)


    Hi. The problem of comments appearing is now on my Members page. I am posting the code from the page.php file for you to take a look. I played with the code by adding a bp_is_members_page to the same string that helped below, but this rips out the sidebar and makes the whole page the same color. (And I am sure it is my code that is not correct.) Thanks.

    Here is current code. What could I tweak to remove comments from appearing on the members page? And Ps. It’s so strange this is occurring because my other site has same set up and the comments are not appearing on its members page.

    <?php if ( ! bp_is_register_page() && ! bp_is_activation_page() ) : ?>
    <?php comments_template(); ?>
    <?php endif; ?>

Viewing 11 replies - 1 through 11 (of 11 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    I believe if you are needing to hide it on the Members directory, you’ll want to use

    bp_is_members_directory()

    So

    <?php if ( ! bp_is_register_page() && ! bp_is_activation_page() && ! bp_is_members_directory() ) : ?>
    <?php comments_template(); ?>
    <?php endif; ?>
    Thread Starter tamritz

    (@tamritz)

    This worked beautifully. Thanks.

    Here is what I learned. This happened when I updated to the latest version of BuddyPress (2.2.0) (the impact on the members directory page). For the previous version, the badgework comments only showed up on the activate and register pages. I tested this out by installing the previous version.

    The quickfix without the code is to use a fullwidth page template, rather than the default w/the sidebar.

    At any rate, adding the bp_is_members_directory() works!

    Thread Starter tamritz

    (@tamritz)

    Well, I thought I had this nicked. The comments appear on the bottom of each member’s profile page as well. I haven’t been able to hit upon the right phrase that corrects this.

    I tried
    bp_is_members_activity()
    bp_is_profile_page()

    Any help would be appreciated. Thanks.

    Thread Starter tamritz

    (@tamritz)

    Ok. I fixed it! I am all proud of myself. Here it is:
    bp_is_user_activity()

    Thanks for showing me models along the way that I can replicate. I really appreciate it!

    Thread Starter tamritz

    (@tamritz)

    Well, I thought I had this nicked. Unfortunaely, the new version of buddypress is a real pain.

    For each user’s profile, the badgework comments are appearing, showing all comments given to all learners in the community. Obviously, this should be private and the comments should be between the student and the badge earner.

    I have added the following:
    ! bp_is_register_page() && ! bp_is_activation_page() && ! bp_is_members_directory() && ! bp_is_user_activity() && ! bp_is_user_profile() && ! bp_is_user_notifications() && ! bp_is_user_friends()

    When I add this one: && ! bp_is_user_achievements() the entire sidebar goes away, which includes a widget for students to login to the site, as well as a widget that displays each user’s achievements. This bit of code does remove the unwanted comments, but gets in the way of the other functionality needed.

    This seems like a lot of adjustments around badge comments and the buddypress interface.

    Any thoughts on how to get around the comments appearing in the user’s profile when they click on “achievements” ?

    Thanks.

    Thread Starter tamritz

    (@tamritz)

    Ugh. And having same problem with comments appearing in users’ profiles when clicking on “forums.” How to block that as well without pulling out the sidebar for logging in.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    the easiest way around this, would be to just remove the <?php comments_template(); ?> line completely from the page.php template file, but a lot of that is that I don’t think pages need comments anyway 🙂

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    And i didn’t refresh my tab before hitting submit on that first reply. Not sure exactly what to do for all these cases.

    Perhaps try replacing all of them with

    if ( !is_buddypress() ) {
    comments_template();
    }

    Worth a shot.

    Thread Starter tamritz

    (@tamritz)

    OK. You are brilliant, if no one has not ever shared that with you before;

    I removed the php comments template line from the template file. Worked beautifully, and you are right, don’t need comments on pages.

    One question, just so I have clean code moving forward and not leaving cobwebs, so to speak…

    Should I remove the entire string or section beginning with:
    </div>

    <?php endwhile; ?>

    <?php endif; ?>

    <?php if ( ! bp_is_register_page() && ! bp_is_activation_page() && ! bp_is_members_directory() && ! bp_is_user_activity() && ! bp_is_user_profile() && ! bp_is_user_notifications() && ! bp_is_user_friends() && ! bp_is_user_groups() ) : ?>

    <?php endif; ?>

    I assume I don’t need the endif thing at all.

    Thanks.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    The <?php endif; ?>

    that’s above

    <?php if ( ! bp_is_register_page() && ! bp_is_activation_page() && ! bp_is_members_directory() && ! bp_is_user_activity() && ! bp_is_user_profile() && ! bp_is_user_notifications() && ! bp_is_user_friends() && ! bp_is_user_groups() ) : ?>

    should be left there unless you’re not removing the <?php endif; ?> at the very end of what you pasted. Essentially ONE of them needs to remain, which one you choose is up to you.

    The first <?php endif; ?> corresponds to your loop that displays the page content. The second <?php endif; ?> corresponds to the exponentially growing if statement that’s checking for BuddyPress stuff.

    Thread Starter tamritz

    (@tamritz)

    Got it. Thank you!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Comments Appearing on Members Page’ is closed to new replies.