PDA

View Full Version : Show More Than 1 Featured Author


dcei
02-09-2006, 02:07 AM
I'm running v. 3.1 on Unix Platform.

Right now it appears that 'Featured Author' arbitrarily displays only 1 author. I don't know how it chooses which author to display -

but my question is this:

how can we modify where ALL authors show up in this section?

Alex
02-09-2006, 12:34 PM
I don't know how it chooses which author to display
Random selection.

To show all authours instead only one, a slight hack to PHP code is needed. So far we do not have this as the option, but the easiest thing to do would be:

1. Open HTML_Function.php

On line 386 (approx.) locate the function HTML_Featured_Author() which returns random author. Instead of returning only one random author - here's code to fetch all authors:

function HTML_Featured_Author()
{
global $url, $tpl_folder,$lang,$showFriendlyURL;
global $db_users, $user_connection;

$user = new Users();
$user->query_list();
while ($row = mysql_fetch_array($user->query_result))
{
$user->GetIdFromRow($row);
$user->LoadFromDatebase();

$author = $user->Username;
$full_name = $user->First_name.' '.$user->Last_name;
if ($full_name==' ') $full_name=$author;

if ($showFriendlyURL<>"no") {
$author='<a href="'.$url.'author/'.urldecode($author).'.html">'.$full_name.'</a>';
} else {
$author='<a href=index.php?author='.urldecode($author).'>'.$fu ll_name.'</a>';
}

$picture = $user->Picture;
$view_picture=$url."authors/".$picture;
if ($picture=="" or !file_exists(getcwd().'/authors/'.$picture))
$view_picture=$url."files/spacer.gif";
else {
$vp_size = getimagesize($view_picture);
$vp_aspc = $vp_size[0] / $vp_size[1];
$vp_width = min(100,$vp_size[0]);
$vp_height = min($vp_width/$vp_aspc,$vp_size[1]);
$view_picture.='" width="'.$vp_width.'" height="'.$vp_height;
}

$filename="$tpl_folder/box_featuredAuthor.tpl";
$subject=file_get_contents($filename);
$pattern=array(
'/{VIEW_PICTURE}/',
'/{BIO}/',
'/{AUTHOR}/',
);
$replacement=array(
$view_picture,
$user->Bio,
$author,
);
$show_author_of_the_day_HTML.=preg_replace($patter n, $replacement, $subject);
}
return $show_author_of_the_day_HTML;
}

If you compare this to original code, you'll notice that we only placed $user->query_list(); call instead of $user->FeaturedAuthor(); and while loop to iterate thru all users.

2. Edit Templates/box_featuredAuthor.tpl and adjust it to your needs.


Hope this helped

mahir
02-20-2007, 06:02 PM
Its nice hack, that we can show all the writer on the website. But I need also show the last article from each writer. But there is a problem; admin should not visible.

Another problem is the moderatings comments. Is it possible to make this features only for the users and with a approval? I mean, only users should write a comment. I will pre-screen comments and approve them before they appear on the site.

Its also good if the contact has a spam protection against robots. I think, the contact page must force the user entering a captcha (image code).


Sorry for my english, Thanks...

Best Regards

apocan
02-22-2007, 08:38 PM
Another problem is the moderatings comments. Is it possible to make this features only for the users and with a approval? I mean, only users should write a comment. I will pre-screen comments and approve them before they appear on the site.



nice idea but i think it will be possible at that moment.but i hope they could do...

boccio
02-22-2007, 10:12 PM
Moderated comments will be featured in upcoming release (v.3.5)

chatfan
03-11-2007, 12:39 AM
I seem to have a similar type of wish for the features author but hopefully a bit simpler: Set a time perdiod for each author, in my case a week. As far as I could understand it fetches the random number from an array but thats about as far as I can go with code.

Also like the idea of having the featured authors last post in the same box as clickable link.

mahir
08-02-2007, 03:00 AM
I want to show all the writers (user_type = 0) on the website (with images). All of them should be among themselves (I mean verticaly).

I try also show the last article from each writer. I found in the forum some articles to do that, but in the version 3.51 is many changes.

HTML_function not include featured author function anymore.

Featured Author box depends on HTML_Featerd_Author.php, Show_Author_Info.php, Users.class.php.

What and where should I do changes?

Thanks in advance