Gossamer Forum
Home : Products : Gossamer Links : Discussions :

isNew and isChanged Issue

Quote Reply
isNew and isChanged Issue
This topic was brought up on the forum once before 8 years ago and wasn't properly addressed.

In GLinks, when a link is set to isNew, and then modified, the flag is then turned off and instead isChanged becomes active.

This is creating a bit of an issue for us where we have a classifieds system where we change the styling of the listing if it's true by using a simple <%if isNew=1%><font color="red">*loop*</font><%endif%>

The problem now exists where users who submit their ads, then see a typo and go and change it. They then lose the styling of their listing because the link is no longer seen as new, but as changed.

What would be the easiest way to go around this?
Quote Reply
Re: [meso] isNew and isChanged Issue In reply to
What version of GLinks are you using? Can't say I was aware of this issue. Sounds almost like the code that sets isChanged should really check to see if isNew is set first, and if so, then just ignore it.

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] isNew and isChanged Issue In reply to
Mmm, In GLinks 3.2, I just took a look at the code - and it SHOULD be doing what I would expect:

Code:
sub set_date_flags {
# -------------------------------------------------------------------
# Takes a link hash ref and sets the date flags properly.
#
my ($self, $p) = @_;

Links::init_date();
my $today = GT::Date::date_get();
if (GT::Date::date_diff($today, $p->{Add_Date}) <= $CFG->{build_new_cutoff}) {
$p->{isNew} = 'Yes';
$p->{isChanged} = 'No';
}
elsif (GT::Date::date_diff($today, $p->{Mod_Date}) <= $CFG->{build_new_cutoff}) {
$p->{isChanged} = 'Yes';
$p->{isNew} = 'No';
}
else {
$p->{isNew} = 'No';
$p->{isChanged} = 'No';
}

if ($p->{ExpiryDate} and $p->{ExpiryDate} =~ /[^\d-]/) {
my $converted = Links::date_to_time($p->{ExpiryDate});
$p->{ExpiryDate} = $converted if defined $converted;
}
}

1) Checks to see if the days since it was added is < the build_new_cutoff period (i.e 7 days)... and if so, set isNew => Yes and isChanged => No
2) Failing that, it checks to see the Mod_Date field to see if the the build_new_cutoff period is less than it (i.e 7 days)... and if so, set isNew => No and isChanged => Yes
3) Failing that, it sets both to "No"

What version of GLinks are you using?

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] isNew and isChanged Issue In reply to
Hey Andy,

We're using Glinks 3.3

Here is an example. I submitted the ad "Test *ignore*" to the category and when I made the submission the text was red, as with the links under it. The colour being set by the is_new query mentioned above.

http://www.dropzone.com/classifieds/Reserve_Canopies/index.html

I then went to modify the ad, after modifying it the red text was immediately not visible.

I can only think that this is a case of GLinks first checking if a link has been modified or not, and if it has - it automatically sets the is_modified field and removes the is_new on that link.



Quote Reply
Re: [meso] isNew and isChanged Issue In reply to
What do you see with the values for the links, in:

Code:
<%isNew%>
<%ischanged%>

?

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] isNew and isChanged Issue In reply to
Just looked at the ad again and it was displaying in red. So it seems that what happens is that the isNew flag is set when the ad is submitted, then when it's changed, the flag is changed from isNew to isChanged. Then when the isChanged expires, it goes back to isNew.

This is supported by the fields you mentioned above displaying:

isChanged - 1
isNew - 0

After an edit has been made on that ad.
Quote Reply
Re: [meso] isNew and isChanged Issue In reply to
Ok, I'll try and have a look at that later on today/ tomorrow.

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: [meso] isNew and isChanged Issue In reply to
Hi,

Mmm, I just tested this on a basic 3.3 install, and it works fine:

Code:
+-----+-----------+-------+
| ID | isChanged | isNew |
+-----+-----------+-------+
| 420 | No | Yes |
+-----+-----------+-------+

That means you have probably changed some code somewhere, which is giving this weird result.

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] isNew and isChanged Issue In reply to
Thanks for the input once again Andy, I guess it's quite possible that somewhere down the line we may have made changed that has affected it, will spend time looking into that. Thanks