Recent Topics

1 Jan 02, 2006 01:29    

Hello
I had or have an old version of b2evolution installed on an old server.
I had edited the _main.php template to show the Author's name under each post.
You could also click the Author's name to view all of his/her post.
Here is a link to my old blog so you can see what I'm talking about.
http://nucsa.webpal.info/blogs/
Well now I have installed the newest version on another server and can't figure out how to make the Author's name show under the post.

This is the code that I used in the old one to make it work.

Posted By <a href="<?php $Blog->disp( 'blogurl', 'raw' ) ?>?author=<?php the_author_ID() ?>" title="<?php echo T_('Browse all posts by this author') ?>"><?php $Item->Author->prefered_name() ?></a>

Thanks for any help. [/url]

2 Jan 02, 2006 02:49

What version are you using now, 0.9.1 (current stable) or 1.6 (alpha, prerelease)?

4 Jan 02, 2006 03:00

Here's the code I'm using on my 1.6 test blog (I haven't actually switched over because it's just an alpha):

<a href="<?php echo url_add_param( $Blog->get( 'blogurl', 'htmlattr' ), 'author='. $Item->Author->ID) ?>" title="Browse all posts by this author"><?php $Item->Author->preferred_name();  //the name of the author ?></a>

There's a second r in 'preferred' now, that's probably what your problem is.

5 Jan 02, 2006 04:24

I tryed it but it still won't work.
I put it every where I could think off with no luck.

Thanks

6 Jan 02, 2006 07:21

Give a link to your blog and a good description of what happens. Is there an error? The code I gave you should work.

7 Jan 02, 2006 08:02

Ok looks like I forgot the link in my first post so I went back and added it.

Now here's the link to my new blog the one I'm having trouble with.
http://www.nucsa.org/blogs/

The code you gave me is in the main.php script now.
It doesn't do any thing.
Everything works just like when I first installed it except I changed the linkblog around a little.

I'm not sure if I put the code you gave me in the right place.
I put it just under <div class="bSmallPrint">

So it looks like this.

<div class="bSmallPrint">

<a href="<?php echo url_add_param( $Blog->get( 'blogurl', 'htmlattr' ), 'author='. $Item->Author->ID) ?>" title="Browse all posts by this author"><?php $Item->Author->preferred_name(); //the name of the author ?></a>

<span class="bIcons">

<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><img src="<?php imgbase(); ?>chain_link.gif" alt="<?php echo T_('Permalink') ?>" width="14" height="14" class="middle" /></a>
</span>

8 Jan 02, 2006 15:51

If you look at the source code, the link is there. But there's no text in the link, so you don't see it. And look up in the small print above the post. The author name should be up there by default, but it's missing:

08:02:07 pm, by [Email icon] , 149 words . . .

So, the problem is not with your new code. I suspect that you don't have a preferred name entered for that user. Go to the users tab and make sure the fields are filled in.

9 Jan 02, 2006 16:23

I suspect that you don't have a preferred name entered for that user.

That's it now it works.

Thanks for all the help that you've gave me.

10 Jan 03, 2006 06:37

On the old one I always had the posted by at the bottum of the as I now have with the new ver. thanks to personman.
But after seeing the by author's name in the top of the post beside the Email icon I decided I wanted the author's name there to be clickable so you could browse all posts by this author from there.

So I played with the code a litte more.

Now it shows like this:
Posted By author's name email icon
08:02:07 pm, word count, 4 views country flag icon
Categories: Announcements [A]

And you can click on the author's name and browse all post by that author.

If anyone wants to set their blog up like this here's what you do.
Find skins\custom\_main.php or you can open _main.php on your blog by going into the admin section and click on the Templates tab and then click on _main.php.

Find this part of the code.

<div class="bSmallHead">
<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><img src="img/icon_minipost.gif" alt="<?php echo T_('Permalink') ?>" width="12" height="9" class="middle" /></a>
<?php
$Item->issue_time();
echo ', by ';
$Item->Author->preferred_name();
$Item->msgform_link( $Blog->get('msgformurl') );
echo ', ';
$Item->wordcount();
echo ' ', T_('words');
echo ', ';
$Item->views();
echo ' '.T_('views');
echo ' &nbsp; ';
locale_flag( $Item->locale, 'h10px' );
echo '<br /> ', T_('Categories'), ': ';
$Item->categories();

And replace it with this.

<div class="bSmallHead">
Posted By <a href="<?php echo url_add_param( $Blog->get( 'blogurl', 'htmlattr' ),'author='. $Item->Author->ID) ?>" title="Browse all posts by this author"><?php $Item->Author->preferred_name(); $Item->msgform_link( $Blog->get('msgformurl') ); //the name of the author ?></a><br>

<?php

$Item->issue_time();
echo ', ';
$Item->wordcount();
echo ' ', T_('words');
echo ', ';
$Item->views();
echo ' '.T_('views');
echo ' &nbsp; ';
locale_flag( $Item->locale, 'h10px' );
echo '<br /> ', T_('Categories'), ': ';
$Item->categories();

Hope this helps someone else.
If you want to see the way it works on my blog here is the address again.
http://www.nucsa.org/blogs/
Thanks again personman for all of your help.


Form is loading...