Gossamer Forum
Home : Products : Links 2.0 : Customization :

links 2.0 text file version - disallow add resource form top level category

Quote Reply
links 2.0 text file version - disallow add resource form top level category
i'm not sure this is where to post for this version of the software, but i couldn't find a forum title specifically for the version i have.

anyway, i want to force users (or at least give them a warning) to navigate to the deepest category for their resource before adding it.
i only have two levels so another option would be to check the category and if there is no '/' (indicating that it's a sub-category), then redirect to error page of some sort.

i appreciate any help offered - and if this isn't the correct place for this post - please give me an url to the appropriate locaiton.

thanks
Quote Reply
Re: [ibjdt] links 2.0 text file version - disallow add resource form top level category In reply to
Been a while since I used Links2, but in add.cgi try finding:

Code:
# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}


..and adding this below it:

Code:
my @tmp_category = split /\//, $in{Category};
my $num_levels = $#tmp_category;
if ($num_levels == 0) {
&site_html_add_failure ("Please select a category at least 2 levels deep");
return;
}

Totally untested - but something like that should work Smile

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!