WordPress.org

Ready to get started?Download WordPress

Forums

Active Directory Integration
How to display AD user attributes in template (4 posts)

  1. mistercyril
    Member
    Posted 3 years ago #

    Hello,

    I am using the "Additional User Attributes" to get some additional data from Active Directory. Its displaying in the WordPress dashboard (on user profiles), but how can I display this in my template?

    I have a custom BuddyPress member loop, and would like to be able to display the "Additional User Attributes" next to each member.

    For buddypress profile fields I use :
    <?php bp_member_profile_data('field=fieldname'); ?>

    So what could I use to display the AD fields?

    Thanks,
    C.

  2. stimsonm
    Member
    Posted 2 years ago #

    Did you ever figure this out?

  3. mistercyril
    Member
    Posted 2 years ago #

    Unfortunately no... Anything related to BuddyPress is usually pretty hard to get support for.

    If you ever figure it out, please do share.

  4. stimsonm
    Member
    Posted 2 years ago #

    I believe I figured this out. In the database there is a table called wp_usermeta where there are keys stored under the meta field which are all the additional attributes that come in with AD. In wp-content/plugins/buyddypress/bp-themes/bp-default/members/single/profile/profile-loop.php you add the following code after line 25 where it has this:
    <td class="data"><?php bp_the_profile_field_value(); ?></td>

    Add the following after:

    <td>
    <?php
    global $bp;
    $adi_mail = get_user_meta( $bp->displayed_user->id, 'adi_mail', true );
    echo '<p>Email: ' . $adi_mail . '</p>';
    $adi_department = get_user_meta( $bp->displayed_user->id, 'adi_department', true );
    echo '<p>Department: ' . $adi_department . '</p>';
    ?>
    </td>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic