Skip to:

Display email on profilepage

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

  • islandcastaway


    for a displayed user – stored in `$bp->displayed_user->userdata` (bp automagically pulls in the userdata from bp_core_get_core_userdata during setup_globals)

    so for the email address `$bp->displayed_user->userdata->user_email` just create a function around that to echo and hook on an action (ie, `bp_before_member_header_meta` ) used in the member profile template



    Keep in mind that spambots are very likely to harvest those emails if you don’t have some privacy filters set in place.



    Hi, I am interested in people who are NOT login in (ie people browsing) to be able to send an email to a member from the member profile page. I was looking for a way to put an email form that does not show the members mail in the code, so it can’t be seen by bots or in the source. I considered trying to use the private messaging system in buddypress. Anyone have any ideas?
    Essentially, Members pay to be on the site and set up a profile. Regular people (customers) can contact them without knowing the email of the member.



    @rich! If you wanna help, than please help to the end …
    Not all of us are coders, you know …. :-(
    Unless I would have programmed BP myslef, there is no way to make any sense of what you wrote …
    Where are those functions / actions defined?
    Can’t you please write the code here, so that also the less fortunate of us can understand?

    Thank you in advance!



    I’ve tried “
    but that doesn’t work :(

    The only other thing I can think of is adding another field to the Profile called “public email”, but then users have to enter their email address twice, and I can imagine that could confuse some people.



    Hi there,

    function getDisplayedUserEmail() {
    global $bp;
    global $wpdb;

    $id = $bp->displayed_user->id;
    $request = “SELECT * FROM $wpdb->users WHERE ID =” . $id . “”;
    $result = $wpdb->get_row($request, ARRAY_A);

    return $result;

    Here is a possible solution. Just copy/paste into either function.php or bp-custom.php. I had to this through database query, because I could not find a bp-function for this, or none of them worked for me.
    I’m not a PHP coder so If you can simplify the code, or do it better, feel free to modify it.

    You have to call this function in ‘profile-loop.php’. You can find that in members/single/profile/ template folder.
    You can call it after the endwhile or whereever you want.



    People if your not a coder, dont expect stuff for free.

    Rich gave you the best solution.



    function DisplayedUserEmail() {
    global $bp;
    echo $bp->displayed_user->userdata->user_email;
    add_action( ‘bp_before_member_header_meta’, ‘DisplayedUserEmail’ ); // find the appropriate action where to you want to hook the action

    or you can still call the function itself



    Maybe I am missing something here but seems like what your looking at doing could be easily done with the following command:


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Display email on profilepage’ is closed to new replies.
Skip to toolbar