Jamroom Developers: Small change coming in Jamroom 4.0.1 to module quota config
Brian Jamroom Team
Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA
Posted: 01/18/09 10:05
I wanted to let everyone know about a small change to the API for Jamroom 4.0.1 that is needed to overcome a Quota config issue.
Currently, if your module defines a quota.php script for Quota config options, within your script you will have a "_config" function such as this (from the sample jrYouTube module):
Code
/**
* The _config function is used to display the Config options for the given quota.
* @param array Full quota information for the quota being modified
* @return bool Returns true
*/
function jrYouTube_quota_config($quota)
{
// Allow jrYouTube to be turned on/off per Artist quota
if (isset($quota['quota_type']) && $quota['quota_type'] == 'artist') {
jmSpanCell('YouTube Videos','Quota Settings for the YouTube Videos Module');
jmYesNo('YouTube Video Access','quota_jryoutube_access','If this is set to "yes", then profiles in this quota will be allowed to create embedded YouTube videos.',$quota['quota_jryoutube_access']);
}
return(true);
}
Note how the function simply returns "true" to let Jamroom know it is done. However, the way this currently works is causing a problem in that it does not allow Jamroom to "know" if any options were displayed (in this case it is only displayed if the quota is an Artist quota). So in Jamroom 4.0.1 (and going forward), it will need to be changed to:
Code
/**
* The _config function is used to display the Config options for the given quota.
* @param array Full quota information for the quota being modified
* @return bool Returns true
*/
function jrYouTube_quota_config($quota)
{
// Allow jrYouTube to be turned on/off per Artist quota
if (isset($quota['quota_type']) && $quota['quota_type'] == 'artist') {
jmSpanCell('YouTube Videos','Quota Settings for the YouTube Videos Module');
jmYesNo('YouTube Video Access','quota_jryoutube_access','If this is set to "yes", then profiles in this quota will be allowed to create embedded YouTube videos.',$quota['quota_jryoutube_access']);
return(true);
}
return(false);
}
As you can see, the function now returns FALSE if nothing was displayed. This allows Jamroom to do proper form field error checking, and "know" which modules actually displayed settings on the quota tab.