[imp] When is prefs.php read?

rick at havokmon.com rick at havokmon.com
Mon Mar 24 20:23:41 PST 2003



I'm trying to implement some kind of user levels.  For example, a user level 2
would have access to Fetchmail, but user level 1 wouldn't.

The user levels already exist in a mysql database.  My issue is when do I
retrieve that number, and where do I do it from.

I'm thinking it might be best to add:

list($v_username, $v_domain) = split ('[@%]', $imp['user']);
$query = "SELECT pw_svclvl FROM $table_name WHERE pw_name = '$v_username' AND
pw_domain='$v_domain';
$result = mysql_query($query, $link) or die("Could not complete database query");
# make sure that we recieved some data from our query
$num_of_rows = mysql_num_rows ($result);
$row = mysql_fetch_row($result); //Get Data
// $row[0] holds pw_svclvl

at the top, and do something like this to each pref:

if ($row[0] > 1) {
  $prefGroups['fetchmail'] = array(
    'column' => _("Mail Management"),
    'label' => _("Fetch Mail"),
    'desc' => _("Customize accounts for fetching mail from other POP3/IMAP
accounts."),
    'members' => array('fetchmail_link', 'fetchmail_popup', 'fetchmail_menu'));
}

Now I think that would probably work, but I'm not sure.  It has the advantage of
not being something that's hard to keep track of as the framework is updated,
but I'm not sure if that's the best place for it.

Comments are appreciated ;)

Thanks

Rick



More information about the imp mailing list