Latest_Comments 1.1 for 2.5.x

Download plugins, language packs and stuff.

Postby DarkSlim » Thu Feb 11, 2010 11:42 am

typeman wrote:Anyone able to help me intergrate avatars with this? :)


1. The code above (for making it open in diferent pages), you can put it after one of
the $output = str_replace('... it should work. :)

2. One thing I noticed! check if in your plugins/latest_comments.php that it doesn't
have any blank lines and spaces in the end of the code, let it just end at ?>
Because for some reason, it made my RSS not work, this was what fixed it. ;)

3. Yes, I can write a code for you, to display user avatars:
Code: Select all
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users
WHERE username=$comment['author']");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];

$output = str_replace('{avatar}', $useravatar, $output);

Place it in the $outputs also like the first code, now you can use the tag
{avatar} to insert the user avatar url to the template. ;)

Hope it helps,

DarkSlim
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby typeman » Fri Feb 12, 2010 1:43 am

Hey, thanks for the reply! :)

I tried it, but sadly it didn't work; I'm getting errors =\

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/baxyzco1/public_html/cat3/cms/plugins/latest_comments.php on line 91


This is my current code:


Code: Select all
   foreach ($comments as $comment){
            $comm_id = $comment['id'];
            $xid = $comment['post_id'];
            $author = $comment['author'];
         $output = $template_active;
$output = str_replace('{id}', $xid, $output);
$output = str_replace('{author}', $author, $output);
$output = str_replace('{title}', get_title($xid,$max_length), $output);
$output = str_replace('{comment-id}', $comm_id, $output);
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users WHERE username=$comment['author']");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];
$output = str_replace('{avatar}', $useravatar, $output);
$strOUT .= $output . "\n";
}


:)
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby DarkSlim » Fri Feb 12, 2010 12:32 pm

Try this maybe:

Code: Select all
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users WHERE username=$author");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];

$output = str_replace('{avatar}', $useravatar, $output);


I just don't have time now to test it couple of times 'till it works :X
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby typeman » Sat Feb 13, 2010 1:06 am

DarkSlim wrote:Try this maybe:

Code: Select all
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users WHERE username=$author");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];

$output = str_replace('{avatar}', $useravatar, $output);


I just don't have time now to test it couple of times 'till it works :X


Thanks for your help, but sadly that didn't work either =\

Simply, the avatars don't appear whatsoever. I've cleared cache / did a fresh install etc. Also, I was getting an error when I posted a comment when I had the code up.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/baxyzco1/public_html/cat3/cms/plugins/latest_comments.php on line 91


I know I keep asking for help and stuff, really do appreciate all of the help you've offered me :)[/quote]
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby DarkSlim » Sat Feb 13, 2010 1:23 pm

Okay, hmm try couple of things like:

changing cute_users to just users
changing username to name

Code: Select all
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users WHERE username=$author");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];

$output = str_replace('{avatar}', $useravatar, $output);
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby typeman » Tue Feb 16, 2010 12:45 am

DarkSlim wrote:Okay, hmm try couple of things like:

changing cute_users to just users
changing username to name

Code: Select all
//DarkSlim - Show User Avatar

$resultt = mysql_query("SELECT * FROM cute_users WHERE username=$author");

$rowt = mysql_fetch_array($resultt);

$useravatar = $rowt['avatar'];

$output = str_replace('{avatar}', $useravatar, $output);


Sorry to say, but it hasn't worked either =\ I also tried removing the extra 't' on "row" and "result" just incase you missed that. I've tried various combinations and produces the same error as before. :( Sorry for being such trouble.
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby DarkSlim » Tue Feb 16, 2010 7:51 am

typeman wrote:
Sorry to say, but it hasn't worked either =\ I also tried removing the extra 't' on "row" and "result" just incase you missed that. I've tried various combinations and produces the same error as before. :( Sorry for being such trouble.


Okay, no problem mate, I will check this for you and try
to come up with the working code. ;)
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby DarkSlim » Tue Feb 16, 2010 12:15 pm

Hmm it is wierd, it doesn't show anything for me at all
we need to try a different approach maybe
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby typeman » Tue Feb 16, 2010 8:48 pm

DarkSlim wrote:Hmm it is wierd, it doesn't show anything for me at all
we need to try a different approach maybe


Thank you so much for taking the time to look into this for me. :)

I look forward to hearing your thoughts :).
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby D72 » Wed Apr 07, 2010 11:09 am

As this hack is not working for me i tried something totally different.
I really was thinking why it is so hard to show comments on the front page.
I always use the comment option as a guestbook and wanted to show the latest comments in a box somewhere on a website.
So, why can i see comments in the 'guestbook' easily and is it so hard to create latest comments?
Like me there are many others who has problems with the hack in this tread.
So i used Darkslim's hack to show comments in the admin panel on my front-end.
So in my page i use this and it shows the 5 latest comments from one category. Though this is not for multiple categories:

Code: Select all
<ul>
<?php
   $commquery = $sql->select(array(
   'table' => 'comments',
   'orderby' => array('date', 'DESC'),
   'limit' => array(0, $number ? $number : 5),
));
foreach($commquery as $row){
   echo '<li><a id="truncateMe" href="http://www.domain.com/guestbook/">'.replace_comment('show', $row['comment']).'</a></li>';
 
     }
?>
</ul>


This is working just great and straight out of the box.

When you want to truncate the comment, you could use this javascipt like i have and place it right after the above php code:

Code: Select all
<script type="text/javascript">

var len = 32;
var a = document.getElementById('truncateMe');
if (a) {

  var trunc = a.innerHTML;
  if (trunc.length > len) {

    /* Truncate the content of the 'a' , then go back to the end of the
       previous word to ensure that we don't truncate in the middle of
       a word */
    trunc = trunc.substring(0, len);

    /* Add an ellipses to the end and make it a link that expands
       the paragraph back to its original size */
    trunc += '...';
    a.innerHTML = trunc;
  }
}

</script>


This will truncate the comment after 32 characters.
If somebody make a modification of this, please post it here.
This is so much easier then the option which is given in this tread.
Hope somebody can use this.

The only problem i have is that i can't generate a link to the id of the comment it self.
So if anyone knows how to do that, my latest comments is just perfect for me.

D.
User avatar
D72
 
Posts: 336
Joined: Thu Feb 22, 2007 12:05 am
Location: NL

Previous

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron