Page 1 of 1

[fixed] 1.10 Beta API Docs: CMSModule::SetPreference() do

Posted: Tue Oct 18, 2011 9:22 am
by fredp
There is an error in the 1.10 API docs. The CMSModule::SetPreference() method is documented as returnsing a boolean value:
boolean SetPreference (string $preference_name, string $value)

But, in looking at the code, it seems that the return value will always be NULL since the cms_siteprefs::set() method used to implement it has no return statement and is documented as returning "void":

Code: Select all

/**
 * Sets the given site perference with the given value.
 *
 * @since 0.6
 * @param string The preference name
 * @param mixed  The preference value (will be stored as a string)
 * @return void
 */
function set_site_preference($prefname, $value)
{
  return cms_siteprefs::set($prefname,$value);
}
See: cms_siteprefs::set()

While it would be nice if there were a useful boolean value returned from CMSModule::SetPreference(), if that isn't possible at this point in the 1.10 release cycle, then the docs should at least be updated to note the problem and/or reflect reality.

Re: 1.10 Beta API Docs: CMSModule::SetPreference() doc error

Posted: Fri Oct 21, 2011 5:49 pm
by Rolf
Calguy fixed this