My matches block

Hi

Does anyone know how to create a 'My Matches' block that I can insert as a PHP block?  I did have it working in an earlier version as:

 

$thismemID =  $_COOKIE['memberID'];

$thisprofileID = getLoggedId();

 

if ($thismemID==$thisprofileID){

require_once( BX_DIRECTORY_PATH_INC     . 'match.inc.php');

bx_import('BxBaseSearchProfile');

$oSearchProfile = new BxBaseSearchProfile();

 

echo '<div class="bx_sys_default_padding">';

$aProfiles = getMatchProfiles($thisprofileID);

if ($aProfiles){

echo '<p>Possible matches</p>';

foreach ($aProfiles as $iProfId)

{

// echo $iProfId . '<br />';

$aOnline = array();

if (isset($iProfId['is_online'])) {

$aOnline['is_online'] = $iProfId['is_online'];

}

$sProfileThumb = get_member_thumbnail( $iProfId, 'none', '', 'visitor', '' );

echo $sProfileThumb;

}

} else {

echo '<p>No matches found.  Update your profile to find more matches.</p>';

}

echo '</div>';

}

but it stopped working, possibly due to the recent upgrade - it kept returning no matches when there were matches.  I want to add paging as well and so have been playing with (on 7.0.4):

$thismemID =  $_COOKIE['memberID'];

$iProfileId = getLoggedId();

 

if ($thismemID==$iProfileId){

require_once( BX_DIRECTORY_PATH_INC     . 'match.inc.php');

 

echo '<div class="bx_sys_default_padding">';

$aProfiles = getMatchProfiles($thisprofileID);

if ($aProfiles){

 

$sBaseUri = '';

$sTopLinksUri = '';

$sPaginateUri = '';

 

foreach ($_REQUEST as $sKey => $sVal)

{

switch ($sKey)

{

case 'page':

$sPaginateUri .= '&page=' . $sVal;

break;

case 'per_page':

$sPaginateUri .= '&per_page=' . $sVal;

break;

case 'sort':

$sPaginateUri .= '&sort=' . $sVal;

break;

case 'mode':

$sTopLinksUri .= '&mode=' . $sVal;

break;

}

}

 

$aPaginate = array(

'page_url' => $sBaseUri . $sTopLinksUri . '&page={page}&per_page={per_page}&sort={sorting}',

'info' => true,

'page_links' => true,

'per_page' => isset($_REQUEST['per_page']) ? (int)$_REQUEST['per_page'] : 25,

'sorting' => $sSort,

'count' => count($aProfiles),

'page' => isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 1,

'page_reloader' => true,

'per_page_changer' => true

);

 

$oPaginate = new BxDolPaginate($aPaginate);

 

for ($i = ($aPaginate['page'] - 1) * $aPaginate['per_page'];

$i < $aPaginate['page'] * $aPaginate['per_page'] && $i < $aPaginate['count']; $i++)

{

$iProfId = getProfileInfo($aProfiles[$i]);

$aOnline = array();

if (isset($iProfId['is_online'])) {

$aOnline['is_online'] = $iProfId['is_online'];

}

$sProfileThumb = get_member_thumbnail( $iProfId, 'none', '', 'visitor', '' );

echo $sProfileThumb;

$iIndex++;

}

} else {

echo '<p>No matches found.  Update your profile to find more matches.</p>';

}

echo '</div>';

 

}

 

but this also returns no matches when there are matches.  Am I barking up the wrong tree?

Quote · 14 Feb 2011

Have gotten this to work though don't know about the paging as haven't got that far in testing:

 

$thismemID =  $_COOKIE['memberID'];

$iProfileId = getLoggedId();

 

if ($thismemID==$iProfileId){

require_once( BX_DIRECTORY_PATH_INC     . 'match.inc.php');

 

 

echo '<div class="bx_sys_default_padding">';

echo '<div class="dbContent">';

$sSort = 'none';

$aProfiles = getMatchProfiles($iProfileId, false, $sSort);

 

if (empty($aProfiles)) {echo '<p>No matches found.  Update your profile to find more matches.</p>';

} else {

 

$sBaseUri = '';

$sTopLinksUri = '';

$sPaginateUri = '';

 

foreach ($_REQUEST as $sKey => $sVal)

{

switch ($sKey)

{

case 'page':

$sPaginateUri .= '&page=' . $sVal;

break;

case 'per_page':

$sPaginateUri .= '&per_page=' . $sVal;

break;

case 'sort':

$sPaginateUri .= '&sort=' . $sVal;

break;

case 'mode':

$sTopLinksUri .= '&mode=' . $sVal;

break;

}

}

 

$aPaginate = array(

'page_url' => $sBaseUri . $sTopLinksUri . '&page={page}&per_page={per_page}&sort={sorting}',

'info' => true,

'page_links' => true,

'per_page' => isset($_REQUEST['per_page']) ? (int)$_REQUEST['per_page'] : 25,

'sorting' => $sSort,

'count' => count($aProfiles),

'page' => isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 1,

'page_reloader' => true,

'per_page_changer' => true

);

 

$oPaginate = new BxDolPaginate($aPaginate);

 

for ($i = ($aPaginate['page'] - 1) * $aPaginate['per_page'];

$i < $aPaginate['page'] * $aPaginate['per_page'] && $i < $aPaginate['count']; $i++)

{

$iProfId = getProfileInfo($aProfiles[$i]);

$aOnline = array();

if (isset($iProfId['is_online'])) {

$aOnline['is_online'] = $iProfId['is_online'];

}

echo '<div class="member_block">';

$sProfileThumb = get_member_thumbnail( $aProfiles[$i], 'none', true, 'visitor', '' );

echo $sProfileThumb;

echo '</div>';

$iIndex++;

}

}

echo '</div>';

echo '</div>';

}

Quote · 20 Feb 2011

Just sorted the paging as well so here is the updated code (note the page url for the paging is set here for the member page), also have modified the matches so the sex and looking for match up (though there is still an issue with the actual Boonex code as matches aren't working correctly):

N.B. this isn't necessarily the neatest of code in the world but it works for me so feel free to use and improve it :)

$thismemID =  $_COOKIE['memberID'];

$iProfileId = getLoggedId();

 

 $arr = getProfileInfo( $thismemID );

        $lf= $arr['LookingFor'];

        if ($lf=='' || !isset($lf)){$lf='male,female';}

       

       $lookingfor = explode(',',$lf);

       $lookingfor1 = $lookingfor[0];

      

        if (count($lookingfor)==2){       

      $lookingfor2 = $lookingfor[1];

        }else{

      $lookingfor2 = '';

        }

 

 

if ($thismemID==$iProfileId){

require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolProfileFields.php' );

require_once( BX_DIRECTORY_PATH_INC     . 'match.inc.php');

require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolProfilesController.php' );

 

    

echo '<div class="bx_sys_default_padding">';

echo '<div class="dbContent">';

$sSort = 'none';

        //$aProfiles = getMatchProfiles($iProfileId, false, $sSort);

       $oDb = new BxDolDb();

        $aMatch = $oDb->getRow("SELECT `profiles_match` FROM `sys_profiles_match` WHERE `profile_id` = $iProfileId AND `sort` = '$sSort'");

        if (!empty($aMatch))

            $ab = unserialize($aMatch['profiles_match']);

 

        

        if (empty($ab)) {echo '<p>No matches found.  Update your profile to find more matches.</p>';

 

} else {

        

        

        $newi = 0;

        for ($a=0;$a < count($ab); $a++){

         $arr2 = getProfileInfo( $ab[$a] );

           

           $lf2= $arr2['LookingFor'];

       if ($lf2=='' || !isset($lf2)){$lf2='male,female';}

     $Matchlookingfor = explode(',',$lf2);

      $Matchlookingfor1 = $Matchlookingfor[0];

 

      if (count($Matchlookingfor)==2){       

      $Matchlookingfor2 = $Matchlookingfor[1];

       }else{

      $Matchlookingfor2 = '';

       }

        

      

           if (($arr2['Sex'] == $lookingfor1 && $arr['Sex'] == $Matchlookingfor1) || ($arr2['Sex'] == $lookingfor2  && $arr['Sex'] == $Matchlookingfor1) || ($arr2['Sex'] == $lookingfor2 && $arr['Sex'] == $Matchlookingfor2) || ($arr2['Sex'] == $lookingfor2  && $arr['Sex'] == $Matchlookingfor2) ) {

            $aProfiles[$newi] = $ab[$a]; 

            $newi ++;

            }

          } 

 

        $sBaseUri = '';

        $sTopLinksUri = '';

        $sPaginateUri = '';

        

        foreach ($_REQUEST as $sKey => $sVal)

        {

            switch ($sKey)

            {

                case 'page':

                    $sPaginateUri .= '&page=' . $sVal;

                    break;

                case 'per_page':

                    $sPaginateUri .= '&per_page=' . $sVal;

                    break;

                case 'sort':

                    $sPaginateUri .= '&sort=' . $sVal;

                    break;

                case 'mode':

                    $sTopLinksUri .= '&mode=' . $sVal;

                    break;

            }

        }

 

        $aPaginate = array(

            'page_url' => $sBaseUri . $sTopLinksUri . '/member.php?page={page}&per_page={per_page}',

            'info' => true,

            'page_links' => true,

            'per_page' => isset($_REQUEST['per_page']) ? (int)$_REQUEST['per_page'] : 14,

            'sorting' => $sSort,

            'count' => count($aProfiles),

            'page' => isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 1,

            'page_reloader' => true,

            'per_page_changer' => true

        );

            

        $oPaginate = new BxDolPaginate($aPaginate);

$sPaginate = $oPaginate->getPaginate(); 

 

         $thumbs = '';

        

         for ($i = ($aPaginate['page'] - 1) * $aPaginate['per_page']; 

            $i < $aPaginate['page'] * $aPaginate['per_page'] && $i < $aPaginate['count']; $i++)

        {

            $iProfId = getProfileInfo($aProfiles[$i]);

            $aOnline = array();

            if (isset($iProfId['is_online'])) {

            $aOnline['is_online'] = $iProfId['is_online'];

 

}

 

$sProfileThumb = get_member_thumbnail( $aProfiles[$i], 'none', true, 'visitor', '' );

            

            $thumbs .= '<div class="member_block">' . $sProfileThumb . '</div>';

 

 

        }

 

       if ($thumbs==''){

            echo '<p>No matches found.  Update your profile to find more matches.</p>';

             } else {

            echo $thumbs;

             }

 

}

        echo '</div></div><div style="width: 100%; height: 20px; clear: both;">&nbsp;</div>' . $sPaginate;

 

}

Quote · 9 Jun 2011

Interesting mod!  Thanks for doing this.

Quote · 10 Jun 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.