I’m trying to change the appearance of the header so when a user is logged, he or she sees their username currently, but I’d rather they see their first name in that area, as i ask for it at registration. I have seen a topic similar 2 years ago but the path /hivepress/templates/user/login/user-login-link.php does not exist in meetinghive theme.
Merci, however when selected, it only updates the name in the card not the name in the header. Am I missing something?
Hi,
If you are referring to the name in the header, namely Account, then username will always be displayed there.
P.S. Please post in English (e.g. via Google Translate); this way, questions/answers may also be helpful for others.
Thanks Andrii, is there any way to override with a child theme ?
Hello,
It should work. At least it does for me.
You just need to refresh page globally (hit F5 key)
I suspect the refresh in only partial (due to ajax ? ) when you submit the form.
very interesting indeed, are you sure you have not made a change in a child theme or a code snippet cause f5, clearing cache, etc. just does not do it …
Hello,
You are right, I actually did a lot of experiments, tweaks and hacks.
in my child-theme I have a copy of user-login-link.php
file.
(under \themes\my-child-theme\hivepress\user\login
)
And among other changes, I have this :
<span><?php echo esc_html( $user->display_name ); ?></span>
BTW, I am not using meetinghive as main theme, but taskhive, but it should work the same as the file is copied from the hivepress plugin, not the theme, as far as I remember.
I’m interested in making the same change.
I copied the user-login-link.php
file to my child theme, and tried replacing:
<span><?php echo esc_html( hivepress()->request->get_user()->get_username() ); ?></span>
with <span><?php echo esc_html( $user->display_name ); ?></span>
But when I checked the front-end, it only shows the ‘person icon’ but no name now.
This is how the original file looks for me:
<?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
if ( is_user_logged_in() ) :
?>
<a href="<?php echo esc_url( hivepress()->router->get_url( 'user_account_page' ) ); ?>" class="hp-menu__item hp-menu__item--user-account hp-link">
<i class="hp-icon fas fa-user"></i>
<span><?php echo esc_html( hivepress()->request->get_user()->get_username() ); ?></span>
<?php if ( hivepress()->request->get_context( 'notice_count' ) ) : ?>
<small><?php echo esc_html( hivepress()->request->get_context( 'notice_count' ) ); ?></small>
<?php endif; ?>
</a>
<?php elseif ( get_option( 'hp_user_enable_registration', true ) ) : ?>
<a href="#user_login_modal" class="hp-menu__item hp-menu__item--user-login hp-link">
<i class="hp-icon fas fa-sign-in-alt"></i>
<span><?php esc_html_e( 'Sign In', 'hivepress' ); ?></span>
</a>
<?php
endif;
Much appreciated if @condorito.fr / @ihor or @andrii are able to help tweak this accordingly!
Please read this :
Right i see … i picked up user-login-link.php from the plugging, pasted it in my child theme and updated the line to be <?php echo esc_html( $user->first_name ); ?>
Thanks for sharing the picture code too i have added that too ! I can now focus to all my other customisation !
Many thanks for passing on the link @condorito.fr - I’ll try this out once I’ve solved a few other issues!