Put members block from home page onto account page

I have been asked how to put the members block from the home page onto the account page(members.php)

The following are instructions on how to do it.

Open member.php and make the following changes.

Look for this.

require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );

And add this right after it.

include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php');

Now look for this.

bx_import('BxDolMemberMenu');
bx_import('BxDolPageView');


And add this right after it.

bx_import('BxTemplVotingView');

Now look for this.

function BxDolMember($iMember, &$aSite, &$aDir) {
$this->iMember     = (int)$iMember;
$this->aMemberInfo = getProfileInfo($this->iMember);

$this->aConfSite = $aSite;
$this->aConfDir  = $aDir;

parent::BxDolPageView('member');
}


And add this right after it. This code has been attached incase the forum messes up the code below.

function getBlockCode_Members() {
$iMaxNum = (int) getParam( "top_members_max_num" ); // number of profiles
$aCode = $this->getMembers('Members', array(), $iMaxNum);
return $aCode;
}

function getMembers ($sBlockName, $aParams = array(), $iLimit = 16, $sMode = 'last') {
$aDefFields = array(
'ID', 'NickName', 'Couple', 'Sex'
);

$iOnlineTime = (int)getParam( "member_online_time" );

//main fields
$sqlMainFields = "";
foreach ($aDefFields as $iKey => $sValue)
$sqlMainFields .= "`Profiles`. `$sValue`, ";

$sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL $iOnlineTime MINUTE ), 1, 0) AS `is_online`";

// possible conditions
$sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";
if (is_array($aParams)) {
foreach ($aParams as $sField => $sValue)
$sqlCondition .= " AND `Profiles`.`$sField` = '$sValue'";
}

// top menu and sorting
$aModes = array('last', 'top', 'online');
$aDBTopMenu = array();

$sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'last';
$sqlOrder = "";
foreach( $aModes as $sMyMode ) {
switch ($sMyMode) {
case 'online':
if ($sMode == $sMyMode) {
$sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE)";
$sqlOrder = " ORDER BY `Profiles`.`Couple` ASC";
}
$sModeTitle = _t('_Online');
break;
case 'last':
if ($sMode == $sMyMode)
$sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
$sModeTitle = _t('_Latest');
break;
case 'top':
if ($sMode == $sMyMode) {
$oVotingView = new BxTemplVotingView ('profile', 0, 0);
$aSql        = $oVotingView->getSqlParts('`Profiles`', '`ID`');
$sqlOrder    = $oVotingView->isEnabled() ? " ORDER BY `Profiles`.`Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `Profiles`.`DateReg` DESC" : $sqlOrder;
$sqlMainFields .= $aSql['fields'];
$sqlLJoin    = $aSql['join'];
$sqlCondition .= " AND `pr_rating_count` > 1";
}  
$sModeTitle = _t('_Top');
break;
}
$aDBTopMenu[$sModeTitle] = array('href' => "{$_SERVER['PHP_SELF']}?{$sBlockName}Mode=$sMyMode", 'dynamic' => true, 'active' => ( $sMyMode == $sMode ));
}
$iCount = (int)db_value("SELECT COUNT(`Profiles`.`ID`) FROM `Profiles` $sqlLJoin $sqlCondition");
$aData = array();
$sPaginate = '';
if ($iCount) {
$iNewWidth = BX_AVA_W + 6;
$iPages = ceil($iCount/ $iLimit);
$iPage = (int)$_GET['page'];
if ($iPage < 1)
$iPage = 1;
if ($iPage > $iPages)
$iPage = $iPages;

$sqlFrom = ($iPage - 1) * $iLimit;
$sqlLimit = "LIMIT $sqlFrom, $iLimit";

$sqlQuery = "SELECT " . $sqlMainFields . " FROM `Profiles` $sqlLJoin $sqlCondition $sqlOrder $sqlLimit";
$rData = db_res($sqlQuery);
$iCurrCount = mysql_num_rows($rData);
$aOnline = array();
while ($aData = mysql_fetch_assoc($rData)) {
$sCode .= '<div class="featured_block_1" style="width:'.$iNewWidth.'px;">';
$aOnline['is_online'] = $aData['is_online'];
$sCode .= get_member_thumbnail($aData['ID'], 'none', true, 'visitor', $aOnline);
$sCode .= '</div>';
}           
$sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.featured_block_1');

if ($iPages > 1) {
$oPaginate = new BxDolPaginate(array(
'page_url' => BX_DOL_URL_ROOT . 'member.php',
'count' => $iCount,
'per_page' => $iLimit,
'page' => $iPage,
'per_page_changer' => true,
'page_reloader' => true,
'on_change_page' => 'return !loadDynamicBlock({id}, 'member.php?'.$sBlockName.'Mode='.$sMode.'&page={page}&per_page={per_page}');',
'on_change_per_page' => ''
));
$sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . 'browse.php');
}   
} else {
$sCode = MsgBox(_t("_Empty"));
}
return array($sCode, $aDBTopMenu, $sPaginate);
}


Save member.php

Now open templates/base/css/general.css and add the following to the bottom.

div.featured_block_1
{
float:left;
border:none;
margin:5px;
position:relative;
}



Now add this to the database.

In phpMyAdmin run the following query.

INSERT INTO `sys_page_compose` (`Page`, `PageWidth`, `Desc`, `Caption`, `Column`, `Order`, `Func`, `Content`, `DesignBox`, `ColWidth`, `Visible`, `MinWidth`) VALUES
'member', '998px', 'Short list of top profiles selected by given criteria', '_Members', 0, 0, 'Members', '', 1, 66, 'non,memb', 0);

The above query creates a member block on the account page in the inactive section.

Now go into admin->Builders-Pages Blocks and go to the Account Page. Move the member block we inserted above into the page where you want it to appear.

All done.

MemberBlockOnMembers.php · 5.3K · 384 downloads
https://www.deanbassett.com
Quote · 17 Aug 2010

Thanks

https://dolphin-techs.com - Skype: Dolphin Techs
Quote · 17 Aug 2010

thanks for providing the code.

is there any chance you can tell us how to add search keyword block from searchKeyword.php on view video page. ?

i want to add a search video block right above the video player.

i will be very much greatful if you could spare some time and share some info regarding this.

 

thanks

Regards........ M.Chauhan U.K.
Quote · 18 Aug 2010

 

thanks for providing the code.

is there any chance you can tell us how to add search keyword block from searchKeyword.php on view video page. ?

i want to add a search video block right above the video player.

i will be very much greatful if you could spare some time and share some info regarding this.

 

thanks

 

Regards........ M.Chauhan U.K.
Quote · 18 Aug 2010

I will look into it. No guarantees. This one was easy as both the home page and the account page are standard dolphin pages. Not modules. Thus this only required copying some stuff from one page to another.

The keyword search block will not be as easy.



https://www.deanbassett.com
Quote · 18 Aug 2010

thanks for your time....

and tahnks for teh support you provide here.

I will look into it. No guarantees. This one was easy as both the home page and the account page are standard dolphin pages. Not modules. Thus this only required copying some stuff from one page to another.

The keyword search block will not be as easy.



 

Regards........ M.Chauhan U.K.
Quote · 18 Aug 2010

Deano this is realy nice man

but can you tell me how to add the member profile block on the information page

Thank's

 

I will look into it. No guarantees. This one was easy as both the home page and the account page are standard dolphin pages. Not modules. Thus this only required copying some stuff from one page to another.

The keyword search block will not be as easy.



 

Post Reply - if you going to help - No for - bla bla bla bla
Quote · 18 Aug 2010

I need an example URL so i know exactly what page you are referring to.

I will look into it when i get some more free time.



https://www.deanbassett.com
Quote · 18 Aug 2010

You know when you go to  >> profile_info.php

You only see the > >  General Info  >> Additional Information and  Description

 

So I want to know how to add the member profile photo block on the >> profile_info.php


I need an example URL so i know exactly what page you are referring to.

I will look into it when i get some more free time.



Post Reply - if you going to help - No for - bla bla bla bla
Quote · 19 Aug 2010

Oh, copying the photo block.

That ones above me. Tried it before, failed. So maybe someone else can figure it out.

https://www.deanbassett.com
Quote · 19 Aug 2010

A correction was needed to the MYSQL query i provided due to a syntax error. Because i cannot edit my post i will post the corrected query here.

INSERT INTO `sys_page_compose` (`Page` ,`PageWidth` ,`Desc` ,`Caption` ,`Column` ,`Order` ,`Func` ,`Content` ,`DesignBox` ,`ColWidth` ,`Visible` ,`MinWidth`) VALUES ('member', '998px', 'Short list of top profiles selected by given criteria', '_Members', '0', '0', 'Members', '', '1', '66', 'non,memb', '0');


Origional post was missing a ( after VALUES.

https://www.deanbassett.com
Quote · 19 Aug 2010

Also note that due to differences in the page block width, the number of members shown on the home page may not fit properly on the block on the member page unless the column width the block is in is the same as the one on the home page. Thus you may need to adjust the number of members shown in that block.

If you change the value in the admin it will affect both blocks, so instead you can do it in the code. In this function of the code provided above.

function getBlockCode_Members() {
$iMaxNum = (int) getParam( "top_members_max_num" ); // number of profiles

Note the $iMaxNum setting. Change that line to this to control the number of members shown in the block.

$iMaxNum = 14;

14 works well on my site, but you can set it to any number you want.


https://www.deanbassett.com
Quote · 19 Aug 2010

works perfectly, thanks again Smile

Quote · 19 Aug 2010

I tried doing this for dolphin 7.0.9, but when I try to do the MySQL query, I get the following error.

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''member', '998px', 'Short list of top profiles selected by given criteria', '_Me' at line 2

Found error in the file '/home/mysite/public_html/inc/utils.inc.php' at line 657.
Called 'db_res' function with erroneous argument #0.

Quote · 8 Feb 2012

The code is getting altered somehow when your pasting it. You show a double quote in front of the word member. If you look at the origional query i posted, it is a single quote. You need to ensure it is pasting 100% perfect. One incorrect quote will cause a error.

https://www.deanbassett.com
Quote · 8 Feb 2012

thanks for quick response.  I have pasted directly from the page.  I tried  itdoing it through your tools mod and through PHPadmin.  When I past it, the code is exactly as above, without double quotes.  It shows the double quotes on the error though.

Quote · 8 Feb 2012

I cannot help. The code is accurate and works. I do not know what is causing the alteration.

Try pasting it into a standard text editor first. Verify code is the same, then copy and paste from the editor.

You may also try pasting it into a text file with a sql extension and use the import feature in phpmyadmin to run the query that way.

https://www.deanbassett.com
Quote · 8 Feb 2012

Thanks Deano.  I tried both ways as you suggested and neither worked.  Thanks for you help anyway.

Quote · 8 Feb 2012

Hello Deano:

 

I am trying to use the code that you presented for putting a member's block on the account page and I am getting the following error:

 

Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/torrence/public_html/member.php on line 156

 

which  is line:

 

'on_change_page' => 'return !loadDynamicBlock({id}, 'member.php?'.$sBlockName.'Mode='.$sMode.'&page={page}

 

 ============================

Can you please help me out?   it's located 11th from the bottom of the code that is pasted after

parent::BxDolPageView('member');
}

 

Thanks,

 

Torrence

Quote · 26 Mar 2012

You are having a line break problem.

This is the full line.

'on_change_page' => 'return !loadDynamicBlock({id}, 'member.php?'.$sBlockName.'Mode='.$sMode.'&page={page}&per_page={per_page}');',

What you see under what you posted is actually part of the line. Make sure your editor did not break it into two lines. Which i suspect it did.

This could also mean other lines may have been broken by your editor as well. I suggest notepad++ or Editplus as a editor. If copied and pasted directly from here, then that should not have happened.

https://www.deanbassett.com
Quote · 26 Mar 2012

Hello Deano:

I am trying to use the code that you presented for putting a member's block on the account page and I am getting the following error:

Parse error: syntax error, unexpected T_STRING, expecting ')' in

which  is line:

'on_change_page' => 'return !loadDynamicBlock({id}, 'member.php?'.$sBlockName.'Mode='.$sMode.'&page={page}&per_page={per_page}');',

Please help  , Thanks

Quote · 4 Apr 2012

Look at the post just above yours. You are having the same problem as the last person.

https://www.deanbassett.com
Quote · 4 Apr 2012

Hello,

I'd be interested to add the last block written on an html page that does not belong to dolphin.

Is this possible?
If so, would it be possible to see that last part that we put an avatar?

thank you very much

Quote · 13 Aug 2012
 
 
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.