News:

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

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

Okay, I need to work on a mod I made, so it will get approved.
Here is the section that needs to be redone:

<file name="$sourcedir/BoardIndex.php">
<operation>
<search position="before"><![CDATA[$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());]]></search>
<add><![CDATA[
elseif (!empty($modSettings['arrange_groupkeyorder']))
{
// Group Key Order
global $smcFunc, $scripturl;
$context['groupkeyorder'] = array();

$result = $smcFunc['db_query']('', '
SELECT online_color, group_name, id_group
FROM {db_prefix}membergroups',
array()
);
    while ($row = $smcFunc['db_fetch_assoc']($result))
    {
if (allowedTo('view_mlist'))
$link = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
else
$link = !empty($row['online_color']) ? '<span style="color: ' . $row['online_color'] . ';">'. $row['group_name'] . '</span>' : $row['group_name'];
$context['groupkeyorder'][] = array (
'id' => $row['id_group'],
'link' => $link,
);
}
    $smcFunc['db_free_result']($result);
$context['gko_group'] = explode(',', $modSettings['arrange_groupkeyorder'], 30);
foreach($context['gko_group'] AS $key => $dummy)
for ($i = 0; $i < count($context['groupkeyorder']); $i++)
if ($context['groupkeyorder'][$i]['id'] == $context['gko_group'][$key])
$context['membergroups'][] = $context['groupkeyorder'][$i]['link'];
}]]></add>
</operation>
</file>


I need to know how to get it to cache that query so that it doesn't run in every BoardIndex load.
Also, a different way to order the membergroups would be of help.

Right now, have to insert the membergroup ID's into the box in order want them, separated by commas except for the the last number. However, it is able to have added membergroups put into the box to be shown, and even ones removed from being displayed.

What I'd like, but would need help doing, would be to have the membergroups listed on a page, and checkboxes to select which to show. Then, maybe a drag and drop to arrange them, or something like that.

Now, if can rework this, would need to get the settings onto it's own page in admin section. That would be a must, if would have all that on it.

Hj Ahmad Rasyid Hj Ismail

Quote from: BurkeKnight on September 02, 2014, 11:01:42 PMNow, if can rework this, would need to get the settings onto it's own page in admin section. That would be a must, if would have all that on it.

I am not sure about others, but this last part would be easy. ;) Just create your own function for this and use hook to create your own mod settings page. Though this may not be perfect, here is what I did in Alternative Menu mod:


function AlternativeMenu_Admin(&$admin_areas)
{
global $txt;

// Load the AlternativeMenu language
loadLanguage('AlternativeMenu');

// Add our menu item
$admin_areas['config']['areas']['modsettings']['subsections']['alternativemenu'] = array($txt['AlternativeMenu'],);
}

function AlternativeMenu_Settings(&$subActions)
{
global $txt, $scripturl, $context, $modSettings, $settings;

// Load the AlternativeMenu language
loadLanguage('AlternativeMenu');

// Add AlternativeMenu Settings
$subActions['alternativemenu'] = 'AlternativeMenu';
}

function AlternativeMenu($return_config = false)
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;

$config_vars = array(
// Mod authors, feel free to modify this alternative menu but don't remove this statement and basic menu!!
array('check', 'alternativemenu'),
'',
array('check', 'altmenu_remove_help'),
array('check', 'altmenu_remove_search'),
array('check', 'altmenu_remove_profile'),
array('check', 'altmenu_remove_pm'),
array('check', 'altmenu_remove_calendar'),
array('check', 'altmenu_remove_mlist'),
array('check', 'altmenu_remove_register'),
'',
array('check', 'altmenu_replace_with_icon'),
);

// Make it even easier to add new settings.
call_integration_hook('integrate_alternative_menu_settings', array(&$config_vars));

if ($return_config)
return $config_vars;

$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=alternativemenu';
$context['settings_title'] = $txt['altmenu_description'];

// Saving?
if (isset($_GET['save']))
{
checkSession();

$save_vars = $config_vars;

// This line is to help mod authors do a search/add after if you want to add something here. Keyword: FOOT TAPPING SUCKS!
saveDBSettings($save_vars);

// This line is to help mod authors do a search/add after if you want to add something here. Keyword: I LOVE TEA!
redirectexit('action=admin;area=modsettings;sa=alternativemenu');
}

// This line is to help mod authors do a search/add after if you want to add something here. Keyword: RED INK IS FOR TEACHERS AND THOSE WHO LIKE PAIN!
prepareDBSettingContext($config_vars);
}


Burke ♞ Knight

Load.php edit for my mod, since it does the info center, where would I edit the file?
I can not find the info center group key in Load.php whereas it was easy to find the edit area for your mod.....lol

margarett

That's just an example on how to use the cache ;)
In your case it would still go to BoardIndex.php ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

Can I, um, add something interesting to this particular party?

If you're modifying the group key, the correct place to do this isn't BoardIndex.php. BoardIndex.php doesn't do the query itself, it calls cache_getMembergroupList() in Subs-Membergroups.php and for bonus points, one will notice the call from BoardIndex.php is already obtaining this via cache_quick_get... so you modify it there and you get it cached for free already.

So here's what I'd do. I'd take the bulk of that function which is:
global $scripturl, $smcFunc;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groupCache = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$groupCache[] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
$smcFunc['db_free_result']($request);


And I'd replace it with this:
global $scripturl, $smcFunc, $modSettings;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groups = array();
$allowedTo = allowedTo('view_mlist'); // cheaper!
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($allowedTo)
$groups[$row['id_group']] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
else
$groups[$row['id_group']] = !empty($row['online_color']) ? '<span style="color: ' . $row['online_color'] . ';">'. $row['group_name'] . '</span>' : $row['group_name'];
}
$smcFunc['db_free_result']($request);

// Now rebuild it in the form expected for caching.
$groupCache = array();
if (!empty($modSettings['arrange_groupkeyorder']))
{
$group_order = explode(',', $modSettings['arrange_groupkeyorder']);
foreach ($group_order as $the_group)
{
$the_group = (int) trim($the_group);
if (isset($groups[$the_group]))
$groupCache[] = $groups[$the_group];
}
}
else
$groupCache = array_values($groups);


This way: if there's no setting defined, use standard behaviour of alpha-ordering, otherwise use the list specified, and in the process this gets to sanitise the information provided and won't be throwing errors if values aren't defined or are invalid, since we all know users do weird things sometimes like putting spaces after commas...

Burke ♞ Knight

Okay, so I replaced the BoardIndex.php edit code in the modifications file with this code to edit Subs-Membergroups.php.

<file name="$sourcedir/Subs-Membergroups.php">
<operation>
<search position="replace"><![CDATA[ global $scripturl, $smcFunc;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groupCache = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$groupCache[] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
$smcFunc['db_free_result']($request);]]></search>
<add><![CDATA[ global $scripturl, $smcFunc, $modSettings;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groups = array();
$allowedTo = allowedTo('view_mlist'); // cheaper!
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($allowedTo)
$groups[$row['id_group']] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
else
$groups[$row['id_group']] = !empty($row['online_color']) ? '<span style="color: ' . $row['online_color'] . ';">'. $row['group_name'] . '</span>' : $row['group_name'];
}
$smcFunc['db_free_result']($request);

// Now rebuild it in the form expected for caching.
$groupCache = array();
if (!empty($modSettings['arrange_groupkeyorder']))
{
$group_order = explode(',', $modSettings['arrange_groupkeyorder']);
foreach ($group_order as $the_group)
{
$the_group = (int) trim($the_group);
if (isset($groups[$the_group]))
$groupCache[] = $groups[$the_group];
}
}
else
$groupCache = array_values($groups);]]></add>
</operation>
</file>

Burke ♞ Knight

Tried it out on a test site, and will not show the group key at all.
Nor will changes have effect if try to enable the default group key.

Arantor

I didn't test it :P

That would imply something weird with your $modSettings value though.

Burke ♞ Knight

They seem to look fine to me, but I could be missing something here.
Here is the modifications file:

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<name>Group Key Order and Style</name>
<id>BurkeKnight:Group_Key_Order</id>
<version>1.0</version>
<file name="$languagedir/Modifications.english.php"">
<operation>
<search position="end" />
<add><![CDATA[
$txt['arrange_groupkeyorder'] = '<strong>Membergroup legend display arrangement.</strong><br />To enable the display, disable the "Show group key on board index" from Admin -> Current Theme, under Theme Settings tab.<br /><span class="smalltext">(Must be separated by comma. i.e. 1,2,8,7,6,5,4)</span>';
$txt['gkstyle_start'] = 'Opening HTML code to be used before group name:<br />You may use any HTML code to adjust the looks of the group key.';
$txt['gkstyle_end'] = 'Closing HTML code to be used after group name:<br />Be sure to close the HTML tags in reversed order.';
]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.english-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['arrange_groupkeyorder'] = '<strong>Membergroup legend display arrangement.</strong><br />To enable the display, disable the "Show group key on board index" from Admin -> Current Theme, under Theme Settings tab.<br /><span class="smalltext">(Must be separated by comma. i.e. 1,2,8,7,6,5,4)</span>';
$txt['gkstyle_start'] = 'Opening HTML code to be used before group name:<br />You may use any HTML code to adjust the looks of the group key.';
$txt['gkstyle_end'] = 'Closing HTML code to be used after group name:<br />Be sure to close the HTML tags in reversed order.';
]]></add>
</operation>
</file>

<file name="$languagedir/Help.english.php">
<operation>
<search position="end" />
<add><![CDATA[
$helptxt['arrange_groupkeyorder'] = 'Arrange the display of your membergroups legend. Enter the group id number and must be separated by comma. No comma after the last number. (i.e. 1,2,8,7,6,5,4).
To enable the display, disable the "Show group key on board index" from Admin -> Current Theme, under Theme Settings tab.';
$helptxt['gkstyle_start'] = '<strong>Enter the opening HTML code you want to use for the group key.<br />You may use any HTML code to adjust the looks of the group key.<br />Be sure to close the HTML tags in reversed order.</strong>';
$helptxt['gkstyle_end'] = '<strong>Enter the closing HTML code for the group key.<br />You may use any HTML code to adjust the looks of the group key.<br />Be sure to close the HTML tags in reversed order.</strong>';
]]></add>
</operation>
</file>

<file name="$languagedir/Help.english-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$helptxt['arrange_groupkeyorder'] = 'Arrange the display of your membergroups legend. Enter the group id number and must be separated by comma. No comma after the last number. (i.e. 1,2,8,7,6,5,4).
To enable the display, disable the "Show group key on board index" from Admin -> Current Theme, under Theme Settings tab.';
$helptxt['gkstyle_start'] = '<strong>Enter the opening HTML code you want to use for the group key.<br />You may use any HTML code to adjust the looks of the group key.<br />Be sure to close the HTML tags in reversed order.</strong>';
$helptxt['gkstyle_end'] = '<strong>Enter the closing HTML code for the group key.<br />You may use any HTML code to adjust the looks of the group key.<br />Be sure to close the HTML tags in reversed order.</strong>';
]]></add>
</operation>
</file>


<file name="$sourcedir/ManageSettings.php">
<operation>
<search position="before"><![CDATA[// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!]]></search>
<add><![CDATA[
array('text', 'arrange_groupkeyorder'),
      array('text', 'gkstyle_start', '30'),
  array('text', 'gkstyle_end', '30'),

'',
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Membergroups.php">
<operation>
<search position="replace"><![CDATA[ global $scripturl, $smcFunc;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groupCache = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$groupCache[] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
$smcFunc['db_free_result']($request);]]></search>
<add><![CDATA[ global $scripturl, $smcFunc, $modSettings;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE min_posts = {int:min_posts}
AND hidden = {int:not_hidden}
AND id_group != {int:mod_group}
AND online_color != {string:blank_string}
ORDER BY group_name',
array(
'min_posts' => -1,
'not_hidden' => 0,
'mod_group' => 3,
'blank_string' => '',
)
);
$groups = array();
$allowedTo = allowedTo('view_mlist'); // cheaper!
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($allowedTo)
$groups[$row['id_group']] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
else
$groups[$row['id_group']] = !empty($row['online_color']) ? '<span style="color: ' . $row['online_color'] . ';">'. $row['group_name'] . '</span>' : $row['group_name'];
}
$smcFunc['db_free_result']($request);

// Now rebuild it in the form expected for caching.
$groupCache = array();
if (!empty($modSettings['arrange_groupkeyorder']))
{
$group_order = explode(',', $modSettings['arrange_groupkeyorder']);
foreach ($group_order as $the_group)
{
$the_group = (int) trim($the_group);
if (isset($groups[$the_group]))
$groupCache[] = $groups[$the_group];
}
}
else
$groupCache = array_values($groups);]]></add>
</operation>
</file>

<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>

</modification>


And the database file:

groupkeyorderdb2.php

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!
defined('SMF'))
die('<b>Error:</b> Cannot update database.');

if(!
array_key_exists('db_insert'$smcFunc))
db_extend('packages');

$smcFunc['db_insert']('ignore''{db_prefix}settings',
array ('variable' => 'string''value' => 'string'),
array ('arrange_groupkeyorder''1,2,8,7,6,5,4'),
array()
);

?>

Arantor

Remember: it's *cached*, that means it doesn't apply it live!

Also, there's really no need to have half of what your installation file does. This is all you actually need in your case:

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!
defined('SMF'))
die('<b>Error:</b> Cannot update database.');

if (empty(
$modSettings['arrange_groupkeyorder']))
updateSettings(array('arrange_groupkeyorder' => '1,2,8,7,6,5,4'));
?>


Also, I didn't initially realise you wanted to allow post count groups on the list, which changes things slightly as these are ignored by default. Oh and since you wanted to show groups without a colour attached, needed to adjust that as well since again they're ignored. The only restrictions left are hidden groups and the board moderator group which are very special and cannot be linked to anyway.

Try this. This *has* been tested. ;)

global $scripturl, $smcFunc, $modSettings;

$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups
WHERE hidden = {int:not_hidden}
AND id_group != {int:mod_group}
ORDER BY group_name',
array(
'not_hidden' => 0,
'mod_group' => 3,
)
);
$groups = array();
$allowedTo = allowedTo('view_mlist'); // cheaper!
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($allowedTo)
$groups[$row['id_group']] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>';
else
$groups[$row['id_group']] = !empty($row['online_color']) ? '<span style="color: ' . $row['online_color'] . ';">'. $row['group_name'] . '</span>' : $row['group_name'];
}
$smcFunc['db_free_result']($request);

// Now rebuild it in the form expected for caching.
$groupCache = array();
if (!empty($modSettings['arrange_groupkeyorder']))
{
$group_order = explode(',', $modSettings['arrange_groupkeyorder']);
foreach ($group_order as $the_group)
{
$the_group = (int) trim($the_group);
if (isset($groups[$the_group]))
$groupCache[] = $groups[$the_group];
}
}
else
$groupCache = array_values($groups);

Burke ♞ Knight

Okay, working now, with the default enabling of the key, which I really had wanted anyway, instead of disabling it. :)

Thank you, Arantor, my friend. :)

Now, one more thing the Cust team mentioned:

QuoteAbout the Group Style, you should process the user input in Modification Settings:
* Make sure they don't use wrong tags, which can break the page --> </html> or </body>
* Make sure the opened tags are closed and in the respective order. (this, being highly recommended, isn't required)

How would I do these?

Arantor

I have no idea what they are referring to. I have seen no such code referenced here.

Burke ♞ Knight

It's the style part, I had shortened the txt strings, as they seemed to have flooded the error log when they were longer.

', $modSettings['gkstyle_start'], '
and
', $modSettings['gkstyle_end'], '

Used to be: group_key_style_1 and group_key_style_2

<file name="$sourcedir/ManageSettings.php">
<operation>
<search position="before"><![CDATA[// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!]]></search>
<add><![CDATA[
array('text', 'arrange_groupkeyorder'),
      array('text', 'gkstyle_start', '30'),
  array('text', 'gkstyle_end', '30'),

'',
]]></add>
</operation>
</file>

Arantor

I don't get what you're doing with these settings...

Burke ♞ Knight

The mod will also let you change the style for group key in board index.
Has 2 slots, one for HTML code placed before the key, and one for HTML code placed after the key.

You may use any HTML code to adjust the looks of the group key.

Be sure to close the HTML tags in reversed order.
Example: In Start Box: <strong><em>
In End Box: </em></strong>

I also would like to get the above example into the text string for the settings, but not sure how to get it to display the html code instead of use it.

Arantor

OK, so ultimately this is about ensuring what tags are used by the people who use that, and ensuring what tags they are allowed to use. Using </html> or similar in those boxes would be bad.

The only problem with that is that it's an extremely difficult thing to do properly, unless you strip it down to a truly tiny list of safe tags.

What I would suggest is that before saving the relevant things, you'd push them through strip_tags. Specifically, if $string contains the relevant option, strip_tags($string, '<div><span><strong><em>');

This will allow div, span, strong and em and remove all other tags.

The item about ensuring order, that's really hard to do well.

Burke ♞ Knight

Okay, where exactly would I place this?

strip_tags($string, '<style><span><strong><em>');

<div> tags make unexpected extra line break after, so that would be one I'd want not to be allowed, but style, span, strong, and em should all be okay.

EDIT:

Also, I would like to get the above example into the text string for the settings, but not sure how to get it to display the html code instead of use it. It is in the readme, but I'd like it also on the settings page, if can.

Arantor

You can't use <style> in line in a page. Not allowed.

As for where you would use it, you would use it during the save routine. $string is more a placeholder for descriptive purposes. In your case, I'd assume use of $_POST['gkstyle_start'] and $_POST['gkstyle_end'] instead before the saveDbSettings() call.

Displaying it on the mod's page is very complicated, lots of permutations, most of which depend on how much text you want to write.

Burke ♞ Knight

Okay, the part where the style is done, is just in BoardIndex.template.php

<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>


However, we do have the php file for the db: groupkeyorderdb2.php

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!
defined('SMF'))
die('<b>Error:</b> Cannot update database.');

if (empty(
$modSettings['arrange_groupkeyorder']))
updateSettings(array('arrange_groupkeyorder' => '1,2,8,7,6,5,4'));
?>


As for the text string for settings page, if I could have it display the tags that are allowed, I can make it fit. Here is what is there now:

$txt['gkstyle_start'] = 'Opening HTML code to be used before group name:<br />You may use any HTML code to adjust the looks of the group key.';
$txt['gkstyle_end'] = 'Closing HTML code to be used after group name:<br />Be sure to close the HTML tags in reversed order.';


If can display the tags, then would not need this line after the line break in the start one:
You may use any HTML code to adjust the looks of the group key.

It could be replaced by the tags allowed.

Advertisement: