Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21746

    I have trying to figure out how I can show only the comment authors first name and last name. I do not want to show the user name or email. How do I do this? Which file do I edit?

    #112930

    I think this is a css issue but I’m not sure where I should look. Any ideas?

    #112931

    Hi camillaanders,

    I’m not sure about the email as that shouldn’t be showing by default but you can change what name is displayed via your wordpress options. Go to Users>Your Profiel and where it has the option for “Display name publicly as” choose the style you want.

    Regards,

    Devin

    #112932

    I solved the problem by adding a new plugin that will force all users to display first and last author names.

    I added a new directory into the wp-content/plugins called: substitute_displayname.

    I created a file called: substitute_displayname.php

    and added the following code into the file:

    <?php

    /*

    Plugin Name: Substitute Displayname

    Version: 0.1

    Description: Substitutes a default Display name for new registrants.

    Author: Mac McDonald

    */

    ?>

    <?php

    /* Version check */

    global $wp_version;

    $exit_msg=’Substitute Author requires WordPress 2.5 or newer. Please update!‘;

    if (version_compare($wp_version,”2.5″,”<”)) {

    exit ($exit_msg);

    }

    function sd_new_login_filter ($login) {

    /* Don’t do anything to login, just see if already in database.*/

    global $wpdb, $sd_is_new_login;

    $id = $wpdb->get_var(“SELECT ID FROM $wpdb->users WHERE user_login = ‘$login’”);

    $sd_is_new_login = (isset($id)) ? false : true;

    return $login;

    }

    function sd_substitute_displayname_filter ($display_name) {

    global $sd_is_new_login;

    if ($sd_is_new_login) $display_name = $_POST.” “.$_POST;

    return $display_name;

    }

    add_filter(‘pre_user_login’, ‘sd_new_login_filter’);

    add_filter(‘pre_user_display_name’, ‘sd_substitute_displayname_filter’);

    ?>

    the code does exactly what I want. It forces all users to display their first and last author names.

    Another problem solved.

    #112933

    Glad you found a working solution and thank you for posting it :)

    Regards,

    Devin

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘show comment author first name and last name.’ is closed to new replies.