9 years ago
Topic

How do you notify the user if another article has been created in the same category?

I'm using seblod to create a chronological blog and would like all past authors of articles within that specific category to be notified of a new article.

I have many categories that I will want to have only those authors notified for articles within their own categories.

To me this is what is done when one "subscribes" to a forum.




Get a VIP membership
39 Posts
dazzafact
9 years ago
0
Level 1

You have to
- create a new field ->select->dynamic create a  select statment "select * article  group by user"
 -23,45,56,34,32
- make this field hidden and put that new field in the "new article"-Form you wish the Users should be notify after creating it.
-I think you have to do the rest by javascript

9 years ago
0
Level 1

Hi All,

thank szczepan for your help.


A way to archieve that is to use a field "Afterstore" with some custom code like that.

// Adapt the query tou your need
$query = 'SELECT u.email FROM #__content AS c';
$query .= ' LEFT JOIN #__users AS u ON created_by = u.id';
$query .= ' WHERE c.state=1 AND u.block=0 AND c.catid=' . $fields['Your_category_field']->value;
$query .= ' GROUP BY c.created_by'; 
$users = JCckDatabase::loadColumn( $query );
if ( count( $users ) ) {
    
    $from        =    $app->getCfg( 'from' );
    $fromName    =    $app->getCfg( 'fromname' );
    $dest        =    array( implode( ',', $users ) );
    $cc          =    array(  );
    $bcc         =    array(  );
    $attach      =    null;
    $subject     =    'Your subject';
    $body        =    'Your body';
    
    JFactory::getMailer()->sendMail( $from, $fromName, $dest, $subject, $body.$footer, true, $cc, $bcc, $attach, NULL, NULL );
}

You will have access to each field in the form by looking at the variable $fields.


Regards.

Lionel

Get a Book for SEBLOD