Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • @texet

    Participant

    OK, I think I fixed the code. Seems to work for me. Can anyone test and confirm?

    <?php
    global $bp;
    $potential_friend_id = $bp->displayed_user->id;
    $friend_requester_id = $bp->loggedin_user->id;
    $friend_status = BP_Friends_Friendship::check_is_friend( $friend_requester_id, $potential_friend_id );
    if ( $friend_status != 'is_friend' && $potential_friend_id != $friend_requester_id) {
    echo '<br><br>Oops! You must be friends with <div style="font-weight:bold; display:inline">' . $bp->bp_options_title . '</div> to view this profile.<br>Click the "Add Friend" button above to request friendship.' . bp_add_friend_button();
    } else { ?>

    … do stuff …

    <?php } ?>

    @texet

    Participant

    actually, there is something wrong with this code I posted.

    Will need to check and get back to you

    @texet

    Participant

    dumb question, but isn’t that what the wire does already?

    @texet

    Participant

    @Pcrain

    When i placed your code,it shows this error message

    Fatal error: Cannot use object of type stdClass as array in /home/username/public_html/sitename/wp-content/bp-themes/bpmember/friends/index.php on line 13

    If you update your code thusly, it should work:

    <?php

    global $bp, $wpmu;
    $potential_friend_id = $bp->displayed_user;
    $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user, $potential_friend_id );
    if ( $friend_status != 'is_friend' && $potential_friend_id != $bp->loggedin_user) {
    echo "You must be friends to view this profile.".bp_add_friend_button();
    } else { ?>

    And of course add the

    <?php } ?>

    at the end.

    @texet

    Participant

    I cast another “yes” vote for moving privacy controls ahead of version 1.2. Even if the first version of privacy controls is super simple. Thanks!

    @texet

    Participant

    THANKS Burt for the elegant hack!!

    Should be part of the core BP option set…!

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar