Charging Points to Add Image and Add Video
Posted
#5682
(In Topic #1170)
How to disallow adding images and videos based upon points.
I appreciate any help you may offer.I am trying to charge members points in order to add images or videos. I went into Setup---->Configurations---->Point Options and set "Points Given" to Add Image to -5 (a negative number). 5 Current Points are deducted from the member on image upload. I can see this in a member's Profile that this works fine.
Here's the problem:
I only want the image to be uploaded if the member has enough Current Points for the transaction. If the member does not have enough points, the image should not upload.
After doing what I described above, the member now has "Current Points: -5 to spend". The upload was allowed with a negative result of points.
Setting Security--->Privileges---->Points to not allow negative points only refers to "Gift Points". Images added are deducted from "Current Points".
I know this is usually done within the query to the database, but I can't figure out how to do this.
Hoping that someone has an idea. Thanking you in advance.
Posted
Your approach is smart
Unfortunately Composr isn't coded to know what you're doing, so it would need implementing. We've had an issue on the tracker a while for this request:
0000045: Implicit point store - charging to add content - Composr CMS feature tracker
Posted
Since reading your reply, I have been trying to learn about CRUD. I'm pretty much a beginner, so I've got a lot to learn.
I'm not giving up!
Posted
What if I made the button to "ADD IMAGE" invisible (Content Management--->Galleries--->ADD IMAGE page) if a query to the database reveals the user does not have enough Current Points (using Operators)?
How should I go about this?
Posted
Also just changing the icon isn't going to be a secure solution, as if a user could find the direct URL they'd bypass the check, and if that was also checked, they could simulate a form submission, so you'd need to add a check in the actualiser code.
I'd start by just trying to disable the form if there isn't enough points. That doesn't fix the aforementioned actualiser issue, but I think it's better than just disabling the icon as casual users are not going to be simulating form submissions but they might be bookmarking form URLs.
So find the get_form_fields functions for images and videos in cms_galleries.php and I think you'd need to add some code to them something like:
Code (PHP)
if (available_points(get_member()) < 50) {
warn_exit('You do not have enough points, you need at least 50');
}
warn_exit('You do not have enough points, you need at least 50');
}
Obviously this is hard-coding it in a not completely secure way for just a couple of content types, while the tracker issue is to do a more comprehensive, secure, solution. But if it does what you need…
Posted
I will keep reading about CRUD. Unfortunately, I couldn't even find the location of the CRUD module to view it. I did read the tutorial a few times, and searched for additional explanations. It was beyond this beginner's skill set. I thought that having the add button appear or not appear on the page might be a solution I could handle, but I wasn't sure if this was okay to do. Thanks for explaining!
As a side note, your tutorials, documentation, and videos are excellent resources! I've learned a lot already. Thank you!
Posted
Posted
Posted
What if a hidden field was passed with the value of Available Points, when the user goes to the page to upload an image or upload a video (after clicking on "Add Image" or "Add Video" buttons).
Would the Field Filters (Setup-->Field Filters) be able to stop the upload, based upon that hidden field's value (using operators)?
Again, not sure how to correctly implement this but I can't stop thinking about what might work.
I am looking forward to Chris Graham's lessons!
Posted
I'm thinking about how we can do a programming session at the moment. Will you be around for the next hour or two? (It won't take that long, but I've got to work out how to do it)
Posted
Posted
Posted
Posted
Posted
1 guest and 0 members have recently viewed this.
