News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Show Number of Errors at Top of Forum

Started by live627, January 27, 2007, 11:58:10 PM

Previous topic - Next topic

live627

Link to Mod

This mod will show the number of errors in your error log, as well as the number of errors on the current page at the top of the forum:

The 'debug' link will reload the page with debugging temporarily enabled (it will output all errors directly to the page, and also show some information at the bottom of the page). This will allow you to see what's causing the errors.

Theme edits (for custom theme)
Themes/[your theme]/index.template.php
Find:

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}


Add after:

// ---- Begin modification - Errors on top of page ----
// If they're an admin, show them how many errors we have in the log
if ($context['user']['is_admin'])
{
// Not set? Assume 0, then
if (!isset($context['error_log_count']))
$context['error_log_count'] = 0;
// No querystring set? Assume nothing
if (!isset($_SERVER['QUERY_STRING']))
$_SERVER['QUERY_STRING'] = '';

echo '
<br />', ($context['error_log_count'] == 1 ? $txt['error_log_thereis'] : $txt['error_log_thereare']), ' ', $context['error_log_count'], ' ', ($context['error_log_count'] == 1 ? $txt['error_log_error'] : $txt['error_log_errors']), ' ', $txt['error_log_inlog'], '<br />
', $txt['error_log_thispage'], ' <span id="error_count">0 ', $txt['error_log_errors'], ' ', $txt['error_log_were'], '</span> ', $txt['error_log_encountered'], ' (<a href="', $scripturl, '?show_debug=1;', $_SERVER['QUERY_STRING'], '">debug</a>)<br />';
}
// ---- End modification ----


Find:

echo '
<div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
</body></html>';


Replace with:

echo '
<div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>';

// Are we an admin, and do we have any errors?
if ($context['user']['is_admin'] && isset($context['error_count']) && $context['error_count'] != 0)
// Change the error text at the top of the page
echo '
<script type="text/javascript" language="JavaScript">
setInnerHTML(document.getElementById("error_count"), "', $context['error_count'], ' ', ($context['error_count'] == 1 ? $txt['error_log_error'] . ' ' . $txt['error_log_was']: $txt['error_log_errors'] . ' ' . $txt['error_log_were']), '");
</script>';

echo '
</body></html>';

RoarinRow

Very cool, cause I don't always go to my error log   8)

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

karlbenson

PERFECT!

Exactly what I need this very moment.

Working on complex mods, its annoying to have to keep switching to the error log to bug fix. Now I know on that page if there is an error.

A mod authors dream mod!  Thanks Daniel

Mick.

will regular members be able to see this as well?

karlbenson

I'm getting 2 little errors when i view the package manager.

No other mods installed at the time besides this. (1.1.1)


Warning: Invalid argument supplied for foreach() in /home/sdvsraw2/public_html/Sources/Subs.php on line 3369

Templates: 2: Admin (default), Packages (default).
Sub templates: 5: main_above, admin_above, browse, admin_below, main_below.
Language files: 2: Admin.english (default), Packages.english (default).
Files included: 9 - 429KB. (show./index.php, ./Settings.php, ./Sources/QueryString.php, ./Sources/Subs.php, ./Sources/Errors.php, ./Sources/Load.php, ./Sources/Security.php, ./Sources/Packages.php, ./Sources/Subs-Package.php)
Queries used: 7.

      INSERT INTO smf_log_errors
         (ID_MEMBER, logTime, ip, url, message, session)
      VALUES (1, 1169989074, SUBSTRING('81.151.238.97', 1, 16), SUBSTRING('?show_debug=1;action=packages', 1, 65534), SUBSTRING('2: Invalid argument supplied for foreach()<br />File: /home/sdvsraw2/public_html/Sources/Subs.php<br />Line: 3369', 1, 65534), '192e494df087b6c39b57ecb5b274d939')
   which took 0.0004909 seconds

edi67

excellent installed pefectly work on 1.1.1

