Jump to content

Recommended Posts

I know theres just a few code changes I need for a few plugings to work on my subsites, so any help is welcomed

 

<?php
/**
* Tab to display medals of the jAwards Component in a CB-Profile
* Author: Armin Hornung
*/
class getAwardsTab extends cbTabHandler {
function getAwardsTab() {
$this->cbTabHandler();
}

function getDisplayTab($tab,$user,$ui) {
global $database,$mosConfig_live_site, $mosConfig_absolute_path, $mosConfig_lang;
// Language:
if (file_exists($mosConfig_absolute_path."/administrator/components/com_jawards/language/".$mosConfig_lang.".php"))
include_once($mosConfig_absolute_path."/administrator/components/com_jawards/language/".$mosConfig_lang.".php");
else if(file_exists($mosConfig_absolute_path."/administrator/components/com_jawards/language/english.php"))
include_once($mosConfig_absolute_path."/administrator/components/com_jawards/language/english.php");
else return "Error: No language file could be loaded. Is the jAwards component properly installed?";

// Config & jAwards-component-check:
if (file_exists($mosConfig_absolute_path."/administrator/components/com_jawards/config.jawards.php"))
require_once($mosConfig_absolute_path."/administrator/components/com_jawards/config.jawards.php");
else return "Error: jAwards Config file could not be read. Is the appropriate version of the jAwards-component installed?";

$params = $this->params;
$return="";
$query = "SELECT *"
. "\n FROM #__jawards_awards AS a"
. "\n LEFT JOIN #__jawards_medals AS b ON b.id = a.award"
. "\n WHERE a.userid=". $user->id .""
. "\n ORDER BY a.date desc"
;
$database->setQuery( $query );

$items = $database->loadObjectList();
if(!count($items)>0) {
// $return = _AWARDS_NOAWARD;
// return $return;
return null;
}

$return .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">";
$return .= "<tr class=\"sectiontableheader\">";
$return .= "<td colspan=\"2\">"._AWARDS_AWARD."</td><td>"._AWARDS_DATE."</td>";
if ($ja_config['showawardreason'])
$return .="<td>"._AWARDS_REASON."</td>";
$return .= "</tr>";
$i=1;
foreach($items AS $item) {
$i= ($i==1) ? 2 : 1;
$return .= "<tr class=\"sectiontableentry$i\"><td>"
."<img src=\"".$mosConfig_live_site."/images/medals/".$item->image."\" alt=\"".$item->image."\" />"
."<td>".$item->name." </td>"
."</td><td> ".date("d. m. Y",strtotime($item->date)) . "</td>";
if ($ja_config['showawardreason'])
$return .="<td>$item->reason</td>";

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

}
$return .= "</table>";
$descUrl = $params->get('awardsDesc','');
$showDesc = $params->get('showAwardsDesc','1');

if ($descUrl =='')
$descUrl='index.php?option=com_jawards';

if ($showDesc)
$return.="<br /><a href=\"$descUrl\">"._AWARDS_INFORMATION."</a>";

return $return;
}
}
?>

 

My subsites are located on the same DB if this helps

Link to comment
https://forums.phpfreaks.com/topic/87245-making-plugin-work-with-subsite/
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.