Blog Authors vs FUEL Users
Hey all,
I've been looking at the blog module and it looks really nice. Although, I'd like to let other authors contribute on my blog so they are able to log in, create posts, verify comments on their posts, and edit only their posts. I think I'll manage to do this with Fuel with a bit of work, but I'm wondering what is the difference between authors and users? It seems that I can't let authors log in, only users. So what should I be looking at to make this possible? (if it is possible)
Best,
Aaron
Comments
There is a develop branch to the Blog that has a bunch of changes that you may want to look at and includes a "limit_to_user" option that allows you to limit the authors to see only the posts they want.
https://github.com/daylightstudio/FUEL-CMS-Blog-Module/tree/develop
I found `_limit_to_user()` in the Base_module_model class. Is this what you meant? I would guess I am going to be editing list_items() or adding the $limit_to_user_field variable in the Blog_posts_model at fuel/modules/blog/models/blog_posts_model.php (If so, do you perhaps have an example or docs covering this? Just not quite sure where to go from here).
Thanks!
With settings > blog > limit to user selected, and fuel/modules/blog/config/blog.php copied over to fuel/application/config/blog.php, I'm not able to create a new post or view previously published posts when using a non super admin account. I get:
A Database Error Occurred` Error Number: 1066 Not unique table/alias: 'fuel_users' SELECT fuel_blog_posts.*, fuel_blog_users.display_name, CONCAT(fuel_users.first_name, " ", fuel_users.last_name) as author_name, YEAR(fuel_blog_posts.publish_date) as year, DATE_FORMAT(fuel_blog_posts.publish_date, "%m") as month, DATE_FORMAT(fuel_blog_posts.publish_date, "%d") as day FROM (`fuel_blog_posts`) LEFT JOIN `fuel_users` ON `fuel_users`.`id` = `author_id` LEFT JOIN `fuel_categories` ON `fuel_categories`.`id` = `fuel_blog_posts`.`category_id` LEFT JOIN `fuel_relationships` ON `fuel_relationships`.`candidate_key` = `fuel_blog_posts`.`id` AND fuel_relationships.candidate_table = "fuel_blog_posts" AND fuel_relationships.foreign_table = "fuel_tags" LEFT JOIN `fuel_blog_users` ON `fuel_blog_users`.`fuel_user_id` = `fuel_blog_posts`.`author_id` LEFT JOIN `fuel_users` ON `fuel_users`.`id` = `fuel_blog_posts`.`author_id` LEFT JOIN `fuel_tags` ON `fuel_tags`.`id` = `fuel_relationships`.`foreign_key` WHERE `fuel_blog_posts`.`slug` = 'test' AND `fuel_users`.`id` = 3 GROUP BY `fuel_blog_posts`.`id` LIMIT 1 Filename: /fuel/modules/fuel/core/MY_Model.php Line Number: 477
Although this is successful with a super-admin OR by turning off the 'limit to user' option. Anything else I should be looking out for?
Thanks for the quick update! I'm still getting a bit of an issue though. I now get this when creating a new blog post as a super-admin:
A Database Error Occurred Error Number: 1054 Unknown column 'fuel_users.first_name' in 'field list' SELECT fuel_blog_posts.*, fuel_blog_users.display_name, CONCAT(fuel_users.first_name, " ", fuel_users.last_name) as author_name, YEAR(fuel_blog_posts.publish_date) as year, DATE_FORMAT(fuel_blog_posts.publish_date, "%m") as month, DATE_FORMAT(fuel_blog_posts.publish_date, "%d") as day FROM (`fuel_blog_posts`) LEFT JOIN `fuel_categories` ON `fuel_categories`.`id` = `fuel_blog_posts`.`category_id` LEFT JOIN `fuel_relationships` ON `fuel_relationships`.`candidate_key` = `fuel_blog_posts`.`id` AND fuel_relationships.candidate_table = "fuel_blog_posts" AND fuel_relationships.foreign_table = "fuel_tags" LEFT JOIN `fuel_blog_users` ON `fuel_blog_users`.`fuel_user_id` = `fuel_blog_posts`.`author_id` LEFT JOIN `fuel_tags` ON `fuel_tags`.`id` = `fuel_relationships`.`foreign_key` WHERE `fuel_blog_posts`.`slug` = 'admin-test' GROUP BY `fuel_blog_posts`.`id` LIMIT 1 Filename: /Users/aaronharding/Sites/devisionarissen.nl/fuel/modules/fuel/core/MY_Model.php Line Number: 477
and creating a blog post as a normal user just refreshes the page, even though the post was successful. I also can't see posts made by this normal user when visiting the /blog/posts views, I can only see those posts as the super-admin.
I ran these commands to update, and the pull was successful.
cd fuel/modules/blog git pull
So,
1) Can't see *any* blog posts as a non super-admin, it just displays "No data to display"
2) Can't post as a non super-admin, the page just refreshes
Is this something I've done?
Appreciate all your help so far,
ran the uninstall.sql from the master branch, then ran both install sql files from https://github.com/daylightstudio/FUEL-CMS-Blog-Module/tree/develop/install
Now it's working! Thanks for the help.