[MOD] New Story! or...
 
Notifications
Clear all

[MOD] New Story! or Updated!

13 Posts
4 Users
0 Reactions
4,554 Views
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

This is something one of my members asked for. Apparently she is having trouble telling the difference between new stories, and stories that just have new chapters.

The new feature, is setting another New! for new stories only. For display purposes, I'd probably change the current New! to Updated! and move it next to the number of chapters. (I can already do that part.)

Do you think that this might be something I'd be able to mod myself, Tammy?


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 08/01/2007 2:52 pm
(@tammy)
Posts: 2577
Member Moderator
 

Yeah that's easily something you can do yourself.  You'll find the relevant code section in includes/storyblock.php.


if(!empty($recentdays)) {
$recent = time( ) - ($recentdays * 24 * 60 *60);
if($stories['updated'] > $recent) $tpl->assign("new", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src="'$new'" alt='"._NEW."'>" : $new : _NEW);
}

Change that to be your "Updated!" as follows:


if(!empty($recentdays)) {
                global $newupdate;
$recent = time( ) - ($recentdays * 24 * 60 *60);
if($stories['updated'] > $recent) $tpl->assign("new", isset($newupdate) ? file_exists(_BASEDIR.$newupdate) ? "<img src="'$newupdate'" alt='"._NEWUPDATE."'>" : $newupdate : _NEWUPDATE);
}

Then add right beneath it:


        if($stories['updated'] == $stories['date']) {
$tpl->assign("new", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src="'$new'" alt='"._NEW."'>" : $new : _NEW);
}

This isn't tested.  We'll test it as a mod for now then add it as a feature later.


 
Posted : 08/01/2007 5:10 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Okay, I added this to the variables file for a skin and the Updated! part came up right.

$newupdate = "<span class='new'>Updated!</span>";

The New! one for the new story wasn't showing up. I think it's because the Update! one is using the {new} variable for listings. When just the {new} is used, Updated! shows up there. I think it's the $tpl->assign("new" in the first part.

I put {newupdate} on all my liststings after {update}.

Edit: Whoo! I got the Update! part to come up where the {newupdate} was by changing that $tpl->assign("new" to $tpl->assign("newupdate"

Still don't know why New! isn't showing up for the stories though...


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 08/01/2007 6:36 pm
(@tammy)
Posts: 2577
Member Moderator
 

Okay here's the corrected version.  I warned you it wasn't tested. πŸ™‚


if(!empty($recentdays)) {
global $newupdate;
$recent = time( ) - ($recentdays * 24 * 60 *60);
if($stories['updated'] > $recent) {
if(date("$dateformat", $stories['updated']) == date("$dateformat", $stories['date'])) $tpl->assign("new", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src="'$new'" alt='"._NEW."'>" : $new : _NEW);
else $tpl->assign("new", isset($newupdate) ? file_exists(_BASEDIR.$newupdate) ? "<img src="'$newupdate'" alt='"._NEWUPDATE."'>" : $newupdate : _NEWUPDATE);
}
}

You'll also need to add _NEWUPDATE to your languages/en.php file.


 
Posted : 08/01/2007 6:49 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Oh! but I was just about to exclaim loudly that I DID IT! On my own. πŸ˜€ Go me! Go me! Go me!

This is what I did:

Replace lines 95-100 of storyblock.php
with

	if(!empty($recentdays)) {
        global $newupdate;
$recent = time( ) - ($recentdays * 24 * 60 *60);
if($stories['updated'] > $recent) $tpl->assign("newupdate", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src="'$new'" alt='"._NEWUPDATE."'>" : $newupdate : _NEWUPDATE);
}
if(!empty($recentdays)) {
        global $new;
$recent = time( ) - ($recentdays * 24 * 60 *60);
if($stories['date'] > $recent) $tpl->assign("new", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src="'$new'" alt='"._NEW."'>" : $new : _NEW);
}

I'm sure yours is better though. πŸ˜›

I have _NEWUPDATE in my language file. πŸ™‚


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 08/01/2007 6:54 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Okay, yup, Tammy your's switches the New! and Update! depending on whether the story was recently added or not.

Mine were seperate, so the Updated! showed on every single one, and the New! showed only on new stories. Mine also needed more editing, all the variable files and listings off all the skins needed to be edited for it to show up properly.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 08/01/2007 7:14 pm
(@tammy)
Posts: 2577
Member Moderator
 

Well glad it works.


 
Posted : 08/01/2007 7:23 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Yup! πŸ˜‰

Tammy, would this mod interfere with the RSS feed? I just got a note from someone saying that they now only get New stories and not Updated stories on the feed.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 10/01/2007 1:01 am
(@tammy)
Posts: 2577
Member Moderator
 

I haven't touched the RSS in 3.0.  Actually, it's the same RSS as 2.0 pretty much.  And no, this couldn't affect that.


 
Posted : 10/01/2007 1:40 am
(@taford)
Posts: 16
Active Member
 

I'm confused, I've done everything you guys said on my page and I don't see the NEW! or Updated! on my site.
I added the code to the story.php and also the _NEWUPDATED.  I downloaded a new icon to the image folder but nothing. Can someone tell me what I'm doing wrong.

Version: 3.2.1
site: www.divasnluv.com
πŸ˜•


URL: http://www.divasnluv.com
Test site is: N/A
Version of eFiction: 3.4.2
Latest Patche(s): Yes
bridged?:No
modified?: No.
PHP: 5.2.1
MySQL:5.0.18

 
Posted : 19/04/2007 4:08 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Did you see Updated! on any fics before you added the changes?

Do you have the correct variables shown on the skins?

The code might be different now as the script has been updated several times. Make sur ethat you are doing the right things and that everything is being put in the right place, regardless of the line numbers, rather than just adding it in.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 20/04/2007 8:15 pm
(@chelle)
Posts: 122
Estimable Member
 

Quick question,  Would I have any issue doing this mod after I update to 3.3?  From the news thread, it doesn't seem so.


 
Posted : 12/06/2007 11:04 am
(@tammy)
Posts: 2577
Member Moderator
 

Just looking at it I'd say no.


 
Posted : 12/06/2007 2:05 pm
Share: