Welcome to Geeklog, Anonymous Saturday, April 20 2024 @ 02:28 am EDT

Geeklog Forums

Customised links problem - how to carry around a new field?


Status: offline

worldfooty

Forum User
Full Member
Registered: 01/13/09
Posts: 162
Location:Mostly Adelaide, South Australia, Australia
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
 Quote

Status: offline

worldfooty

Forum User
Full Member
Registered: 01/13/09
Posts: 162
Location:Mostly Adelaide, South Australia, Australia

I've searched and searched and I don't understand how those variables like $description make it into the savelink function. I mean, they appear to be passed in as parameters, but what is actually calling savelink?

The rest of my changes seem ok - if I have my new variables like $map in savelink it's fine in saving them.

Any hints to nudge me along? Where or how is the savelink function called in admin/plugins/links/index.php?

 Quote

All times are EDT. The time is now 02:28 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content