Charging Points to Add Image and Add Video


How to disallow adding images and videos based upon points.
Yes, working on it.Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


cms-galleries-changes.diff
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


I thought it was an easy fix. I didn't realize it meant coding the entire page.
Wish I had more points to give you (I recently joined). You deserve more!
I can't thank you enough!!!


I'm also still confused about the line:
if ((!has_privilege(get_member(), 'have_negative_gift_points')) && (available_points(get_member()) < -$points)) {
return false;
I am still not sure why gift_points are mentioned, since image and video uploads are deducted from Current Points, not Gift Points. If the operator '&&' is used, doesn't it mean that both operands are true. Let's say a user has a positive number of Gift Points and not enough Available Points (they are separate). They shouldn't be able to upload an image due to the lack of available points. Would they still be able to upload because they had positive gift points (which has nothing to do with the upload)?
Thanks again!


Logged in as a user. Clicked button to upload IMAGE. Gave me message when I didn't have enough points. Great.
Clicked button to upload VIDEO. Critical error - bailing out
I deleted the copy of the cms_galleries file because there was a black bar in my cpanel.
I don't know if this has anything to do with it, but when I hover over the "Add image" link the type=add, and when I hover over the "Add video" link the type=add_other.


Now, replying to further posts in this topic…
I didn't realize it meant coding the entire page.
Well, it was only a few lines of code. But to be honest I have always thought there was an optimism bias in the Composr community as to how easy implementing custom ideas is ;-). If we look at all the code written for the Composr project, it's around 850,000 lines at the moment. And I for one write pretty terse code, so there's a lot of logic packed into that, other projects would probably take millions to do the same.
how do you use a diff file
If you do want to apply it automatically (I expected hand application), you use the patch command, which comes with Mac OS and Linux, and if you're on Windows I think you could get it with Cygwin (Cygwin).
You'd make sure the working directory was the Composr base directory (as this is where I created the diff file from, and hence where file paths are relative to). And then:
Code (Bash)
I am still not sure why gift_points are mentioned, since image and video uploads are deducted from Current Points, not Gift Points.
Right, I tried to cover this in the video but I was probably confusing. There's no direct privilege for negative points, but I used this one for negative gift points by mistake.
I just confirmed in the code we currently use give_points_self for a negative points privilege - as I mentioned in the video, being able to give yourself points is basically the same thing as being allowed negative points, in effect. So change have_negative_gift_points to give_points_self.
If there's any remaining confusion, the lines should be:
Code (PHP)
return false;
}
which means "If the current user does not have the "give_points_self" privilege and has fewer points than the cost [the negative of what they'll be given], say they won't be allowed to submit.".
Clicked button to upload VIDEO. Critical error - bailing out
Whoops. That was totally my mistake. I added new methods (class functions) into the first class in the file (Module_cms_galleries), but videos are in a second class (Module_cms_galleries_alt).
I don't want to get too deep in the weeds of how to do this correctly, so for now I'd suggest just copying and pasting my has_enough_points and check_available_points methods so they are also in Module_cms_galleries.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


The session on Twitch was excellent! For those reading this, if you go to the twitch.tv website and search for ComposrCMS, you will find the video. You don't have to join to view it. I've already watched it a few times. If you want to participate in a chat during a live session, you will have to join. Chatting during a live session on a full screen changed the chat box. That's why it took me a while to change it back to respond to you Chris.
I am still getting a Critical Error message when adding a video without enough points. I am so sorry but I am not understanding what I need to do, what to add, and where.
I'd suggest just copying and pasting my has_enough_points and check_available_points methods so they are also in Module_cms_galleries.
Your patience is much appreciated!
Last edit: by starfish


I don't know why I didn't understand what you said at first, Chris. I am so grateful for everything you did!!!
Please let us know when you are doing your next Twitch tutorial.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.