2 acidtrip Jan 08, 2009 21:30

This post may get you started.....
http://forums.b2evolution.net/viewtopic.php?t=14046
Re linking the author of a post's name to a specific "about page", just try editing the User details in the back office and under AdditionalInfo make the URL link a specific link that user's "about" page.
Good luck.
Thanks for the reply!
I had actually found that thread when searching before. That thread I think is for making a page to link to in the menu or something, like an About Us page at the top or side of the page. That shouldn't be too hard as it's just basically a link to the page. My problem is that the part where it has the author's name is some PHP loop or array and I'm not sure where to edit to have it link to each person's individual About page and have their name be the link.
So basically I'd like it to look like this:
Posted by Author_Name, where Author_Name is the name of author of the post and it be a link to their About Me page.
The Admin Page that I referred to has a field for the Authors URL. That makes the Author's/User's name an active link to his/her own site.
I'm suggesting that you try to use that field , with a link to your member's/author's "about page and that page displays the autor's URL instead
eg:
/index.php?disp=Bill
/index.php?disp=Jane
/index.php?disp=JoeBlow
I'm sure there are gurus here that can suggest a code hack or another approach.
Guess I read through it too quickly then. I'll have to give it a try. Thanks again!
Maybe someone who has PHP experience could tell me how to change this bit so that it would have the author's name as a link? I already know what the links should be, but I don't know how to add this to the code itself.
<?php
$Item->author( array(
'before' => T_('Posted by '),
'after' => ' ',
) );
?>
Thanks in advance!
I've done a lil looking around and got this far, but it's blanking out the page, making me think that I have something wrong here. Can someone please assist?
Thanks!
Unneeded code so removing.
admin > write > change dropdown from type "post" to type "Page" ... make your authors about page > hit save
admin > users > [user] > slap in the url to the page you just created as the authors "website url"
¥
Thanks for the reply! I didn't even notice the URL bit in there before. I added one for myself but that doesn't seem to make my name link to it. How would I do that?
ooops, thought it did that automatically, it must just be comments :p
You should be able to do something like this in index/posts/page/single.main.php ( free typed, so if it barfs with errors just let me know ;) )
<?php
$Item->get_creator_User();
if( $url = $Item->creator_User->get( 'url' ) )
{
$before = '<a href="'.$url.'" title=" read about '.$Item->creator_User->get_preferred_name().'" >';
$after = '</a>';
}
else
{
$before = '';
$after = '';
}
$Item->author( array(
'before' => T_('by').' <strong>'.$before,
'after' => $after.'</strong>',
) );
?>
¥
Yabba, I can't find the file you specified...
index/posts/page/single.main.php?
I don't have an index folder in the main directory.
sorry that was me quick typing several files
/skins/[skin name]/index.main.php
/skins/[skin name]/posts.main.php
/skins/[skin name]/single.main.php
/skins/[skin name]/page.main.php
¥
I thought that single.main.php applied to standalone pages? I need this to work with all posts so their name under the title links to the author's URL.
I also don't see a file named that in the skins folder and I don't have one in my skin's individual folder. Should I just create one and throw that in it? That won't affect anything adversely?
Just put it in the files that exists in your skins/[skin name]/ folder ;)
¥
Yabba,
Is there any particular place I should put that in the index.main.php?
@acidtrip
Open your copy of index.main.php in an editor and look for a section similar to this... your's may vary a bit
<div class="bSmallHead">
<?php
// Permalink:
$Item->permanent_link( array(
'text' => '#icon#',
) );
$Item->issue_time( array(
'before' => ' ',
'after' => '',
));
$Item->author( array(
'before' => ', '.T_('by').' <strong>',
'after' => '</strong>',
) );
$Item->msgform_link();
echo ', ';
$Item->wordcount();
echo ' '.T_('words');
// echo ', ';
// $Item->views();
$Item->locale_flag( array(
'before' => ' ',
'after' => '',
) );
?>
<br />
<?php
$Item->categories( array(
'before' => T_('Categories').': ',
'after' => ' ',
'include_main' => true,
'include_other' => true,
'include_external'=> true,
'link_categories' => true,
) );
?>
</div>
Now replace the bit..
$Item->author( array(
'before' => ', '.T_('by').' <strong>',
'after' => '</strong>',
) );
with Yabba's code ....
$Item->get_creator_User();
if( $url = $Item->creator_User->get( 'url' ) )
{
$before = '<a href="'.$url.'" title=" read about '.$Item->creator_User->get_preferred_name().'" >';
$after = '</a>';
}
else
{
$before = '';
$after = '';
}
$Item->author( array(
'before' => T_('by').' <strong>'.$before,
'after' => $after.'</strong>',
) );
Note: back up original files :)
@ Yabba,
ooops, thought it did that automatically,
I thought it did as well. It used to in older versions, or maybe I'm imagining things!!
It worked!! Thanks a bunch guys!
You rock!
Great, you owe Yabba a drink.
John wrote:
I thought it did as well. It used to in older versions, or maybe I'm imagining things!!
Good to hear that it's not just me that's losing my marbles then :D
¥
Sorry, I forgot to select it but I'm running 2.4.5.