Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Check if on profile of an admin?


  • learntodesign
    Participant

    @learntodesign

    Hello, how do you check if you are viewing an admin’s profile?

    I know that you can use bp_is_my_profile to check whether or not you are viewing your profile but how do I add a further check to see whether that profile is that of an administrator’s? I don’t want it to interfere with whether or not the logged in user is an admin.

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

  • mrjarbenne
    Participant

    @mrjarbenne

    You could use something like this to add a badge to admin/verified users.

    https://wordpress.org/plugins/buddypress-verified/


    learntodesign
    Participant

    @learntodesign

    And then check if the user has a specific badge? I guess thats an idea. Thank you.


    mrjarbenne
    Participant

    @mrjarbenne

    I think I assumed that your end goal was users knowing who the admin on the site were. I don’t know that I would use this to programmatically account for who an admin is. That said, you could probably fork this code to apply a badge based on user capability rather than something that gets manually applied.


    mrjarbenne
    Participant

    @mrjarbenne

    If I’ve read this wrong and you are just trying to sort out who an admin is, the best way to check for a role is via user capabilities (https://codex.wordpress.org/Roles_and_Capabilities). So checking to see if the users can “activate_plugins” will let you identify whether they have the admin role or not.


    learntodesign
    Participant

    @learntodesign

    Hi mrjarbenne. That’s still not exactly what I was looking for. I was just inquiring if it is possible if you can programatically check if a buddypress profile page belongs to an administrator vs. belongs to a regular user. I don’t think it was possible from what I found but its ok and I will mark as resolved because I have found a workaround for what I was doing. Thank you.


    Henry Wright
    Moderator

    @henrywright

    This is possible. As @mrjarbenne said you can check the capabilities of the displayed user.


    danbp
    Participant

    @danbp

    if ( current_user_can( 'manage_options' ) ) or if ( is_super_admin( bp_loggedin_user_id() ) )


    learntodesign
    Participant

    @learntodesign

    Thanks Dan! I will keep those in mind.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Check if on profile of an admin?’ is closed to new replies.
Skip to toolbar