hi,
i've tested comprehensively (as far as my knowledge allows), and now think this is either a bug, or the mysql connection is incorrect for this page alone.
i have created a custom php block pulling records from the mysql dbase. the block/code displays perfectly except on the smf administrator's portal (smf 2.0 rc3). it displays perfectly on the portal of anyone who is not an administrator.
there are no permissions set for it anywhere (in the block it is set to ignore permissions).
the only thing i can think of, other than it being a bug, is that the portal page needs to have the admin mysql connection set differently to the other members ..?
here is the code although, as i said, it works perfectly well elsewhere... any ideas?
global $settings, $context, $modSettings, $user_info, $txt, $scripturl, $boardurl, $boarddir;
require_once('./Connections/mirrorfoundation.php');
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_current_total = "SELECT DISTINCT COUNT(smf_members.id_member) AS countthis
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE startdate<=CURDATE() AND enddate>=CURDATE() ORDER BY M_program, M_first_name ASC";
$current_total = mysql_query($query_current_total, $mirrorfoundation) or die(mysql_error());
$row_current_total = mysql_fetch_assoc($current_total);
$totalRows_current_total = mysql_num_rows($current_total);
$query_nextmonth_total = "SELECT DISTINCT COUNT(smf_members.id_member) AS countnext
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE startdate > CURDATE() AND (MONTH(startdate) = MONTH(DATE_ADD( CURDATE() , INTERVAL 1 MONTH ))) ORDER BY startdate, M_program, M_first_name ASC";
$nextmonth_total = mysql_query($query_nextmonth_total, $mirrorfoundation) or die(mysql_error());
$row_nextmonth_total = mysql_fetch_assoc($nextmonth_total);
$totalRows_nextmonth_total = mysql_num_rows($nextmonth_total);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_stilltocomethismonth_total = "SELECT DISTINCT COUNT(smf_members.id_member) AS countthiswill
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE startdate > CURDATE() AND (MONTHNAME(startdate)=MONTHNAME(CURDATE())) AND YEAR(startdate) = YEAR(CURDATE()) ORDER BY UNIX_TIMESTAMP(startdate), M_program, M_first_name ASC";
$stilltocomethismonth_total = mysql_query($query_stilltocomethismonth_total, $mirrorfoundation) or die(mysql_error());
$row_stilltocomethismonth_total = mysql_fetch_assoc($stilltocomethismonth_total);
$totalRows_stilltocomethismonth_total = mysql_num_rows($stilltocomethismonth_total);
$query_volunteers_current = "SELECT DISTINCT smf_members.id_member, CONCAT(UPPER(SUBSTRING(M_first_name,1,1)), LOWER(SUBSTRING(M_first_name,2)), ' ', UPPER(SUBSTRING(M_last_name,1,1))) AS name, email_address, startdate AS sortdate, DATE_FORMAT(startdate,'%D') AS startdate, IF(M_program='INDOOR', UPPER(SUBSTRING(M_program,1,2)),UPPER(SUBSTRING(M_program,1,3))) AS M_program, CURDATE()
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE startdate<=CURDATE() AND enddate>=CURDATE()
ORDER BY M_program, M_first_name ASC";
$volunteers_current = mysql_query($query_volunteers_current, $mirrorfoundation) or die(mysql_error());
$row_volunteers_current = mysql_fetch_assoc($volunteers_current);
$totalRows_volunteers_current = mysql_num_rows($volunteers_current);
$query_volunteers_stilltocomethismonth = "SELECT DISTINCT smf_members.id_member, CONCAT(UPPER(SUBSTRING(M_first_name,1,1)), LOWER(SUBSTRING(M_first_name,2)), ' ', UPPER(SUBSTRING(M_last_name,1,1))) AS name, email_address, startdate AS sortdate, DATE_FORMAT(startdate,'%D') AS startdate, IF(M_program='INDOOR', UPPER(SUBSTRING(M_program,1,2)),UPPER(SUBSTRING(M_program,1,3))) AS M_program
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE
startdate > CURDATE()
AND
(MONTHNAME(startdate)=MONTHNAME(CURDATE()))
AND
YEAR(startdate) = YEAR(CURDATE( ))
ORDER BY sortdate ASC, M_program, M_first_name";
$volunteers_stilltocomethismonth = mysql_query($query_volunteers_stilltocomethismonth, $mirrorfoundation) or die(mysql_error());
$row_volunteers_stilltocomethismonth = mysql_fetch_assoc($volunteers_stilltocomethismonth);
$totalRows_volunteers_stilltocomethismonth = mysql_num_rows($volunteers_stilltocomethismonth);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_volunteers_nextmonth = "SELECT DISTINCT smf_members.id_member, CONCAT(UPPER(SUBSTRING(M_first_name,1,1)), LOWER(SUBSTRING(M_first_name,2)), ' ', UPPER(SUBSTRING(M_last_name,1,1))) AS name, email_address, startdate AS sortdate, DATE_FORMAT(startdate,'%D') AS startdate, MONTHNAME( DATE_ADD( CURDATE( ) , INTERVAL 1
MONTH ) ) AS monthname, IF(M_program='INDOOR', UPPER(SUBSTRING(M_program,1,2)),UPPER(SUBSTRING(M_program,1,3))) AS M_program
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE startdate > CURDATE( )
AND (
MONTH( startdate ) = MONTH( DATE_ADD( CURDATE( ) , INTERVAL 1
MONTH ) )
)
ORDER BY sortdate ASC, M_program, M_first_name";
$volunteers_nextmonth = mysql_query($query_volunteers_nextmonth, $mirrorfoundation) or die(mysql_error());
$row_volunteers_nextmonth = mysql_fetch_assoc($volunteers_nextmonth);
$totalRows_volunteers_nextmonth = mysql_num_rows($volunteers_nextmonth);
$query_users = "SELECT DISTINCT smf_members.id_member, CONCAT(UPPER(SUBSTRING(M_first_name,1,1)), LOWER(SUBSTRING(M_first_name,2)), ' ', SUBSTRING(M_last_name, 1,1)) AS name, enddate, DATEDIFF(enddate,CURDATE()) AS daysleft
FROM
(smf_members LEFT JOIN volunteer_profiles
ON
smf_members.id_member=volunteer_profiles.id_member
)
LEFT JOIN volunteer_appforms
ON
volunteer_appforms.id_member=smf_members.id_member
WHERE DATEDIFF(enddate,CURDATE()) BETWEEN 1 AND 10
ORDER BY enddate, M_first_name DESC";
$users = mysql_query($query_users, $mirrorfoundation) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = mysql_num_rows($users);
echo '
<table class="table" width="100%">
<tr class="catbg3" width="100%">
<td colspan="2" class="windowbg3" width="100%">
Leaving soon
</td>
</tr>
<tr class="catbg3" width="100%">
<td class="smalltext">';
echo date('D jS', strtotime($row_users['enddate'])); ?>: <?php echo '
<a href="', $scripturl . '?action=profile;u=', $row_users['id_member'] ,'">', $row_users['name'] ,'</a>
</td>
</tr>';
echo '<tr class="catbg3" width="100%">
<td colspan="2" class="windowbg3" width="100%"><hr />
Current (', $row_current_total['countthis'] ,')</td>
</tr>';
do {
echo '<tr class="catbg3" width="100%">
<td class="smalltext">';
echo '<a href="', $scripturl . '?action=profile;u=', $row_volunteers_current['id_member'] ,'">', $row_volunteers_current['name'] ,'</a></td>
<td class="smalltext">', $row_volunteers_current['M_program'] ,'</td>
</tr>';
} while ($row_volunteers_current = mysql_fetch_assoc($volunteers_current));
echo '<tr class="catbg3" width="100%">
<td colspan="2" class="windowbg3"><hr />
Due later this month (', $row_stilltocomethismonth_total['countthiswill'],')</td>
</tr>';
do {
echo '<tr class="catbg3" width="100%">
<td class="smalltext">';
echo '<a href="', $scripturl . '?action=profile;u=', $row_volunteers_stilltocomethismonth['id_member'] ,'">', $row_volunteers_stilltocomethismonth['name'] ,'</a></td>
<td class="smalltext">', $row_volunteers_stilltocomethismonth['M_program'] ,' ',$row_volunteers_stilltocomethismonth['startdate'] ,'</td>
</tr>';
} while ($row_volunteers_stilltocomethismonth = mysql_fetch_assoc($volunteers_stilltocomethismonth));
echo '<tr class="catbg3" width="100%">
<td colspan="2" class="windowbg3" width="100%"><hr />
Due next month (', $row_nextmonth_total['countnext'] ,')</td>
</tr>';
do {
echo '<tr class="catbg3" width="100%">
<td class="smalltext">';
echo '<a href="', $scripturl . '?action=profile;u=', $row_volunteers_nextmonth['id_member'] ,'">', $row_volunteers_nextmonth['name'] ,'</a></td>
<td class="smalltext">', $row_volunteers_nextmonth['M_program'],' ', $row_volunteers_nextmonth['startdate'] ,'</td>
</tr>';
} while ($row_volunteers_nextmonth = mysql_fetch_assoc($volunteers_nextmonth));
echo '
<tr>
<td height="20" colspan="2" align="center" class="windowbg3" width="100%">Key to programmes<br>
COL = Colleague<br>
IN = Indoor<br>
OUT = Outdoor<br>
JAP = Japanese</td>
</tr></table>
</body></html>';
mysql_free_result($current_total);
mysql_free_result($nextmonth_total);
mysql_free_result($stilltocomethismonth_total);
mysql_free_result($volunteers_current);
mysql_free_result($volunteers_stilltocomethismonth);
mysql_free_result($volunteers_nextmonth);
mysql_free_result($users);
EDIT: forgot to say - the block itself shows as a header with the title in it, and the top section of the main box (with the curved corners)