Gossamer Forum
Home : Products : DBMan : Customization :

List All on log in except Admin

Quote Reply
List All on log in except Admin
I would like to have all members go to list all on login except for Admin. I found the following code from JPDeni, which works for a genral list all. Could anyone advise me as to what could be added to bring Admin to the main menu and all others to list all.

At the beginning of sub html_home, you could add

Code:

$in{$db_key} = "*";
&view_records;
return;

Quote Reply
Re: [techart] List All on log in except Admin In reply to
I change the sub "main" in db.cgi to manipulate my logins. Example, look for this line(s):

Code:
elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_add_form; }

Notice how I've changed the sub that is being called to "&html_add_form;" ? This takes my users to the add screen directly after logging in. You could try something like:

Code:
($in{'login'})) { if ($per_admin) { &html_home; } else { &html_view_search; } }

You'll have to play around with it to get it to work exactly like you want.

There's another option I frequently use if the above bit doesn't work for you.

Under the sub html_home (in default.html) add the meta tag just before the </head> tag

Code:
|; if (!($per_admin)) {
print qq|<META HTTP-EQUIV = REFRESH CONTENT = "1; URL=$db_script_link_url&view_search=1&ID=*">|;}
print qq| </HEAD>

Assuming ID is your dbkey.

This will automatically forward anyone who isn't Admin to View All. Change REFRESH CONTENT = "1 to any number you want for more delay. Pay close attention to the quote marks " (notice where they start and stop.)

Good Luck!