Gossamer Forum
Quote Reply
Possible bug in 2.1.2
I just found a problem in 2.1.2. If you try to add a link, and an error is found, you get an;

Unknown Tag: Category

error. It seems that <%Category%> is not being defined correctly.

Is anyone able to confirm this?

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] Possible bug in 2.1.2 In reply to
I've been trying to get this fixed up in /admin/Links/User/Add.pm, but am not having much success Frown I'm trying to work out where it should be defined.

Code:
# We are processing an add request.
if ($IN->param('add')) {
my $results = GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'user_add_link', \&add_link, {});
if (defined $results->{error}) {
print $IN->header();
$results->{error} .= "test";
$results->{Category} = _category_list();

print Links::SiteHTML::display ('add', $results);
}
else {
print $IN->header();
print Links::SiteHTML::display ('add_success', $results);
}
}

The part in red is the code I have added. I've alsotried modifying the _category_list() routine, so it looks like;

Code:
sub _category_list {
# -------------------------------------------------------------------
# Return a list of all the categories.
#
my $category;
if ($CFG->{db_gen_category_list}) {
my $db = $DB->table('Links');
my $html = $DB->html($db, $IN);
my @ids = $IN->param('CatLinks.CategoryID');
if ($#ids < 1) { $ids[0] = $IN->param('ID'); }
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 1);
}
else {
my $db = $DB->table('Category');
my $id = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
my $sth = $db->select ( { ID => $id }, ['Full_Name'] );
my ($name) = $sth->fetchrow_array();
if ($name) {
$category = "$name <input type=hidden name='CatLinks.CategoryID' value='$id'>";
}
else {
return;
}
}
return $category;
}

I'm not quite sure why this isn't working correctly, but its being a pain in the backside :( Any suggestions are much appreciated.

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] Possible bug in 2.1.2 In reply to
Hi Andy,

I don't think it's a bug. Can you see the following lines in the function add_link in file admin/Links/User/Add.pm?

Code:
my $category = _category_list();

......................


# Add the record.
my $id = $db->add ( $input );
$input->{ID} = $id;
if (! $id) {
my $error = "<ul><li>" . join ("<li>", $db->error) . "</ul>";
return { error => "<ul>$error</ul>", Category => $category };
}
It should return the category list in a hash if there is an error.

Virginia
Quote Reply
Re: [Virginia] Possible bug in 2.1.2 In reply to
Yeah, your correct. Upon looking into it further, I realised that my Recip_Link plugin was installed. This in turn was showing the add.html template if it found any errors. The problem was, that I had fogotten to add the <%Category%> tag into the hashref that is passed back Tongue

Thanks for the reply anyway.

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!