Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display author email with topic


  • sharon9923
    Participant

    @sharon9923

    We plan to create a public, moderated bulletin board that needs to display author contact information. Is there a PHP function that could be used to display the author’s email address with their topic? Note, authors will not be logged into the website, but a modertor will approve a topic before it is displayed to the public.

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

  • Robin W
    Moderator

    @robin-w

    This will display emails in topics

    add_action( 'bbp_theme_after_reply_author_details', 'rew_author_email' );
    
    function rew_author_email () {
    	$id = bbp_get_reply_id() ;
    	if (bbp_is_topic( $id ) ) {
    		$author_id      = bbp_get_topic_author_id( $id );
    		$user_info = get_userdata($author_id );
    		$user_email = $user_info->user_email;
    		echo $user_email;
    		
    	}
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    sharon9923
    Participant

    @sharon9923

    Thank you, this is very helpful!


    Robin W
    Moderator

    @robin-w

    🙂

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