too many friends

15 years 4 months ago #81122 by krileon
Replied by krileon on topic Re:too many friends
Done. ;)

Open: [code:1]/components/com_comprofiler/comprofiler.html.php[/code:1]

Locate:
[code:1] // Tab 1: Manange Connections:
echo $tabs->startTab("myCon",_UE_MANAGECONNECTIONS,"connections"«»);
[/code:1]

Add the following directly below it:
[code:1]
global $database, $my;
$cbCon = new cbConnection($my->id);
$total = $cbCon->getConnectionsCount($my->id);
$connectionsNumber = 10;
$pagingParams = $tabs->_getPaging(array(),array("connections_"«»));
if ($pagingParams["connections_limitstart"] === null)
$pagingParams["connections_limitstart"] = "0";
if ($connectionsNumber > $total)
$pagingParams["connections_limitstart"] = "0";
$query = "SELECT DISTINCT m.*,u.name,u.email,u.username,u.lastvisitDate,c.avatar,c.avatarapproved, u.id, IF(s.session_id=null,0,1) AS 'isOnline' "
. "\n FROM #__comprofiler_members AS m"
. "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id"
. "\n LEFT JOIN #__users AS u ON m.memberid=u.id"
. "\n LEFT JOIN #__session AS s ON s.userid=u.id"
. "\n WHERE m.referenceid=". (int) $my->id .""
. "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0 AND m.accepted=1"
. "\n LIMIT ".($pagingParams["connections_limitstart"]?$pagingParams["connections_limitstart"]:"0"«»).",".$connectionsNumber;
;
$database->setQuery( $query );
$connections = $database->loadObjectList();
[/code:1]

Locate: [code:1]foreach($connections AS $connection) {[/code:1]

Scroll to: [code:1]echo "</table><br />";[/code:1]

Add the following directly below it:
[code:1] if ($connectionsNumber < $total) echo "<div style='width:95%;text-align:center;'>".$tabs->_CONSwritePaging($pagingParams,"connections_",$connectionsNumber,$total)."</div>";
[/code:1]

Default connection limit is 10 per page. You may change this by editing:
[code:1]$connectionsNumber = 10;[/code:1]

Open:
[code:1]/administrator/components/com_comprofiler/plugin.class.php[/code:1]

Find:
[code:1]function _writePaging[/code:1]

Add the following function:
[code:1] function _CONSwritePaging( $pagingParams, $postfix, $limit, $total, $task = 'manageConnections' )
{
$base_url = 'index.php?option=com_comprofiler&task='.$task;
$prefix = $this->_getPrefix( $postfix );
return writePagesLinks( $pagingParams[$postfix . 'limitstart'], $limit, $total, $base_url, null, $prefix );
}
[/code:1]

Save and that's it. Manage Connections tab is now paginated.

Post edited by: krileon, at: 2008/12/02 18:17

Post edited by: krileon, at: 2008/12/02 18:46


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

15 years 2 months ago #86243 by rc03tl
Replied by rc03tl on topic Re:too many friends
I added this fix but I ended up with an error message on line 1573 for an undefined task
specifically with this line
$total = $cbCon->getConnectionsCount($my->id);
crashed the whole manage connections page so I went back to original

I would love to paginate this feature as well. 8]

Thanks in advance

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.429 seconds