Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Rumbaar
Regular
Regular



Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Fri May 05, 2006 5:43 am Reply with quote

With the ability of an account holder via the forum profile maintenance to delete all occurrences of an avatar in their profile has meant the current code in Your Account module can't display the contents correctly when a person has the user_profile_type = 0 (ie delete avatar).

The User_Profile_Type can have values 0,1,2,3 and currently 0 is lumped with type 3 which causes some display issues in the userinfo display section.

The mod/hack:

Open Your_Account->index.php

First find the two occurrences of the following code:
Code:
    if ($userinfo['user_avatar_type'] == 1) {

       $userinfo['user_avatar'] = $board_config['avatar_path']."/".$userinfo['user_avatar'];
       } elseif ($userinfo['user_avatar_type'] == 2) {
       $userinfo['user_avatar'] = $userinfo['user_avatar'];
       } else {
       $userinfo['user_avatar'] = $board_config['avatar_gallery_path']."/".$userinfo['user_avatar'];
       }


and replace with this code:
Code:
    if ($userinfo['user_avatar_type'] == 1) {

       $userinfo['user_avatar'] = $board_config['avatar_path']."/".$userinfo['user_avatar'];
       } elseif ($userinfo['user_avatar_type'] == 2) {
       $userinfo['user_avatar'] = $userinfo['user_avatar'];
       } elseif ($userinfo['user_avatar_type'] == 3) {
       $userinfo['user_avatar'] = $board_config['avatar_gallery_path']."/".$userinfo['user_avatar'];
       } else {
       $userinfo['user_avatar'] = "empty";
       }


Now find:
Code:
   echo "<img src=\"".$userinfo['user_avatar']."\"><br><br>\n";


and replace with:
Code:
   if ($userinfo['user_avatar'] != "empty") { echo "<img src=\"".$userinfo['user_avatar']."\"><br><br>\n"; }


Also find:
Code:
       echo "<td bgcolor='$bgcolor3' align=center>Current Avatar<BR><IMG alt=\"\" src=\"".$userinfo['user_avatar']."\" width=\"40\" height=\"50\"></td></tr><BR>";


and replace with:
Code:
       if ($userinfo['user_avatar'] != "empty") { echo "<td bgcolor='$bgcolor3' align=center>Current Avatar<BR><IMG alt=\"\" src=\"".$userinfo['user_avatar']."\" width=\"100\" height=\"100\"></td></tr><BR>";

       } else { echo "<td bgcolor='$bgcolor3' align=center>Current Avatar<BR>No Avatar Set</td></tr><BR>"; }


Now when you view a profile that has no avatar set (User_Profile_Type = 0) it will correctly not display a broken image marker for the non existent avatar. It will also not display a broken image holder when you edit your own account and display the text 'No Avatar Set'.

Maybe this can be incorporated into Ravens' distro.

_________________
Victim's aren't we all! 
View user's profile Send private message Visit poster's website
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Sat May 06, 2006 4:40 pm Reply with quote

Not sure I understand why so much code needs to be changed

Couldn't we just do
Code:


if ($userinfo['user_avatar'] != "") { echo "<img src=\"".$userinfo['user_avatar']."\"><br><br>\n"; }

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
Rumbaar







PostPosted: Sat May 06, 2006 10:50 pm Reply with quote

Well in the original code $userinfo['user_avatar'] will never be null and even when they have no avatar set it will have a value ($board_config['avatar_gallery_path']) and trigger the html incorrectly.

In the orginal code user_avatar_type's 3 & 0 are handled the same way via the 'else' statement. 3 has a value in it's 'user_avatar' field and 0 does not, hence you get a broken image placeholder in the original code for those with 0 user_avatar_types.
 
evaders99







PostPosted: Sun May 07, 2006 12:31 am Reply with quote

Oh, then we can just do

Code:


if (($userinfo['user_avatar_type'] != 0) AND ($userinfo['user_avatar'] != ""))


I'm not saying its any more efficient. It just minimizes the number of lines that need to be changed.
 
Rumbaar







PostPosted: Sun May 07, 2006 1:39 am Reply with quote

Yes that would eliminate the need for the first two changes, as long as the user_avatar_type for blank will always be 0.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

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 ©