1
marcan
Notification sent when editing a news?
  • 2004/3/25 19:54

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Hi ! When a user has a notification set for Global > New Story in the news module, he gets notified even when the admin edit the news after it has been published. Is this the normal behavior of the notifications ?

If this is what's supposed to be, how can I prevent a user being notified when a simple edit of a news is done.

Also, is this the same in all modules using notifications?

Thanks fo your answers !

2
cuckston
Re: Notification sent when editing a news?
  • 2004/3/25 20:17

  • cuckston

  • Quite a regular

  • Posts: 268

  • Since: 2004/1/19


Notifications occour when a news file is new or has been editied as it is to notify the user that the story has changed. I dont believe you can turn it off without turning the whole notification block off.

3
marcan
Re: Notification sent when editing a news?
  • 2004/3/25 20:28

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Yes, I've done some more testing and it seems to be the default behavior. However, this does not seem to occured in mylinks or in soapbox.

Can someon confirm that to me?

Finally, anyone have a "quick hack" suggestion for a workaround?

Thanks for any help !

4
marcan
Re: Notification sent when editing a news?
  • 2004/3/27 21:51

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Please forgive me.... but could I ask for some help on the previous topic?

Any suggestion?

Many many thanks !

5
Mithrandir
Re: Notification sent when editing a news?

submit.php
$result $story->store();
    if (
$result) {
        
// Notification
        
$notification_handler =& xoops_gethandler('notification');
        
$tags = array();
...
etc...

before the $story->store(); make a check to see if $story->storyid is set (indicating whether the story is new or not) - if you do a simple
$isnew = isset($story->storyid) ? 0;

and then change the notification clause to
if ($result && $isnew) {


Try that out - but remember that there is both submit.php and an admin file to submit news

6
marcan
Re: Notification sent when editing a news?
  • 2004/3/27 22:24

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Many Many Thanks Mithrandir

I'll try that !

Thanks again !

7
marcan
Re: Notification sent when editing a news?
  • 2004/3/27 22:51

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Ok, you sent me on the good track Mithrandir, thank you. I edited the admin/index.php file and now, when I edit an article in the admin interface, users don't get notify. Thanks !

For some of you how maybe thinking it's usefull, I published the file I've hacked here: No notifications on Edit for the News module

Cheers !

8
rickh
Re: Notification sent when editing a news?
  • 2005/5/21 23:42

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


** KICK **

I have the same problem. I've read the reply of mithrandir, but i'm not sure what to edit. I think i only have to edit admin/index.php.

Now I have this:

$story -> store();
        
$notification_handler = & xoops_gethandler'notification' );
    
$tags = array();
        
$tags['STORY_NAME'] = $story -> title();
        
$tags['STORY_URL'] = XOOPS_URL '/modules/' $xoopsModule -> getVar'dirname' ) . '/article.php?storyid=' $story -> storyid();
        >>>>
$isnew = isset($story->storyid) ? 0;<<<<
    if ( !empty( 
$isnew ) )
        {
            
$notification_handler -> triggerEvent'story'$story -> storyid(), 'approve'$tags );
        } 
        
$notification_handler -> triggerEvent'global'0'new_story'$tags );
etc....

The line marked with >>><<< is the only thin i've added. At the moment I don't have the facilities to test it on a test install and I don't want to test it on the main server.
Is it right what i'm doing?

btw. I use news 1.1

9
krystinevo
Re: Notification sent when editing a news?

Quote:

marcan wrote:

For some of you how maybe thinking it's usefull, I published the file I've hacked here: No notifications on Edit for the News module

Cheers !


Thanks everyone... I've been looking for this! Marcan, the link you provided is broken?

Take care,

Kristine

10
rickh
Re: Notification sent when editing a news?
  • 2005/5/24 23:02

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


does someone have an opinion about this????

I already tried this:

if ( !empty( $isnew ) )
        {
            
$notification_handler -> triggerEvent'story'$story -> storyid(), 'approve'$tags );
         
// } DELETED BY ME
        
$notification_handler -> triggerEvent'global'0'new_story'$tags );
        
/*
            $poster = new XoopsUser($story->uid());
            $subject = _AM_ARTPUBLISHED;
            $message = sprintf(_AM_HELLO,$poster->uname());
            $message .= "nn"._AM_YOURARTPUB."nn";
            $message .= _AM_TITLEC.$story->title()."n"._AM_URLC.XOOPS_URL."/modules/".$xoopsModule->dirname()."/article.php?storyid=".$story->storyid()."n"._AM_PUBLISHEDC.formatTimestamp($story->published(),"m",0)."nn";
            $message .= $xoopsConfig['sitename']."n".XOOPS_URL."";
            $xoopsMailer =& getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($poster->getVar("email"));
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($xoopsConfig['sitename']);
            $xoopsMailer->setSubject($subject);
            $xoopsMailer->setBody($message);
            $xoopsMailer->send();
        } //ADDED BY ME
        */
    
}
        
redirect_header'index.php?op=newarticle'1_AM_DBUPDATED );
        exit();
        break;


see the comments. But it seems like now there will be no notification sent at all when creating new articles.

Login

Who's Online

226 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 226


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits