| Author |
Message |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 383
|
Posted:
Thu Apr 12, 2012 9:47 am |
|
NOT a bug per se.
I'm using a stripped down version of RN (no forums, PM, Weblinks, Downloads, Reviews or Member_List modules).
I have also removed the DB tables for the above, which causes the Newslitter module to generate an error when it looks for my now, none existent _bbconfig table
I have made a quick workaround by wrapping the look-up in an if(is_active($module)) check
modules/HTML_Newsletter/admin/functions.php
| Code: |
// Get phpBB configuration information to assist with date/time conversions
if(is_active('Forums')){
$msnl_asPHPBBCfg = array();
$sql = 'SELECT `config_name`, `config_value` FROM `' . $prefix . '_bbconfig`';
$result = msnl_fSQLCall($sql);
if (!$result) { // Bad SQL call
msnl_fRaiseAppError(_MSNL_COM_ERR_DBGETPHPBB);
} else {
while ($row = $db->sql_fetchrow($result)) {
$msnl_asPHPBBCfg[$row['config_name']] = $row['config_value'];
}
}
} |
|
| |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 383
|
Posted:
Thu Apr 12, 2012 10:01 am |
|
I also did the same in the modules admin/admin.php for the section "Display options list for Site Sponsors in file" by wrapping the whole DIV output (- I'm not using Advertising). |
| |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 383
|
Posted:
Thu Apr 12, 2012 10:20 am |
|
In an ideal world, I would probably run a series of if(is)active()) checks up front on each of the modules that the HTML Newsletter grads (optional) data from and if the check return true, set a global switch for each of the modules.
Unfortunately, I don't have the time (running behind schedule) to do that and document it so I'm going to take the (overhead) expensive route and do the checks as and when needed - it's on the admin side any way, so overhead isn't too much of an issue.
For the form inputs, I'm simply going to wrap each of the option rows in an IF / ELSE so if the module isn't active, it will use an input type of hidden with the default '0' value like this
| Code: |
/*
* Latest Downloads
*/
if(is_active('Downloads')) {
echo '<tr ' . $msnl_asCSS['TR_top'] . '>'
. '<td ' . $msnl_asCSS['TD_hdr_adm'] . '>'
. msnl_fShowHelp(_MSNL_ADM_HLP_INCLLATESTDLS, _MSNL_ADM_LAB_INCLLATESTDLS)
. _MSNL_ADM_LAB_INCLLATESTDLS
. ': '
. '</td>'
. '<td>'
. '<input type="text" name="msnl_downloads" size="2" '
. 'maxlength="2" value="' . $_POST['msnl_downloads'] . '" />' . ""
. '</td></tr>';
} else {
echo '<input type="hidden" name="msnl_downloads" value="0" disabled />';
}
|
|
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1294
|
Posted:
Fri Apr 13, 2012 11:32 am |
|
Guardian,
I'll add this as an enhancement request. Given that RN is trying to move in the direction of removing dependencies between modules, this could be done better. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 383
|
Posted:
Fri Apr 13, 2012 12:39 pm |
|
No problem.
I actually went back and changed my approach. I used if(is_active('ModuleName')) to set a multi-dimensional array, which is available in the global scope so I could do;
if($live['ModuleName']['1'])
It isn't perfect but it was a quick workaround that fitted my needs at the time and avoided the need to repeatedly call is_active, which meant another DB query each time.
It was actually nice to work with the Newlsetter templates as I hadn't had the need to since the first version came out and I found them extremely easy to customise - nice job!! |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1294
|
Posted:
Sat Apr 14, 2012 10:19 am |
|
| Guardian wrote: |
| It was actually nice to work with the Newlsetter templates as I hadn't had the need to since the first version came out and I found them extremely easy to customise - nice job!! |
Well, thank you for the Kudos, but I'll give them over to Mangaman who came up with the original approach which is pretty much still 100% in use today. He did a fine job. |
| |
|
|
 |
|
|