Hi,
A year or so ago I implemented a change to the links plugin for my website so that a link (say to a new club) could also have a flag associated with it called "map" to indicate whether to place a pin on a Google map of the location of the club. And similarly variables for "lat" and "lon".
This was a pretty basic change as I was doing the old program by example in php and sql etc.
Really I just added new fields for map, lat and lon to the links table, and if I want to map a location associated with a new link, I manually edit the database. Ugly but it works and only a once a week type thing for a colleague who does it. I then have an Atlas page and some php there that reads the database to display pins at club locations.
http://www.worldfootynews.com/staticpages/index.php/Atlas
BUT, one of our guys wants to change the categories around which means editing all our links. He discovered (too late, he was already 100 links in out of probably 400) that every time he does that, those extra fields I added get re-initialised, i.e. they lose their info.
I don't know much about sql but that seems strange.
My thought was to get into admin/plugins/links/index.php and ensure the new variables are read in and saved out. To test, I'm just starting with the map variable, which is an integer 0 for off, 1 for on. So I've added map to these lines of code:
Text Formatted Code
DB_save ($_TABLES['links'], 'lid,cid,url,description,title,date,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,map', "'$lid','$cid','$url','$description','$title',NOW(),'$hits',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,'$map'");
and
Text Formatted Code
DB_save ($_TABLES['links'], 'lid,cid,url,description,title,date,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,map', "'$lid','$cid','$url','$description','$title',NOW(),'$hits',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,'$map'");
and
Text Formatted Code
$display .= savelink (COM_applyFilter ($_POST['lid']),
COM_applyFilter ($_POST['old_lid']),
$cid, $_POST['categorydd'],
$_POST['url'], $_POST['description'], $_POST['title'],
COM_applyFilter ($_POST['hits'], true),
COM_applyFilter ($_POST['owner_id'], true),
COM_applyFilter ($_POST['group_id'], true),
$_POST['perm_owner'], $_POST['perm_group'],
$_POST['perm_members'], $_POST['perm_anon'], $_POST['map']);
There's no apparent error when I edit a link, but map still returns to its default of 0. If I do:
Text Formatted Code
echo $title;
echo $map;
near the start of the savelink function, it displays the link title but no map variable, so I gather it's not making it into this function.
Any hints on what I might be forgetting? I assume there was no better way to customise this, there's a custom.php which I've never seen as something that would help in this kind of situation.
Cheers,
Brett