Skip to:
Content
Pages
Categories
Search
Top
Bottom

Replace firstname user in topic by other field


  • wprog
    Participant

    @wprog

    Hi,
    I want hide the firstname and lastname of the user in each topics of my forum bbPress.
    It’s possible to replace by other field? Like custom field for example or username.
    Thx
    Have a nice day

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

  • Robin W
    Moderator

    @robin-w

    You can manually change any set up already from their profile.

    For new users you can change this at registration
    eg

    function change_display_name( $user_id ) {
     $info = get_userdata( $user_id );
     $args = array(
     'ID' => $user_id,
     'display_name' => $info->first_name . ' ' . $info->last_name
     );
     wp_update_user( $args );
    }
    add_action('user_register','change_display_name');

    you have options of
    ‘display_name’ => $info->user_login
    or
    ‘display_name’ => $info->user_email
    or
    ‘display_name’ => $info->user_nicename

    or if you have a custom field, you can use that

    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


    wprog
    Participant

    @wprog

    Hi, ok great thanks.

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