Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Deleting MyLinks Records?

Quote Reply
Deleting MyLinks Records?
Hi,

I was wondering which of the admin files I need to change (and what bits of them to change) so I can get Links SQL to delete a link from both the Links table and Mylinks table (or any other table for that matter!) when a link is removed from the database? Currently, after the link is removed from the Links table it remains in the Mylinks table.

Kind regards,
Amanda
Quote Reply
Re: [Evoken] Deleting MyLinks Records? In reply to
You would either need to hook into delete_link with a plugin or it would require changed in admin/Link.pm in sub _plg_delete()

You'd add:

$DB->table('MyLinks')->delete( { ID => $id } );
Quote Reply
Re: [Evoken] Deleting MyLinks Records? In reply to
You don't have to change anything in the admin files, if...

... Paul changes the table definition of the MyLinks table slightly. Namely, if he puts a foreign key on the LinkID field (and thus linking it to the ID field of the Links table), everything will be automatic. Everytime a link is deleted from the Links table, all entries in the MyLinks table belonging to that link are also deleted.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Deleting MyLinks Records? In reply to
Good point, I never thought about that.
Quote Reply
Re: [Paul] Deleting MyLinks Records? In reply to
Neither did I until a few weeks ago when I had a similar problem....

It really works.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Deleting MyLinks Records? In reply to
Good one Yogi... you have given me an idea too! Thanks.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [yogi] Deleting MyLinks Records? In reply to
Am I able to create a Foreign Key through phpMyAdmin or something that will link the ID from the links table to the LinkID on the mylinks table?

I don't know how to do it. Smile
Quote Reply
Re: [Paul] Deleting MyLinks Records? In reply to
Paul,

I can't figure it out. I've tried to add the code you suggested to the _plg_delete() sub, and also tried to create a foreign key, however all my attempts have failed.

I think the foreign key option would be better, however after trying to set it up by modifying the mylinks def file and putting in an alter table statement through phpMyAdmin - it still doesn't work. I'm not even sure if what I'm doing is correct.

Some advice would be great Blush.