Make Primary Fix

All the topics other than the two goes here.
  • Ads

Make Primary Fix

Postby JacquesPrevert » Fri Sep 11, 2009 5:44 am

Hi all

When members upload their profile photo but don't click on "make primary", their avatar doesn't show in the members photo gallery. I have tried to fix the problem by using the following code from Mrpowless, but it doesn't seen to work for me.

Any thoughts?

Thanks and happy day.
******************

primary photo fix
13.12.2008

1) Open filename : inc/classes/BxDolMedia.php
2) Look in : function insertMediaToDb( $sFileName )
3) After this line :

if( 0 < $iResult )
{
Insert this :

// START bug fixed -- first photo upload make primary
if ( $this -> aMedia['0']['PrimPhoto'] == 0 )
{
$iLastID = mysql_insert_id();
$this -> oMediaQuery -> setPrimaryPhoto( $this -> iProfileID, $iLastID );
$this -> aMedia['0']['PrimPhoto'] = $iLastID;
$this -> iMediaCount = $this -> iMediaCount + 1;
}
// END bug fixed -- first photo upload make primary
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Fri Sep 11, 2009 7:53 pm

It is not correct.

Here is the correct code.
Open file inc/classes/BxDolMedia.php
replace method "uploadMedia" with the following.

Code: Select all
   function uploadMedia()
   {

      $sMediaDir = $this -> getProfileMediaDir();
      if( !$sMediaDir )
         return 'failed to open profile directory';

      $aSupoortedExt = split(',', strtolower($this -> sSupportedExt) );
      $sFileName = time();
      $aExt = pathinfo( $_FILES[$this -> sMediaType]['name'] );
      $ext = strtolower( $aExt['extension'] );

      //print_r( $_FILES);

      if( ( 0 == $_FILES[$this -> sMediaType]['error'] ) )
      {
         $iMaxFileSize = ( ( ( $this -> aMediaConfig['max'][$this -> sMediaType . 'File'] ) * 1024 ) * 1024 );
         if( $iMaxFileSize >= $_FILES[$this -> sMediaType]['size'] )
         {
            if( in_array( $ext, $aSupoortedExt) )
            {
               if( move_uploaded_file($_FILES[$this -> sMediaType]['tmp_name'], $sMediaDir . $sFileName . '.' . $ext ) )
               {
                  $sFileTitle = process_db_input( htmlspecialchars_adv($_POST['title'] ));
                  if( $this -> oMediaQuery -> insertMedia( $this -> iProfileID, $this -> sMediaType, $sFileName . '.' . $ext, $sFileTitle ) )
                  {
                     $aPInfo = getProfileInfo( $this -> iProfileID );
                     if($aPInfo['PrimPhoto'] == 0)
                     {
                        $iLastID = mysql_insert_id();
                        $this -> oMediaQuery -> setPrimaryPhoto( $this -> iProfileID, $iLastID );
                     }
                     $ret .= 'file successfully uploaded <br>';
                  }
               }
               else
                  $ret .= 'failed to upload file <br>';
            }
            else
               $ret .= 'you tried to upload not supported format <br>';
         }
         else
            $ret .= 'file to big <br>';
      }
      else
         $ret .= 'you have an error while uploading the file <br>';

      return $ret;
   }
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

Re: Make Primary Fix

Postby JacquesPrevert » Sat Sep 12, 2009 10:35 am

Hi Praveen

I've used the code you have supplied and the member pictures who haven't been made primary" still don't show. I am using V 6.1.6. I don't know if that makes any difference.

Regards

PS: I like the new look and feel of your forum, btw.
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Sat Sep 12, 2009 6:40 pm

I have tested this code and it was working fine. You can send your site details so that I can have a look.
Regards,
Praveen
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

Re: Make Primary Fix

Postby JacquesPrevert » Sun Sep 13, 2009 9:42 am

Thanks Praveen

I am experimenting with Firebug to try to locate the problem. If I don't get anywhere, I shall send you mu site details.

Warm regards.
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Sun Sep 13, 2009 3:47 pm

You cannot use firebug to fix this, because this is a server side code.
Regards,
Praveen
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

Re: Make Primary Fix

Postby JacquesPrevert » Thu Sep 24, 2009 4:36 am

Hi Praveen

I have sent you acess codes to my site. Any news?

Thank you kindly.
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Thu Sep 24, 2009 5:09 pm

Hi,

I am sorry for the late. Today, I am little busy. I will fix it tomorrow for sure.
Regards,
Praveen
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

Re: Make Primary Fix

Postby JacquesPrevert » Thu Sep 24, 2009 5:39 pm

Thanks Praveen!
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Sat Sep 26, 2009 9:30 am

Sorry for the late. I have looked your site. It works... It only sets the when the user uploads the photo and not the already uploaded photos.
Regards,
Praveen
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

Re: Make Primary Fix

Postby JacquesPrevert » Sat Sep 26, 2009 9:38 am

Thanks Praveen

I shall get those few members to log in and correct the problem. Nice avatar by the way. :)
JacquesPrevert
Global Moderator
Global Moderator
 
Posts: 53
Joined: Sun Apr 26, 2009 3:42 pm

Re: Make Primary Fix

Postby Administrator » Sat Sep 26, 2009 1:02 pm

You are welcome.
Regards,
Praveen
Administrator
Administrator
Administrator
 
Posts: 1069
Joined: Mon Aug 25, 2008 7:18 am
Location: India

  • Ads

Return to Dolphin General Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron