Recent Topics

1 Jan 08, 2009 21:30    

My b2evolution Version: Not Entered

I've got a multi-user blog setup for a couple of friends and I to post on. I've got the posts to show the author of the post's name below the title, but I'd like to see if anyone knows about making their name a link to a personalized about page for them. There are only 3 of us posting right now, so the code shouldn't be too hard I'd think. If someone could point me in the general direction of a post about this already (didn't find one with my searching) or if they could give me some code, I'd appreciate it. I do know some programming languages but am still learning with PHP.

Thanks!
Justin

http://www.iconocritic.com

2 Jan 08, 2009 21:30

Sorry, I forgot to select it but I'm running 2.4.5.

3 Jan 08, 2009 21:44

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.

4 Jan 08, 2009 22:12

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.

5 Jan 08, 2009 22:47

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.

6 Jan 08, 2009 23:07

Guess I read through it too quickly then. I'll have to give it a try. Thanks again!

7 Jan 09, 2009 06:21

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!

8 Jan 09, 2009 06:35

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.

9 Jan 09, 2009 09:57

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"

¥

10 Jan 09, 2009 15:55

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?

11 Jan 09, 2009 17:57

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>',
						) );
					?>

¥

12 Jan 09, 2009 18:20

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.

13 Jan 09, 2009 18:44

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

¥

14 Jan 09, 2009 19:11

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?

15 Jan 09, 2009 20:01

Just put it in the files that exists in your skins/[skin name]/ folder ;)

¥

16 Jan 09, 2009 20:12

Yabba,

Is there any particular place I should put that in the index.main.php?

17 Jan 09, 2009 21:41

@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'    => ' &nbsp; ',
						'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!!

18 Jan 10, 2009 01:22

It worked!! Thanks a bunch guys!

You rock!

19 Jan 10, 2009 01:53

Great, you owe Yabba a drink.

20 Jan 10, 2009 18:54

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

¥


Form is loading...