Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.20.00 - All Issues
Author Message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Fri Mar 14, 2008 4:07 pm Reply with quote

I am trying to display the posters avatar on the comments for the news module....

Does anyone have an idea of how to do this?

I've been goofing around with the comments.php in the news module with very little success... Thanks for any help...
 
View user's profile Send private message Send e-mail Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6793
Location: Ha Noi, Viet Nam

PostPosted: Fri Mar 14, 2008 4:25 pm Reply with quote

The avatar data is stored in one of the forums tables, possibly nukebb_users so if you have a look at one of the existing files like modules/Forums/templates/subSilver/viewtopic_body.php that might give you some idea of the sql call you would have to make to retrive that data.
 
View user's profile Send private message Send e-mail
nextgen
Worker
Worker


Joined: Sep 28, 2006
Posts: 227
Location: Maryland

PostPosted: Sat Mar 15, 2008 5:08 am Reply with quote

I have seen many users try to make a sers avatar pop up in the PM, last topic posted, etc etc. Please back up first because you never know what it will do to your theme layout.

_________________
alterednuke.com Your source for Ravennuke themes. 
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
nuken
PostPosted: Sun Mar 16, 2008 7:21 pm Reply with quote

OK... I have it showing the avatar but it only shows the avatar of the person logged in on all the posts weather it's their post or not...
Heres the code I'm using:
Code:
/* Avatar call*/

    if ($userinfo['user_avatar_type'] == 1) {
        $userinfo['user_avatar'] = $board_config['avatar_path'].'./modules/Forums/images/avatars/'.$userinfo['user_avatar'];
    } elseif ($userinfo['user_avatar_type'] == 2) {
        $userinfo['user_avatar'] = $userinfo['user_avatar'];
    } else {
        $userinfo['user_avatar'] = $board_config['avatar_gallery_path'].'./modules/Forums/images/avatars/'.$userinfo['user_avatar'];
    }
   
        echo '<div class="content" >';
        echo '<img src="'.$userinfo['user_avatar'].'" alt="" />'."\n";


Does anyone know how to make it show the poster of the comment in comments.php? Or am I on the wrong track in what I'm doing?

Image
 
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Sun Mar 16, 2008 8:29 pm Reply with quote

Well, your gonna have to get the username or user_id of the person who made the comment. Then do some SQL calls to get their avatar type and avatar data from the user table. You can see an example of how I do that in the Member_Map module (see my sig).

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
nuken
PostPosted: Mon Mar 17, 2008 4:12 am Reply with quote

I believe I have it working now...
Thank you for your help....

In case anyone wants it... Here's the code to add avatar to news comments.

In modules/news/comments.php on line 645
find:
Code:
/* If you are admin you can see the Poster IP address */

         /* with this you can see who is flaming you...*/


Under add:
Code:
      

echo "<br />";

   if (($c_name != $anonymous)&&($c_name !=$anonymousname)) {

       $sql2 = "SELECT user_id,user_avatar FROM ".$prefix."_users WHERE username='$c_name'";

       $result2 = $db->sql_query($sql2);

       $row2 = $db->sql_fetchrow($result2);

      $avatar=$row2['user_avatar'];

      $user_id=intval($row2['user_id']);

      if ($avatar=="") {

echo "&nbsp;&nbsp;<a href=\"profile-.html$user_id\"><img alt src=\"modules/Forums/images/avatars/noimage.gif\" border =\"0\" width=\"35\" height=\"35\"></a>";

}

else

if (eregi("http://", $avatar)) {

echo"&nbsp;&nbsp;<a href=\"forums.html?amp;file=profile&amp;mode=viewprofile&amp;u=$user_id\"><img alt src=\"$avatar\" border =\"0\"></a>";

}

else{

echo "&nbsp;&nbsp;<a href=\"forums.html?amp;file=profile&amp;mode=viewprofile&amp;u=$user_id\"><img alt src=\"modules/Forums/images/avatars/$avatar\"></a>";

}      
   }      
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.20.00 - All Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©