By Brent Williams on Wednesday, 30 December 2015
Replies 11
Likes 0
Views 843
Votes 0
Is it possible to require at least one tag, and require a cover image?
Hi Brent,

I am sorry but currently it is not possible to achieve this currently in easyblog.
·
Wednesday, 30 December 2015 11:56
·
0 Likes
·
0 Votes
·
0 Comments
·
No problem! For anyone interested in doing this, here is the rough way to add the requirement for adding an image. (Using EasyBlog 5.0.31)

Open file administrator/components/com_easyblog/includes/post/post.php

Under the "public function validate()", add:

$this->validateImage();


(I put it right below the field validation.)

Next, find this function, "public function validateFields()" and put the following code after it. (After the closing bracket for the function)

public function validateImage()
{
if (!$this->hasImage()) {
throw EB::exception("A cover image is required.", EASYBLOG_MSG_ERROR, false, EASYBLOG_ERROR_CODE_FIELDS);
}
}


This isn't a "pretty" way to do it, but it gets the job done. I'll post the same for tags if I figure that one out.
·
Thursday, 31 December 2015 05:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok, I got the tag requirement to work. Basically, follow the instructions from the post above, and use these two sets of code:

$this->validateTags();



	public function validateTags()
{
if (!$this->tags) {
throw EB::exception("You need to add at least one tag for this blog.", EASYBLOG_MSG_ERROR, false, EASYBLOG_ERROR_CODE_FIELDS);
}
}
·
Thursday, 31 December 2015 05:25
·
0 Likes
·
0 Votes
·
0 Comments
·
I just noticed that since I used the fields error code as the base for this, it still "highlighted" the Fields tab when the error was displayed. That's not ideal, but not sure how to fix that. If anyone at StackIdeas wants to fix, you won't offend me at all. Would love to see this in a future release, as well!
·
Thursday, 31 December 2015 05:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Great idea but did you thought about users might not care about copyright of images? I always prefer setting the images by myself because of that.
·
Thursday, 31 December 2015 09:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Good point. It's not a concern for me because mine is for public relations professionals who issue press releases - they will have permission from their clients to post. Regardless, if Stack Ideas actually implemented, I'm sure they would do the same as the fields concept, where they allow admins to toggle this feature on and off. I didn't bother with creating that, however, since I know what I want.
·
Thursday, 31 December 2015 11:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Good input on this Brent I will log a feature request for the tags in the next release.

As for the cover image, I would rather not go in depth about this because it seems like many of EasyBlog users prefer to be lazy and they simply prefer to insert the image into the blog post rather than using a blog image. If we are going to add an option to force users to insert a post cover, we need to end up adding another settings for this which is just going to add more settings / configurations to the site admin (Which what many of site admins are complaining now)

My main goal for EasyBlog 5.1 is to:

1. Reduced settings (less is more)
2. Simplifying the editor (I always thought popups are cool but I have admitted defeat over this and we will be restoring the old layout in 5.1) We have created a massive interface that does cool stuffs only to realize that browsers these days are really not ready for prime time yet.
3. Integrations with 123RF for stock photos (We are collaborating with 123RF over this so that EasyBlog customers will be able to purchase stock photos at a more affordable rate)
·
Friday, 01 January 2016 18:33
·
0 Likes
·
0 Votes
·
0 Comments
·
That makes a lot of sense, Mark. And I love the idea of an integration for stock photos - any idea on the price point?
·
Saturday, 02 January 2016 00:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Brent,

123rf is actually already pretty cheap but I am still discussing with them and see if we are able to get any better offers for you guys They are just afraid of users who are not our clients but using our software which is pretty tricky in this open source world.
·
Saturday, 02 January 2016 00:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Sounds exciting - can't wait to see how that works out.
·
Saturday, 02 January 2016 01:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep, I am too
·
Saturday, 02 January 2016 13:28
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post