Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Closing specific categories in add sites

Quote Reply
Closing specific categories in add sites
Is there a way to limit users so when they are adding a link only a part of the categories will open in the category menu.
I want to limit the registration to specific categories in the system.
Quote Reply
Re: [nir] Closing specific categories in add sites In reply to
Hi,

Not sure if this is what you want?

I limited submissions by adding a new field to the Category table [ isSub (Yes|No) ] and then on the category template put this condition around your submission link <%if isSub eq "Yes"%> Submission link here <%endif%>

Then edit each category and change the field to Yes or No depending on whether you want to allow submissions there or not.

Hope this helps Smile

Cheers,
Shaun

Last edited by:

qango: Apr 18, 2007, 5:17 AM
Quote Reply
Re: [qango] Closing specific categories in add sites In reply to
Thanks Shaun :) This way does limit the user from getting to the add link page from the closed categories, but if the user gets to there through an approved category, he could still choose a closed category in the category menu.
Is there a way to delete these categories from the menu altogether?
Quote Reply
Re: [nir] Closing specific categories in add sites In reply to
Hi,

Erm, yes, just delete the category. I can't see the point of having a category with no links to it.

Even if you added sites to the category, no-one would see them as there wouldn't be a link to it from its parent category. Or ... am I missing the point? Smile

I think my original suggestion may be what you're looking for, you just might need to see it in action to understand how it would operate. Visit www.qango.com and try submitting to any of the top-level categories, then try others another level down, and so on. This should give you an idea of how it works in practice. Does this help at all?

Cheers,
Shaun

Last edited by:

qango: Apr 18, 2007, 9:15 AM
Quote Reply
Re: [nir] Closing specific categories in add sites In reply to
Hi,

You could filter them out in /admin/Links/Tools.pm.

How are you showing categories in include_form.html? Just with <%Category%> ?

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: [Andy] Closing specific categories in add sites In reply to
Hi,

Depending on how you are calling the category list, something like this should work:

/admin/Links/Tools.pm:

Code:
sub category_list {
# -------------------------------------------------------------------
# Return a list of all the categories.
#
my %ret;
my $cat = $DB->table('Category');
my @ids = $IN->param('CatLinks.CategoryID');
@ids = $IN->param('ID') unless @ids;
if ($CFG->{db_gen_category_list}) {
$cat->select_options('ORDER BY Full_Name');
my $sth = $cat->select( { isSub => 'Yes' } );
my @cats;
while (my $c = $sth->fetchrow_hashref) {
for (0 .. $#ids) {
if ($c->{ID} == $ids[$_]) {
$c->{selected} = 1;
splice @ids, $_, 1;
last;
}
}
push @cats, $c;
}
$ret{category_loop} = \@cats;
$ret{category_loop_selected} = 0;
}
else {
$ret{category_loop} = $cat->select({ ID => \@ids })->fetchall_hashref;
$ret{category_loop_selected} = 1;
}
return \%ret;
}

NB: This *WILL NOT* be upgrade compatible (i.e every upgrade you do, you will need to make this change to Tools.pm again).

Hope that helps.

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!