News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Undefined index error

Started by BGH, April 27, 2012, 05:27:52 PM

Previous topic - Next topic

BGH

Hello,

I've been currently fixing some errors from the forum I'm working, and I've only got this error left that I'd like to fix:


http://***/index.php?action=admin;area=securitysettings;save;sa=general
Apply Filter: Only show the errors with the same message
8: Undefined index: daily_posts_num
Apply Filter: Only show the errors from this file
File: C:/***/Themes/default/languages/Modifications.english.php
Line: 49


It belongs to the mod Number of daily posts to send pm. This is what I have on my Modifications.english.php file, related to this mod:


$txt['daily_posts_on'] = 'Enable Add On?';
$txt['daily_posts_num'] = 'Daily Post Number to Send Pm';
$txt['permissionname_bypass_num_restriction'] = 'Bypass daily posts to send PM restriction';
$txt['permissionhelp_bypass_num_restriction'] = 'This permission determines whether or not members of this group can bypass the daily posts to send  pm restriction.';
$txt['daily_posts_message'] = 'Hello '.$context['user']['name'].'. To send a personal message you must make a minimum of '.$modSettings['daily_posts_num'].' posts per day.';
$txt['dailyposts'] = 'Daily Posts to Send Pm';
$txt['dailyposts_settings'] = 'Daily Posts to Send Pm';


I asked about this error in the mod topic, but get no answer so far, since the mod author seems inactive these days, so that's why I'm seeking for help here.

Could anyone help me to solve this error, please?

Thanks in advance!

NanoSector

Try replacing this:
$txt['daily_posts_message'] = 'Hello '.$context['user']['name'].'. To send a personal message you must make a minimum of '.$modSettings['daily_posts_num'].' posts per day.';

with this:

$txt['daily_posts_message'] = 'Hello '.$context['user']['name'].'. To send a personal message you must make a minimum of '.isset($modSettings['daily_posts_num']) ? $modSettings['daily_posts_num'] : '' .' posts per day.';

Lemme know if that works.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

BGH

Thank you for your help Yoshi! But the fix didn't work, as the error is still there, I'm afraid :-\...

NanoSector

Hmm, you are sure you didn't stare at the old error?

Try clearing your error log first, so you are sure of that.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

BGH

I already did clear my error log first, but the error seems to remain the same.

Joker™

Yoshi you were giving almost there. Just missed !empty

BGH try this,


Modification.english.php (Make backup of file before editing it)

Code (Find:) Select
$txt['daily_posts_message'] = 'Hello '.$context['user']['name'].'. To send a personal message you must make a minimum of '.$modSettings['daily_posts_num'].' posts per day.';


Code (Replace it with:) Select
$txt['daily_posts_message'] = 'Hello '.$context['user']['name'].'. To send a personal message you must make a minimum of '.isset($modSettings['daily_posts_num']) && !empty($modSettings['daily_posts_num']) ? $modSettings['daily_posts_num'] : '' .' posts per day.';

If this fix works for you, please notify mod author also via mod support topic. It might be helpful for others too.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

BGH

Thanks Joker™, your solution worked very well, the error log seems clean now.

Marked solved and I'll contact the mod author, and provide her the solution you gave me.

Thank you again :)

Advertisement: