CMS Made Simple Forums
https://forum.cmsmadesimple.org/

[fixed] 1.10 Beta API Docs: CMSModule::SetPreference() do
https://forum.cmsmadesimple.org/viewtopic.php?f=75&t=57310
Page 1 of 1

Author:  fredp [ Tue Oct 18, 2011 9:22 am ]
Post subject:  [fixed] 1.10 Beta API Docs: CMSModule::SetPreference() do

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":
\$1:
/**
 * 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.

Author:  Rolf [ Fri Oct 21, 2011 5:49 pm ]
Post subject:  Re: 1.10 Beta API Docs: CMSModule::SetPreference() doc error

Calguy fixed this

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/