Gossamer Forum
Home : Products : Links 2.0 : Customization :

Prevent Modification Overwrite

Quote Reply
Prevent Modification Overwrite
Hello everyone,

I have a very weird thing that is happening with some links on my site. I have a custom field named 'isFeatured' that I've added to allow me to showcase links I think are cool. The two options for this field are Yes and No, with the default being No, so I can manually edit links to change it to 'featured'.

Now I'm getting e-mails from users who are modifying their link that has the 'isFeatured' field set to Yes. Seems like when they modify their link, the field reverts back to No, causing them to loose placement on my site.

Is there a way I can prevent the modification process from touching this field? If it's set to Yes I want to keep it, and if it's set to No, it should stay No.

Any help would be appreciated! Smile

-digitalsea
http://www.digital-sea.com/
Quote Reply
Re: [digitalsea] Prevent Modification Overwrite In reply to
Look in modify.cgi and ensure you have this code in sub process_form:

Code:
# Since we have a valid link, let's make sure the system fields are set to their
# proper values. We will simply copy over the original field values. This is to stop
# people from trying to modify system fields like number of hits, etc.
foreach $key (keys %add_system_fields) {
$in{$key} = $original{$key};
}

That code copies the default values to the new but, as yet, unmodified record. If you have %add_system_fields in links.def set to put in a default for the isFeatured field, then that is why you are getting them reset back to No. That is the default.

Change this code:

Code:
# Print out the modified record to a "modified database" where it is stored until
# the admin decides to add it into the real database.
$in{$db_cols[$db_dateadded]} = $original{'DateAdded'};

to this:

Code:
# Print out the modified record to a "modified database" where it is stored until
# the admin decides to add it into the real database.
$in{$db_cols[$db_dateadded]} = $original{'DateAdded'};
$in{$db_cols[$isFeatured]} = $original{'isFeatured'};

This assumes that you have $isFeatured defined in links.def as well.

This should fix your problem.

Bob Connors aka Bobsie
Quote Reply
Re: [Bobsie] Prevent Modification Overwrite In reply to
It's filling in the correct information on the modify form when I go to validate, but I get this error when I go to approve the changes:

Modify Error: Yes. Couldn't find record in modified/links database

And the validation doesn't go through (the link isn't modified). What could be wrong?

-digitalsea
http://www.digital-sea.com/
Quote Reply
Re: [Bobsie] Prevent Modification Overwrite In reply to
Is this mod something you just recently added? Did you add a field for it ( |no ) to every existing line in your links.db? If not, that will certainly cause a problem!

Did you do this on your own or following a posted mod? Sounds like the editor's pick mod, you could use that mod to compare what you did.


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Mar 7, 2004, 12:39 PM
Quote Reply
Re: [digitalsea] Prevent Modification Overwrite In reply to
Nevermind... I just got it to work...

There was one error in the code...

Code:
$in{$db_cols[$isFeatured]} = $original{'isFeatured'};

Should be changed to:

Code:
$in{$db_cols[$db_isfeatured]} = $original{'isFeatured'};

Thanks a bunch... bobsie you rock! Blush

-digitalsea
http://www.digital-sea.com/