BlueDevil : Only Admin can view error log ;)
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Mick.

Quote from: edi67 on January 28, 2007, 08:19:16 AM
excellent installed pefectly work on 1.1.1

BlueDevil : Only Admin can view error log ;)

Sweet! thanx edi67! Ill give this mod a try.

Mick.

I get this error:

4. Execute Modification ./Themes/default/index.template.php

This is a brand new test site using default theme.

edi67

Quote from: BlueDevil on January 28, 2007, 08:42:43 AM
I get this error:

4. Execute Modification ./Themes/default/index.template.php

This is a brand new test site using default theme.

this means you have something inside code in index.template.php that need to be modified, me too i  had something more and i added it inside mod file rar so worked ok.
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

L.G.S

Excellent, now I can see my 25,000 page a day error log clogging up with RSS Feed Poster errors..
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


PrizeLive.com

Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

RoarinRow

#11
Quote from: BlueDevil on January 28, 2007, 08:42:43 AM
I get this error:

4. Execute Modification ./Themes/default/index.template.php

This is a brand new test site using default theme.

I had the same error, but manually fixed it.  Somehow, it only took half of the code that it was supposed to modifiy on index.template.php.  The first half was there, but not the second half. 

Here's what it looks like on my custom theme.


SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

edi67

after i installed this mod ( work ok ) i had for 3 times TABLE CRASHED and always i must solve REPAIRING TABLE in DB

Table './crazyzonews/sessions' is marked as crashed and should be repaired

i dont know if is mod problem or server because by 3 years never i had this errors somebody have this errors?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Daniel15

Quote
will regular members be able to see this as well?
No, only admins :)

QuoteI'm getting 2 little errors when i view the package manager.
I'll look into this when I have more time ;)

QuoteI get this error:

4. Execute Modification ./Themes/default/index.template.php

This is a brand new test site using default theme.
What SMF version are you using? I tested it on a fresh SMF 1.1.1 installation, but not any other versions.

Quoteafter i installed this mod ( work ok ) i had for 3 times TABLE CRASHED and always i must solve REPAIRING TABLE in DB
I don't think it would be this mod, as it doesn't touch the database at all.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

@ngel

Works great.

Only a little problem with Dilber MC Theme (by HarzeM).  The second lines (with debug) of the 2 new lines is overwrited by the Color Scheme. So I changed the BR with a | to have all on 1 line.

karlbenson

a fantastic addition to this mod would be adding a link with it to empty the error logs.
It gets annoying having to flick back into admin area to clear.

Daniel15

Quote from: karlbenson on February 14, 2007, 01:33:26 PM
a fantastic addition to this mod would be adding a link with it to empty the error logs.
It gets annoying having to flick back into admin area to clear.
But, you'd want to clear the logs after reading through them, not before... You don't want to delete the errors without reading them, do you? ;)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

karlbenson

Quote from: karlbenson on February 14, 2007, 01:33:26 PM
a fantastic addition to this mod would be adding a link with it to empty the error logs.
It gets annoying having to flick back into admin area to clear.

I mean adding a link so it looks like

There are 121 errors in the error log (empty)
On this page, 19 errors were encountered (debug)

(would be cool also if it returned you to the same page)

Adish - (F.L.A.M.E.R)

Well, I dont know exactly but it worked with 1.1.5

Just some questions:-
1. Is this only for admins or for all the users ?
2. Although i cleared the whole forum log and then went on the main page, it shows
"There are 0 errors in the error log
On this page, 1 error was encountered (debug)"
3. Also I clicked on debug it doesnt go to 0, it stays at 1.

Kindly tell me the solutions for the problems 2 and 3.

Thank you.

HR

#19
2.0? Everything seems fine save the initial SQL statement for index.php.. anybody want to offer a hand and convert it to play nice with 2.0?

I can explain this as simply as possible.. If I do it & implement I guarantee it.
If I do it and you implement it its a crap shoot.

Advertisement: