Re: How do I set up forced_prefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi there,
>
> I truly did some research in the files included in the archive and on the
> web, but the only relevant info was here, at squirrelmail-users, in a post
>  from Tomas Kuliavas on 19 Oct 06 in thread "forced preferences usage".
>
> I am still not sure how to use the plugin. My easiest idea would be some
> sort of "administrator login" to SquirrelMail, where I have all the
> option pages that a normal user has, but in difference to that I'll set
> defaults there.
>
> Though as I understand, forced_prefs plugin has to be configured by
> editing config.php. The sample contains just options for time settings,
> how do I set all other settings?
> That is my prior question. By reading Tomas' post, even more questions
> arose:
>
>> Forced prefs plugin is most useful with option widgets. Widgets are
>> standard SquirrelMail 1.2.0+ options. Admin sets options in
>
> Where are the widgets and how do I use them for what?

SquirrelMail plugins can use different methods to add options to option
page. Forced Prefs plugin can always add settings, but it has to use
different ways to control display of these options to end user.


* 1st method. optpage_loadhook_* hooks
Plugin sets information about used preferences. SquirrelMail displays them
with standard option generation code. Code uses SquirrelMail Option class
functions. Plugins don't care about display of their options to end user.
This is what I call widgets.

Forced Prefs plugin can control display of these options to end user. If
option is listed in $fp_forced_settings, it will be hidden from end user.
Controls are simple. If you want to add setting, you set it in
$fp_added_settings. If you want to set default value and hide setting from
end user, set it in $fp_forced_settings.


* 2nd method. options_*_inside hooks
Plugin creates html code with appropriate form fields. Forced prefs plugin
don't control html output of other plugins. You can only disable plugin
hooks with $fp_disabled_hooks option. name of hook function can be found
by checking plugins setup.php file. For example

plugins/fortune/setup.php
...
function squirrelmail_plugin_init_fortune() {
...
$squirrelmail_plugin_hooks['options_display_inside']['fortune'] =
'fortune_options';
...

'fortune_options' is hooked function. It can be added to
$fp_disabled_hooks array.

$fp_disabled_hooks = array('fortune_options','abook_take_options');


* 3rd method. optpage_register_block hook
Plugin sets information about own option block. If it is not
advanced_settings plugin, forced_prefs plugin can't control settings
displayed to end user. You can only remove option block with
$fp_disabled_hooks or $fp_removed_optpage_urls settings.


4th method. options_link_and_description hook
Plugin creates html box with option block. forced_prefs plugin can't
control settings displayed to end user. You can only remove option block
with $fp_disabled_hooks.



If you want to add settings, use $fp_added_settings and don't worry about
other things. If you want to enforce settings, use $fp_forced_settings and
start worrying only when settings in $fp_forced_settings are not hidden
from end user.

>> $fp_added_settings or fp_forced_settings and settings are applied to end
>> user preferences. Both arrays use option names from .pref files for
>> array keys and .pref values for key values.
>
> Are the $..... things some sort of variables that I can set somewhere?
> Sorry, I don't understand that.

http://www.squirrelmail.org/docs/admin/admin-5.html#ss5.5

default_pref and .pref files store lines in 'option_name=option_value'
format.

Same settings can be converted to forced prefs format.

If you have
---
hour_format=1
show_num=20
option_name=option_value
---

It can be added to forced_prefs in forced_prefs plugin configuration as
---
$fp_added_settings = array(
   'hour_format'   => '1',
   'show_num'      => '20',
   'option_name'   => 'option_value'
);
---
or
---
$fp_added_settings['hour_format'] = '1';
$fp_added_settings['show_num'] = '20';
$fp_added_settings['option_name'] = 'option_value';
---


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives:  http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux