now you can add your own plugins to the usermanager

i have user hook's for this

hook 1:
show_user_data
creates html code which gets added to the editaccount.php pages

hook2:
show_newuser_data
creates html code which gets added to the newaccount.php pages

hook3:
update_user_data
get's called after we have put the new userdata in the database

Enjoy
This commit is contained in:
Lars Kneschke 2000-12-31 16:20:49 +00:00
parent 594434dc47
commit f4a7860474
3 changed files with 58 additions and 24 deletions

View File

@ -93,31 +93,39 @@
// If the user is logged in, it will force a refresh of the session_info // If the user is logged in, it will force a refresh of the session_info
$phpgw->db->query("update phpgw_sessions set session_info='' where session_lid='$new_loginid@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); $phpgw->db->query("update phpgw_sessions set session_info='' where session_lid='$new_loginid@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__);
// The following sets any default preferences needed for new applications.. // The following sets any default preferences needed for new applications..
// This is smart enough to know if previous preferences were selected, use them. // This is smart enough to know if previous preferences were selected, use them.
if (count($new_apps)) { if (count($new_apps)) {
$pref = new preferences($account_id); $pref = new preferences($account_id);
$t = $pref->get_preferences(); $t = $pref->get_preferences();
$docommit = False; $docommit = False;
for ($j=0;$j<count($new_apps);$j++) {
if($new_apps[$j]=="admin") for ($j=0;$j<count($new_apps);$j++) {
$check = "common"; if($new_apps[$j]=="admin")
else $check = "common";
$check = $new_apps[$j]; else
if (!count($t["$check"])) { $check = $new_apps[$j];
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
$docommit = True; if (!count($t["$check"])) {
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
$docommit = True;
}
} }
} if ($docommit) {
if ($docommit) { $pref->commit();
$pref->commit(); }
} }
}
// start inlcuding other admin tools
while(list($key,$value) = each($phpgw_info["user"]["app_perms"]))
{
$phpgw->common->hook_single("update_user_data", $value);
}
Header("Location: " . $phpgw->link("accounts.php", "cd=$cd")); Header("Location: " . $phpgw->link("accounts.php", "cd=$cd"));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
} // if $submit } // if $submit
@ -231,8 +239,16 @@
$i++; $i++;
} }
$phpgw->template->set_var("permissions_list",$perm_html); $phpgw->template->set_var("permissions_list",$perm_html);
// start inlcuding other admin tools
while(list($key,$value) = each($phpgw_info["user"]["app_perms"]))
{
// check if we have something included, when not ne need to set
// {gui_hooks} to ""
if ($phpgw->common->hook_single("show_user_data", $value)) $includedSomething="true";
}
if (!$includedSomething) $phpgw->template->set_var("gui_hooks","");
$phpgw->template->set_var("lang_button",lang("Save")); $phpgw->template->set_var("lang_button",lang("Save"));
$phpgw->template->pparse("out","form"); $phpgw->template->pparse("out","form");

View File

@ -73,6 +73,13 @@
$phpgw->common->hook_single("add_def_pref", $apps[$i]); $phpgw->common->hook_single("add_def_pref", $apps[$i]);
} }
$pref->commit(); $pref->commit();
// start inlcuding other admin tools
while(list($key,$value) = each($phpgw_info["user"]["app_perms"]))
{
$phpgw->common->hook_single("update_user_data", $value);
}
Header("Location: " . $phpgw->link("accounts.php","cd=$cd")); Header("Location: " . $phpgw->link("accounts.php","cd=$cd"));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
@ -170,6 +177,15 @@
} }
$phpgw->template->set_var("permissions_list",$perms_html); $phpgw->template->set_var("permissions_list",$perms_html);
// start inlcuding other admin tools
while(list($key,$value) = each($phpgw_info["user"]["app_perms"]))
{
// check if we have something included, when not ne need to set
// {gui_hooks} to ""
if ($phpgw->common->hook_single("show_newuser_data", $value)) $includedSomething="true";
}
if (!$includedSomething) $phpgw->template->set_var("gui_hooks","");
$phpgw->template->set_var("lang_button",Lang("Add")); $phpgw->template->set_var("lang_button",Lang("Add"));
$phpgw->template->pparse("out","form"); $phpgw->template->pparse("out","form");

View File

@ -38,6 +38,8 @@
</tr> </tr>
{permissions_list} {permissions_list}
{gui_hooks}
<tr bgcolor="{tr_color2}"> <tr bgcolor="{tr_color2}">
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td> <td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>