Hello,
i´m trying to display the avatar of CB members who are displayed in the module uzbirthday (birthay date) but i can´t get the image to display correctly. There´s something wrong about the query that i m not being able to solve.
Here´s what i added to the default.php of the uzbirthday module code:
$config =& JFactory::getConfig();
$database=& JFactory::getDBO();
$query = "SELECT avatar FROM `#__comprofiler` WHERE `user_id` = {USERID} AND `avatarapproved` = '1'";
$database->setQuery( $query );
$avatar = $database->loadResult();
$avatarlink = $config->liveSite.'/images/comprofiler/'.$avatar;
echo JHTML::image($avatarlink, 'avatar');
and the code of the defaul.php is:
<?php
/**
* Module: mod_uzbirthdays
* Version: 3.12
* Joomla: 1.5 and 1.6
* Author: Udo Zaydowicz ->
www.zaydowicz.de/joomla.html
* Date: 2011-09-22
* License: GNU/GPL v3 ->
www.gnu.de/documents/gpl-3.0.de.html
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
$config =& JFactory::getConfig();
$database=& JFactory::getDBO();
$query = "SELECT avatar FROM `#__comprofiler` WHERE `user_id` = {USERID} AND `avatarapproved` = '1'";
$database->setQuery( $query );
$avatar = $database->loadResult();
$avatarlink = $config->liveSite.'/images/comprofiler/'.$avatar;
echo JHTML::image($avatarlink, 'avatar');
function Load_CBfield($fieldname) {
global $database;
$user =& JFactory::getUser();
$userId = $user->get( 'id' );
$sql = "SELECT avatar FROM `#__comprofiler` WHERE `user_id` = {USERID} AND `avatarapproved` = '1'";
$database->setQuery( $sql );
echo $database->loadResult();
}
echo ('<img src="images/comprofiler/'.$avatar.'>');
// Set bold type
if (1 == $params->get('show_boldface', 0))
{
$boldstart = "<b>";
}
else
{
$boldstart = "";
}
$boldend = $boldstart;
// Display birthdays
if ($uz_birthdays)
{
$future = 0;
$actual = 0;
$id = 0;
// Output
$html = "<ul style=\"list-style-type:none;\">\n";
foreach ($uz_birthdays as $day)
{
// Prevent duplicate entries for admin (logged in backend + frontend)
if ($id == $day->user_id)
{
continue;
}
if (0 == $day->days_to_go)
{
$actual = 1;
}
// Title for future birthdays
if ($day->days_to_go > 0)
{
if (0 == $actual)
{
$actual = 1;
$html .= $boldstart . $params->get('text_no_birthday', 'no birthdays') . $boldend;
}
if (0 == $future)
{
$future = 1;
$html .= "</ul>\n";
$soon = $params->get('text_future', 'soon');
if (strlen($soon) > strlen(trim($soon, "%b")))
{
$html .= "<br />";
$soon = trim ($soon, "%b");
}
$html .= $boldstart . $soon . $boldend;
$html .= "<ul style=\"list-style-type:none;\">\n";
}
}
// List entries
$html .= "<li>";
$html .= $boldstart;
// Show online status
if (1 == $params->get('show_status', 1))
{
if ($day->time > 0)
{
$html .= "<img src=\"" . JURI::base() . "/modules/mod_uzbirthdays/images/online.gif\" title=\"online\"/> ";
}
else
{
$html .= "<img src=\"" . JURI::base() . "/modules/mod_uzbirthdays/images/offline.gif\" title=\"offline\"/> ";
}
}
// Username or Realname with or without profile link
if (0 == $params->get('show_realname', 0)) // username
{
if (1 == $params->get('show_link', 1))
{
$html .= "<a href=\"index.php?option=com_comprofiler&task=userProfile&user=" . $day->user_id . "\">" . $day->username . "</a>";
}
else
{
$html .= $day->username;
}
}
else // real name
{
if (1 == $params->get('show_link', 1))
{
$html .= "<a href=\"index.php?option=com_comprofiler&task=userProfile&user=" . $day->user_id . "\">" . $day->name . "</a>";
}
else
{
$html .= $day->name;
}
}
$html .= $boldend;
// Show_day/age or not
if (0 == $day->days_to_go)
{
if (1 == $params->get('show_age', 1))
{
if ('' == $params->get('age_unit', ''))
{
$html .= " (" . $day->age . ")";
}
else
{
$html .= " (" . $day->age . " " . $params->get('age_unit', '') . ")";
}
}
}
else
{
if ($params->get('days_in_future', 7) > 0)
{
switch ($params->get('date_type', 0))
{
case 0:
$date = $day->gday . "." . $day->gmonth . ".";
break;
case 1:
$date = $day->gmonth . "." . $day->gday . ".";
break;
case 2:
$date = $day->gday . "-" . $day->gmonth;
break;
case 3:
$date = $day->gmonth . "-" . $day->gday;
break;
}
if (1 == $params->get('show_age', 1))
{
if ('' == $params->get('age_unit', ''))
{
$html .= " (" . $day->age . ")";
}
else
{
$html .= " (" . $day->age . " " . $params->get('age_unit', '') . ")";
}
}
if (1 == $params->get('show_date', 1))
{
$html .= " (" . $date. ")";
}
}
}
$html .= "</li>\n";
$id = $day->user_id;
}
$html .= "</ul>\n";
echo $html;
}
else
{
// Show if no birthdays were found
echo $boldstart . $params->get('text_no_birthday', 'no birthdays') . $boldend;
}
?>