News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Help needed on re-coding a mod

Started by Burke ♞ Knight, September 02, 2014, 11:01:42 PM

Previous topic - Next topic

Burke ♞ Knight

Indeed so. :)

I just did not think it was right to make own page for 3 settings, on this mod.
However, I do have plans on a mod that will need it's own settings page. :)

Arantor

If you want to see the callback in action, take a look at the anti spam page, where it uses one of those to make the anti-spam questions work ;) Note that using a callback will require you to do your own work in terms of validation and saving items.

Adding individual pages to the admin area via Modification Settings is fine. But the minute you start building entire areas, it gets real ugly, real fast :( I knew there was a reason I hadn't done it since SimpleDesk :P

Burke ♞ Knight

Okay, almost done here, but found an issue:

<file name="$themedir/BoardIndex.template.php">
<operation>
<search position="replace"><![CDATA[if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';]]></search>
<add><![CDATA[if (!empty($context['membergroups']))
echo '</p><p class="last smalltext">
', $modSettings['gkstyle_start'], '' . implode(',&nbsp;', $context['membergroups']) . '', $modSettings['gkstyle_end'], '';]]></add>
</operation>
</file>


As is, if the style boxes are left empty, we get errors:

Quote8: Undefined index: gkstyle_end
Themes/default/BoardIndex.template.php
Line: 442

I am guessing that SMF is balking at the fact the fields are empty, so I need to know what to do, to fix this.

Hj Ahmad Rasyid Hj Ismail

Have you defined this $modSettings['gkstyle_end']? If this is an empty field to be filled by the user, then you need to use condition that if it is not empty then display it, otherwise leave it empty. Something like !empty($modSettings['gkstyle_end']) ? $modSettings['gkstyle_end'] : ''

Advertisement: