Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Temporary CB 1.2 Plugin Tab fix

Temporary CB 1.2 Plugin Tab fix 16 years 2 months ago #2441

  • joomlascott
  • joomlascott's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I have a temporary fix for Joomla 1.5.7 and CB 1.2 DTRegister Plugin tab. I say temporary because I am matching on the email address of the logged in user instead of the user_id. I am doing this because I noticed that the dtregister_user table is not writing the correct user_id, it appears to be writing them all as 0 (zero).

I replaced all of the code in /components/com_comprofiler/plugin/user/plug_dtregisterrecords/dtregister.plugin.php with the following code.

I have tested this on my site and it is now showing the events that the user has signed up for.

USE AT YOUR OWN RISK - Backup the original dtregister.plugin.php first
<?php
/*************************************************************************************
* Tab for Community Builder 1.2 User Profiles to display the registered events of 
* the current users In DT Register
* Author: Scott Carney based upon the Joomgallery CB Tab as created by
* Author: Armin Hornung http://www.arminhornung.de
* Date: sept 2008
* Version: 1 (beta)
* Released under GNU GPL Public License http://www.gnu.org/copyleft/gpl.html
*************************************************************************************/

class getRegisteredEvents extends cbTabHandler {
function getDtregisteredTab() {
$this->cbTabHandler();
}

/**
* Main function, displays the DTRegister-Tab in Community Builder
**/
function getDisplayTab($tab,$user,$ui) {

global $database,$mosConfig_live_site, $mosConfig_absolute_path, $my, $mainframe;

$tag = \"Registered Events Tab for Community Builder and DTRegister.\";
$uid=intval( mosGetParam( $_REQUEST, \"uid\", 0 ) );
$params = $this->params;

// Determine # of pics for pagination
$database->setQuery(\"SELECT count(userId) FROM #__dtregister_user as a \"
. \"\\n WHERE a.userId = $user->id\");

$total=$database->loadResult();

// Pagination:
$startpage=1;
$entriesNumber=$params->get(\'number_entries\',10);
$pagingParams = $this->_getPaging(array(),array(\"entries_\"));
if ($pagingParams[\"entries_limitstart\"] === null)
$pagingParams[\"entries_limitstart\"] = \"0\";
if ($entriesNumber > $total)
$pagingParams[\"entries_limitstart\"] = \"0\";

// Start of Events table:
$return.= \"<table width=\'95%\' border=\'0\' cellspacing=\'5\' cellpadding=\'5\'>\";
$return .= \"<tr class=\'sectiontableheader\'>\";
$return .= \"<td align=\'left\'><strong><u>Event Title</u></strong></td>\";
$return .= \"<td align=\'left\'><strong><u>Date Registered</u></strong></td>\";
$return .= \"</tr>\";

// Main query: 
// Note: Temporary Fix Match on email as dtregister_user is not capturing logged in user_id and is populating record as 0 in user_id field
$database->setQuery(
\"SELECT a.register_date,b.title,b.publish_up,c.email \"
. \"FROM #__users as c, #__dtregister_user as a \"
. \"INNER JOIN #__events as b ON a.eventId=b.id\"
. \"\\n WHERE c.id = $user->id\"
. \"\\n AND c.email = a.userEmail\"
. \"\\n ORDER BY a.register_date DESC\"
. \"\\n LIMIT \".($pagingParams[\"entries_limitstart\"]?$pagingParams[\"entries_limitstart\"]:\"0\").\",\".$entriesNumber);


$rows=$database->loadObjectList();
$return.= \"<tr class=\'sectiontableentry\'>\";
$rowcounter=0;


foreach ( $rows as $row1 ){
if ( ($rowcounter % 3 == 0) AND ($rowcounter <> 0) )
$return.=\"</tr><tr>\";

$return.= \"<tr class=\'sectiontableentry\'>\";
$return.= \"<td>\".$row1->title.\" ( \". mosFormatDate($row1->publish_up,\'%m-%d-%Y\') .\" )</td>\";
$return .= \"<td>\".mosFormatDate($row1->register_date,\'%m-%d-%Y\').\"</td>\";
$return.= \"</td>\";
$return .= \"</tr>\";
$rowcounter++;
}
if ( $rowcounter % 3 <> 0 ){
for ( $i=1; $i <= (3 - ($rowcounter % 3)); $i++ ) {
$return.= \"<td class=\'sectiontableentry\'> </td>\";
}
}

$return.= \"</tr></table>\";

// Pagination, if configured to show:
$showPagination = ($params->get(\'pagination\',\'1\')==\'1\');
if ($showPagination &&($entriesNumber < $total)) {
$return .= \"<div style=\'width:95%;text-align:center;\'>\"
.$this->_writePaging($pagingParams,\"DtregisteredTab_\",$entriesNumber,$total)
.\"</div>\";
}

return $return;
}
}
?>

Please Log in or Create an account to join the conversation.

Temporary CB 1.2 Plugin Tab fix 16 years 2 months ago #2448

  • dthadmin
  • dthadmin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 5470
  • Thank you received: 3
DT Register only records the user_id as 0 if no one is logged in during the registration. This works correctly when using CB 1.1. We have not thoroughly tested it with 1.2 though.

Please Log in or Create an account to join the conversation.

Temporary CB 1.2 Plugin Tab fix 16 years 2 months ago #2455

  • joomlascott
  • joomlascott's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
It must be a CB 1.2 issue then as I am logged in. Funny part is when registering it does know who I am because it auto-populates the name and email fields. But yet when registering it still shows the user id as 0

I am using this as a temporary fix Until you do have the CB 1.2 integration going..its a very basic tab...just lists event...I haven\'t figured out how to link the event listed in the tab to the event so it can be clicked on yet...but for now it gives the basic functionality I need.

Thanks

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.336 seconds