Gossamer Forum
Home : Products : Gossamer Links : Discussions :

exclude categories for adding links

Quote Reply
exclude categories for adding links
I have many categories, subcategories and sub-subcategories.
How do I prevent users from adding links to certain categories ? These categories should not appear in the drop-down-field when a user selects a category in the "add.html"-template.



Many thanks for help !

Erich
Quote Reply
Re: [erichcyber] exclude categories for adding links In reply to
Your best bet would be;

1) Create a new field in the lsql_Category table (something like: CanAdd)
2) Make a new global, which only add's category entries if they have CanAdd => Yes.

That it.

Its a little early in the morning for me to be coding at the moment.. so I'm not even gonna attempt to come up with an example :(may do later... but I can't guarantee anything).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [erichcyber] exclude categories for adding links In reply to
use this global

1. place this in include form <EXCLUDE_CAT%>
2. CREATE COLUMN IN CATEGORY TABLE 'isHidden'(yes/no)


sub {
my $catid = shift;
my $table = $DB->table('Category');
my $return_cats;
$table->select_options ('ORDER BY Full_Name ASC');
my $cond = GT::SQL::Condition->new('isHidden','=','No');
my $sth = $table->select( $cond );
my $return_cats = qq|<select name="$catid">|;
while (my $hit = $sth->fetchrow_hashref) {
$return_cats .= "<option value=\"" . $hit->{ID} . "\"";
if ($catid == $hit->{ID}) { $return_cats .= "selected=\"selected\""; }
$return_cats .= ">" . $hit->{Full_Name} . "</option>";
}
$return_cats .= '</select>';
return $return_cats;
}