Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Hide User ID from public view


  • csimpson
    Participant

    @csimpson

    hi everyone, just wondering if anyone knows how to hide data from public view? As i cannot see any great way to implement a membership id number (using membership plugin from wpmu as well), i am pulling in the userid field and displaying on the profile page.

    I want only the user and admins to see this userid, i do not want other users to see each others user ids. Here is what i have within member-header.php within child theme so far and works, except hiding from all members.

    <?php bp_displayed_user_id(); echo bp_displayed_user_id(); ?>

    thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Implementing a user membership ID is a question for the plugin authors.

    Hiding a WP user ID if you are going to display it is simple enough, wrap the display in a ‘if’ conditional that checks current_user_can(‘update_plugins’) or similar admin only capability (look them up on the WP codex)

    You could also check what role the user has assigned which is a slightly more complex procedure better suited to functions, prefer it personally but not in templates.


    csimpson
    Participant

    @csimpson

    Hi Hugo, unfortunately i’m not much of a programmer at the moment, ive searched the web for an answer out there already but with no success.

    Also discussed with plugin author and on post here at BP HQ, but this appears to be best/easiest option.


    shanebp
    Moderator

    @shanebp

    if( bp_is_my_profile()  || is_super_admin() )
        echo bp_displayed_user_id();

    There you go shanebp’s given you an easier option 🙂


    csimpson
    Participant

    @csimpson

    absolutely brilliant! thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Hide User ID from public view’ is closed to new replies.
Skip to toolbar