Skip to:
Content
Pages
Categories
Search
Top
Bottom

false check on bp_is_my_profile() messes up layout


  • njones7
    Participant

    @njones7

    Title is pretty self explanatory but im doing a false check to see if the profile being viewed is NOT that the one of the logged in user, however this is causing my page layout to become heaps messed up and im not sure why since none of the other code changes. Any ideas on why this is happening or if there is a better way to go about this?

    Wordpress: 4.8.2
    Buddypress: 2.9.1

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

  • shanebp
    Moderator

    @shanebp

    Your issue is due to implementation.
    But without knowing how you are implementing, it is impossible to offer suggestions.
    If you create a gist of your code and post the link here, somebody may have a suggestion.


    njones7
    Participant

    @njones7

    https://gist.github.com/anonymous/53a6c1369a1ad21c7259a5d2f41da845

    this is the code to display the number with **** to replace the last 4 digits, i am using JS to control the toggle of the number so when clicked will reveal the digits. It works like this but when i change the if statement to;

    if (current_user_can('client') && !bp_is_my_profile())

    it throws the entire profile page layout out of wack.


    shanebp
    Moderator

    @shanebp

    Are you sure bp_is_my_profile() is working in that context ?
    Place a test above your if, something like:

    if ( bp_is_my_profile() ) echo 'YES';
    else echo 'NO';

    njones7
    Participant

    @njones7

    Okay so that seems to work alright, echoing YES on own profile and NO on other profile (and the opposite if i put !bp_is_my_profile(), it also doesn’t seem to mess up the layout just doing it like that so (somehow) when used in that small bit of code and only as !bp_is_my_profile (a true check works but its not what i need) the layout messes up.


    njones7
    Participant

    @njones7

    FIXED

    Ended up nesting my original if code within a !bp_is_my_profile() if condition which worked.

    Thanks for the light bulb moment @shanebp

    Closed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar