1 edb Jan 16, 2008 02:02
3 edb Jan 16, 2008 15:24
Hooray! The plugin always used 2 lines due to the length of the longest license available. The "add me" button was the only thing on the second line :roll: So I'll put the dropdown for national jurisdiction there and include defaultusersettings for both license and nation.
This is fun!
4 edb Jan 16, 2008 16:04
Question just in case someone who knows comes along before I figure it out: When I set a default value in "GetDefaultSettings" is that what will automagically become the default value for "GetDefaultUserSettings"?
Also how would I code this in order to get the User's Settings?
echo '<option value="2.5-ch"';
if ( $this->Settings->get('cc_license_nation') == '2.5-ch' ) {
echo ' selected';
}
echo '>Switzerland</option>';
Or will that also automagically grab DefaultUserSettings, which possibly might still be DefaultSettings?
5 yabba Jan 16, 2008 17:25
As long as you tell the GetDefaultUserSettings to use the GetDefaultSettings as the default :
/**
* Allowing the user to override the default settings
*
* @return array
*/
function GetDefaultUserSettings()
{
$r = array(
'cc_license_nation' => array(
'label' => T_( 'Nation' ),
'defaultvalue' => $this->Settings->get( 'cc_license_nation' ),
'type' => 'text',
'note' => T_( 'This is the users setting for nation. It overrides the plugin setting.' ),
)
);
return $r;
}
Then you just change your $this->Settings->get to $this->UserSettings->get( 'cc_license_nation' ) wherever you want to use them :
echo '<option value="2.5-ch"';
if ( $this->UserSettings->get('cc_license_nation') == '2.5-ch' ) {
echo ' selected';
}
echo '>Switzerland</option>';
¥
6 edb Jan 16, 2008 18:13
Cool - thanks!
I blew up everything again, so I'm echoing and print_ring like crazy to find what I buggered up. Close though. Real close ... to a version that will be workable but will NOT support older existing licenses. I'm keeping placeholders for building that in though because it's important to me to make it happen.
BTW the problem with CCLs is that they used to say "okay for a different language we will add "deed.nn/" (where nn is the language) to the end of a license and translate it". NOW they say "each country that has ported CCLs has a unique license that aligns with local laws and the URLs will have "/ver/nn" in it, where ver is the ported version and nn is the country code".
They then offer translations of that localized license. For example http://creativecommons.org/licenses/by/3.0/rs/ A better example is to compare two ported licenses that are both in English: http://creativecommons.org/licenses/by/2.0/uk/ versus http://creativecommons.org/licenses/by/3.0/us/ illustrates why basing the code on both version and language doesn't work anymore.
Lotsa fun! :D
Yeah and thanks again!!!
As well as settings plugins also have user settings :
¥