Info
- 20 posts
- 5 voices
- Started 2 years ago by kirpi.it
- Latest reply from James Blacker
- This topic is resolved
How to keep just Display Name which links to Profile in posts
-
- Posted 2 years ago #
The default Kakumei theme shows two variables in the user section of every post, at left.
You can see them both here as well, in this very post.
The first one is defined in the profile page asDisplay name asand links to whatever appears in theWebsitefield.
The second one is defined in the profile page asUser Type(which most often defaults toMember), links to theProfilepage of the specific user, and could be changed by theCustom Titlefield.How would it be possible to drop the
User Typeand just keep theDisplay name aslinking to the userProfilepage? -
- Posted 2 years ago #
You can edit your theme or use this plugin http://bbpress.org/plugins/topic/post-count-plus/ it will give you teh option to what links to what.
-
- Posted 2 years ago #
Plugins are good but as my humble experience goes the less I use of them the better: it is not rare that they conflict with each other. In other cases they also switch unexpected behaviours somewhere. Moreover, that plugin seems to be much more than I need.
Most probably in this very case a simple code edit in the right template would do, but I do not know where and how to touch. Does anybody have an idea of the needed change, please?
-
- Posted 2 years ago #
post.php
-
- Posted 2 years ago #
So in
post.phpthere is this code
<p> <strong><?php post_author_link(); ?></strong><br /> <small><?php post_author_title_link(); ?></small> </p>which should be changed into...?
The point is that just dropping thepost_author_title_link();wouldn't do.
I need to first have the author display name link to his/her profile page.
But I have no clue... -
- Posted 2 years ago #
just take out "_link"
-
- Posted 2 years ago #
No.
I need to have the author display name link to his/her profile page. -
- Posted 2 years ago #
<a href="profile.php?id=<?php echo get_post_author_id(); ?>"><?php post_author();?></a> -
- Posted 2 years ago #
Yet something is wrong. It does not work.
Link should most probably look like
http://www.example.com/forum/profile/userThe right code is probably hidden in the header, where it says
Welcome, User | Log OutThat
Userlink is the one I'm after, but cannot find out how it is built. -
- Posted 2 years ago #
It's generated by the template
logged-in.php, which in Kakumei looks like:
<p class="login"> <?php printf(__('Welcome, %1$s'), bb_get_profile_link(bb_get_current_user_info( 'name' )));?> <?php bb_admin_link( 'before= | ' );?> | <?php bb_logout_link(); ?> </p>So you'd want
bb_get_profile_link(bb_get_current_user_info( 'name' )) -
- Posted 2 years ago #
So, if I now understand right, I cannot use any piece of it.
:-(Would it really be that hard to get the poster name and link it to his/her profile page, quite simply?
I cannot find how. -
- Posted 2 years ago #
bb_get_profile_link(post_author()) would probably work
-
- Posted 2 years ago #
Yes, this seems to do the trick
<a href="http://www.example.com/forum/profile/<?php bb_get_profile_link(post_author()); ?>"> <?php bb_get_profile_link(post_author()); ?> </a>Hardcoding the path is not nice, but at least it works.
:-)
Thank you! -
- Posted 2 years ago #
You shouldn't need the separate
<a>tag, that function should be returning a complete<a>tag with the text passed to it (or using the ID number if one is given) -
- Posted 2 years ago #
sorry about that. I forget people use permalinks.
-
- Posted 2 years ago #
Nope, Kawauso.
<?php bb_get_profile_link(post_author()); ?>
just renders the poster name, without any link. -
- Posted 2 years ago #
Do this:
<a href="<?php echo esc_attr( get_user_profile_link( get_post_author_id() ) ); ?>"><?php echo get_post_author(); ?></a> -
- Posted 2 years ago #
<?php bb_profile_link( array( 'id' => get_post_author_id(), 'text' => get_post_author() ) ); ?>@bbback: you can avoid echoing
get_functions by dropping theget_, there's always an echo alias function@kirpi.it: my bad, I left it using an echo function rather than returning the output
-
- Posted 2 years ago #
Ok, this one works smooth!
:-)
Thanks again. -
- Posted 1 year ago #
Tom also provided the follwing, which worked for me after I couldn't get any of the above to work.
http://bbpress.org/forums/topic/are-usernames-with-spaces-sensible
-
You must log in to post.