As we know SweetCron a very useful application developed by Yong Fook that can automatically update our web server with our private status update feed such as facebook, flickr youtube, blog, twitter, digg, vimeo and much more. It is very useful for a personal use. But, what about a group of people who wanted to know updates of each other in one web server? SweetCron currently does not provide such feature. So, the only way to make it possible, we have to extend the SweetCron feature ourselves.
In order to enable the multiple user feature in sweetcron, we must modify 4 elements in sweetcron which is database, model, view, and controller. In this post, I will only teach you how to modify the first elements which is the sweetcron’s database.
Firstly, we must add 2 more columns on the users table. One column to define the user type (admin or feed only) and another column to define the user avatar. Also, the ID column in users table needs to be renamed as user_id to avoid conflict with the ID column in items table when we join them. The altered users table should have all the column listed below.
user_id – bigint(20) //primary key (column name edited)
user_login – varchar(60)
user_pass – varchar(64)
user_email – varchar(100)
user_activation_key – varchar(60)
user_type – varchar(20) //added column
user_avatar – varchar(50) //added column
lastly, we must also create a relationship between the feeds table and users table. In order to do that, we must add one more column in the feeds table to store the foreign key of users table. The altered feeds table should have all the column listed below.
feed_id – int(11)
feed_title – text
feed_icon – varchar(255)
feed_url – text
feed_data – longtext
feed_status – varchar(20)
feed_domain – varchar(255)
feed_user_id – bigint(20) //added column
That’s all for now. Next time I will teach you how to modify the second element, which is the model. If you want to view the final product of multiple user sweetcron go to http://www.brainstorm.pro/lifestream/