Warning: The author of this contribution does not provide support for it anymore.

Default Random 'No Avatar'

Frequently Asked Questions

Avatar of poster on Index and Viewforum - Compatibility

UDATE: 20 December 2013

Please see this Topic for updated Fix: Avatar of poster on Index and Viewforum & random avatar"no_avatar"



*** *** ***
You MUST have Avatar of poster on Index and Viewforum already installed on your forum before adding these changes.
*** *** ***

Many thanks to lefty74, the author of Avatar of poster on Index and Viewforum.
Here is his solution to make both mods (Avatar of poster on Index and Viewforum with Default Random 'No Avatar') compatible.

Open: viewforum.php
Find:

Code: Select all

      $avatar_img = $avatar_max_dimensions = $topic_last_poster_avatar_height = $topic_last_poster_avatar_width = $topic_first_poster_avatar_width = $topic_first_poster_avatar_height = '';
      
      if ( !empty($row['topic_first_poster_avatar']) || !empty($row['topic_last_poster_avatar']))
      {
      $avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed
      
         if ( $row['topic_first_poster_avatar_width'] >= $row['topic_first_poster_avatar_height'] )
         {
            $topic_first_poster_avatar_width = ( $row['topic_first_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_width'] ;
            $topic_first_poster_avatar_height = ( $topic_first_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_width'] * $row['topic_first_poster_avatar_height']) : $row['topic_first_poster_avatar_height'] ;
         }
         else
         {
            $topic_first_poster_avatar_height = ( $row['topic_first_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_height'] ;
            $topic_first_poster_avatar_width = ( $topic_first_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_height'] * $row['topic_first_poster_avatar_width']) : $row['topic_first_poster_avatar_width'] ;
         }

         if ( $row['topic_last_poster_avatar_width'] >= $row['topic_last_poster_avatar_height'] )
         {
            $topic_last_poster_avatar_width = ( $row['topic_last_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_width'] ;
            $topic_last_poster_avatar_height = ( $topic_last_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_width'] * $row['topic_last_poster_avatar_height']) : $row['topic_last_poster_avatar_height'] ;
         }
         else
         {
            $topic_last_poster_avatar_height = ( $row['topic_last_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_height'] ;
            $topic_last_poster_avatar_width = ( $topic_last_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_height'] * $row['topic_last_poster_avatar_width']) : $row['topic_last_poster_avatar_width'] ;
         }
         
      }

Replace with:

Code: Select all

        $avatar_img = $avatar_max_dimensions = $topic_last_poster_avatar_height = $topic_last_poster_avatar_width = $topic_first_poster_avatar_width = $topic_first_poster_avatar_height = 40;
       
               
          if ( !empty($row['topic_first_poster_avatar']) || !empty($row['topic_last_poster_avatar']))
          {
              $avatar_max_dimensions = $avatar_width = $avatar_height = 40; // here you can change the max-width you would like to have the avatars displayed
         
             if ( !empty($row['topic_first_poster_avatar']))
             {         
            if ( $row['topic_first_poster_avatar_width'] >= $row['topic_first_poster_avatar_height'] )
               {
                  $topic_first_poster_avatar_width = ( $row['topic_first_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_width'] ;
                  $topic_first_poster_avatar_height = ( $topic_first_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_width'] * $row['topic_first_poster_avatar_height']) : $row['topic_first_poster_avatar_height'] ;
               }
               else
               {
                  $topic_first_poster_avatar_height = ( $row['topic_first_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_height'] ;
                  $topic_first_poster_avatar_width = ( $topic_first_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_height'] * $row['topic_first_poster_avatar_width']) : $row['topic_first_poster_avatar_width'] ;
               }
          }

            if ( !empty($row['topic_last_poster_avatar']))
             {     
               if ( $row['topic_last_poster_avatar_width'] >= $row['topic_last_poster_avatar_height'] )
               {
                  $topic_last_poster_avatar_width = ( $row['topic_last_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_width'] ;
                  $topic_last_poster_avatar_height = ( $topic_last_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_width'] * $row['topic_last_poster_avatar_height']) : $row['topic_last_poster_avatar_height'] ;
               }
               else
               {
                  $topic_last_poster_avatar_height = ( $row['topic_last_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_height'] ;
                  $topic_last_poster_avatar_width = ( $topic_last_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_height'] * $row['topic_last_poster_avatar_width']) : $row['topic_last_poster_avatar_width'] ;
               }
          }
          }


Open: includes/functions_display.php
Find:

Code: Select all

$avatar_max_dimensions = $avatar_width = $avatar_height = '';

Replace with:

Code: Select all

$avatar_max_dimensions = $avatar_width = $avatar_height = 40;


Always backup before making changes to your forum. ;)