Duplicating the blog module good or bad idea

edited May 2012 in Modules
Ok, after a whole day of trying to create a module for teachers to create articles, I started looking at the blog module.

It looks like this is what I need but I don't like the fact that each author can edit/delete any other authors articles.

So will it maybe be a good idea for me to duplicate the blog module and try to tweak it to work the way I want it to?

I would like to hear your opinions before I spent another day trying to create something with no success.


  • edited 5:13AM
    That may be a good place to start. If you need to limit access to just the author, you will need to add some user specific query logic in your model in certain areas. For example, in the list_items method you may want to add the following user specific code:
    // used for the FUEL admin function list_items($limit = NULL, $offset = NULL, $col = 'post_date', $order = 'desc') { // set the filter again here just in case the table names are different $this->filters = array('title', 'content_filtered', $this->_tables['users'].'.first_name', $this->_tables['users'].'.last_name'); $this->db->select($this->_tables['blog_posts'].'.id, title, CONCAT('.$this->_tables['users'].'.first_name, " ", '.$this->_tables['users'].'.last_name) AS author, '.$this->_tables['blog_posts'].'.post_date, '.$this->_tables['blog_posts'].'.published', FALSE); $this->db->join($this->_tables['users'], $this->_tables['users'].'.id = '.$this->_tables['blog_posts'].'.author_id', 'left'); // user specific $CI =& get_instance(); $user_id = $CI->fuel_auth->user_data('id'); $this->db->where(array('author_id', $user_id)); $data = parent::list_items($limit, $offset, $col, $order); return $data; }
  • edited 5:13AM
    Thank you admin :)
This discussion has been closed.