Welcome! Anonymous

How to set up a news publication, the automatic Activate

General announcement

How to set up a news publication, the automatic Activate

Postby ooabcoo » Tue May 25, 2010 1:23 pm

How to set up a news publication, the automatic Activate? :shock:
TomatoCms Chinese version demo (中文版本演示)
http://www.showip.cn
ooabcoo
 
Posts: 38
Joined: Tue May 25, 2010 3:45 am

Re: How to set up a news publication, the automatic Activate

Postby LeHa » Wed May 26, 2010 1:59 am

You can't activate automatic articles.

If you sill want to activate automatic articles, you correct as follows:
Go to app\modules\news\controllers\ArticleController.php file, in addAction (line: 350):
[Before]
Code: Select all
$article = new Tomato_Modules_News_Models_Article(array(
            'category_id'       => $categoryId,
            'title'          => strip_tags($title),   
            'sub_title'       => strip_tags($subTitle),
            'slug'             => $slug,
            'description'       => $description,
            'content'          => $content,
            'allow_comment'    => $allowComment,
            'created_date'       => date('Y-m-d H:i:s'),
            'created_user_id'    => $user->user_id,
            'created_user_name' => $user->user_name,
            'author'          => strip_tags($author),
            'icons'          => $articleIcons,
            'sticky'          => false,
         ));


[After]
Code: Select all
$article = new Tomato_Modules_News_Models_Article(array(
            'category_id'       => $categoryId,
            'title'          => strip_tags($title),   
            'sub_title'       => strip_tags($subTitle),
            'slug'             => $slug,
            'description'       => $description,
            'content'          => $content,
            'allow_comment'    => $allowComment,
            'created_date'       => date('Y-m-d H:i:s'),
            'created_user_id'    => $user->user_id,
            'created_user_name' => $user->user_name,
            'author'          => strip_tags($author),
            'icons'          => $articleIcons,
            'sticky'          => false,
            'status'          => 'active',
         ));
Image
Le Thi Ngoc Ha, TomatoCMS Developer
Twitter: http://twitter.com/tomatocms
LeHa
 
Posts: 143
Joined: Tue Jan 19, 2010 1:50 am

Re: How to set up a news publication, the automatic Activate

Postby ooabcoo » Thu May 27, 2010 10:08 am

Thank you! :D
TomatoCms Chinese version demo (中文版本演示)
http://www.showip.cn
ooabcoo
 
Posts: 38
Joined: Tue May 25, 2010 3:45 am

Re: How to set up a news publication, the automatic Activate

Postby ooabcoo » Thu May 27, 2010 2:00 pm

Code: Select all
$article = new Tomato_Modules_News_Models_Article(array(
            'category_id'       => $categoryId,
            'title'          => strip_tags($title),   
            'sub_title'       => strip_tags($subTitle),
            'slug'             => $slug,
            'description'       => $description,
            'content'          => $content,
            'allow_comment'    => $allowComment,
            'created_date'       => date('Y-m-d H:i:s'),
            'created_user_id'    => $user->user_id,
            'created_user_name' => $user->user_name,
            'author'          => strip_tags($author),
            'icons'          => $articleIcons,
            'sticky'          => false,

         ));
         if ($preview) {
            $article->status = 'draft';

Also must increase following 4 lines,
Code: Select all
            'status'                => 'active',
            'updated_date'       => date('Y-m-d H:i:s'),
            'updated_user_id'    => $user->user_id,
            'updated_user_name'   => $user->user_name,

         ));
         if ($preview) {
            $article->status = 'draft';


Main title 1
Posted by admin at 2010-05-27 14:56:37
Last activated by at 1970-01-01 01:00:00 Activated
Image
Last edited by ooabcoo on Thu May 27, 2010 2:04 pm, edited 1 time in total.
TomatoCms Chinese version demo (中文版本演示)
http://www.showip.cn
ooabcoo
 
Posts: 38
Joined: Tue May 25, 2010 3:45 am

Re: How to set up a news publication, the automatic Activate

Postby ooabcoo » Thu May 27, 2010 2:01 pm

TomatoCms Chinese version demo (中文版本演示)
http://www.showip.cn
ooabcoo
 
Posts: 38
Joined: Tue May 25, 2010 3:45 am

Re: How to set up a news publication, the automatic Activate

Postby LeHa » Mon May 31, 2010 9:02 am

oh, I'm sorry.
You have to set 'activate_date' => date('Y-m-d H:i:s').
Code: Select all
$article = new Tomato_Modules_News_Models_Article(array(
            'category_id'       => $categoryId,
            'title'          => strip_tags($title),   
            'sub_title'       => strip_tags($subTitle),
            'slug'             => $slug,
            'description'       => $description,
            'content'          => $content,
            'allow_comment'    => $allowComment,
            'created_date'       => date('Y-m-d H:i:s'),
            'created_user_id'    => $user->user_id,
            'created_user_name' => $user->user_name,
            'author'          => strip_tags($author),
            'icons'          => $articleIcons,
            'sticky'          => false,
            'status'          => 'active',
            'activate_date'          => 'date('Y-m-d H:i:s')',
         ));
Image
Le Thi Ngoc Ha, TomatoCMS Developer
Twitter: http://twitter.com/tomatocms
LeHa
 
Posts: 143
Joined: Tue Jan 19, 2010 1:50 am

Re: How to set up a news publication, the automatic Activate

Postby ooabcoo » Mon May 31, 2010 1:42 pm

Yes
TomatoCms Chinese version demo (中文版本演示)
http://www.showip.cn
ooabcoo
 
Posts: 38
Joined: Tue May 25, 2010 3:45 am

Re: How to set up a news publication, the automatic Activate

Postby simmol » Fri Jun 04, 2010 10:53 am

If you ask me.
The easy way to do it is to forward to activation method after saving the article.
You can even add checkbox in the Article add.phtml to handle do you want to activate it or not.

This way you don't need to change sqls and so on, you just run 'automatic' the activation action.
simmol
 
Posts: 5
Joined: Tue Jun 01, 2010 12:16 pm


Return to General Announcement

Who is online

Users browsing this forum: No registered users and 1 guest