Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 397

PostPosted: Thu Apr 12, 2012 9:47 am Reply with quote

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'];
   }
}
}
 
View user's profile Send private message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 397

PostPosted: Thu Apr 12, 2012 10:01 am Reply with quote

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).
 
View user's profile Send private message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 397

PostPosted: Thu Apr 12, 2012 10:20 am Reply with quote

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 />';
}
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Fri Apr 13, 2012 11:32 am Reply with quote

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 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 397

PostPosted: Fri Apr 13, 2012 12:39 pm Reply with quote

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!!
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Apr 14, 2012 10:19 am Reply with quote

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.
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunchlinear-bunch