Charging Points to Add Image and Add Video

Post

Posted
Rating:
Item has a rating of 5 (Liked by Adam)
#6274 (In Topic #1574)
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’

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.
 
 
Online now: No Back to the top

Post

Posted
Rating:
#6275
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Hi,

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


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6278
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Thank you so much for replying so quickly, Chris.

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!
 
Online now: No Back to the top

Post

Posted
Rating:
#6282
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
I am still at a loss about CRUD.

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?
Online now: No Back to the top

Post

Posted
Rating:
#6283
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Properly learning CRUD is diving in at the deep end. If you want to change existing behaviour you'd be better off just experimenting changing existing code on a line-by-line level. That's how I learned coding (30 years ago, lol).

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');
}
 

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…


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6284
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Thanks again, Chris!

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!
Online now: No Back to the top

Post

Posted
Rating:
#6294
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
I am so sorry Chris.  I wasn't able to implement the code correctly.
Online now: No Back to the top

Post

Posted
Rating:
#6295
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I wouldn't honestly expect most users to be writing code. I don't want to put anyone off, it's a great rewarding thing, but it's  a lot to learn.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6296
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Maybe we can cover this in some kind of public live coding session/lesson.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6297
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
That would be fantastic, Chris!  Thanks so much!!!




 
Online now: No Back to the top

Post

Posted
Rating:
#6319
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Not that I am sure how to do this, or if this is reasonable, but I was thinking...

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!
Online now: No Back to the top

Post

Posted
Rating:
#6328
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I'd avoid convoluted solutions, they will be a problem to maintain as you try and do more things or do upgrades. Besides, a more direct solution would be simpler.

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)


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6329
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Wonderful!  I am here!
 
Online now: No Back to the top

Post

Posted
Rating:
#6330
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I think I'll be streaming on Twitch, which I'm setting up now. Anyone wanting to have the latest info, best to be in IRC for it.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6331
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
I'm sorry, I don't know how to connect to view.
 
Online now: No Back to the top

Post

Posted
Rating:
#6332
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I've never used Twitch before either. I think you'll need an account on Twitch.tv and I'll need to tell you the channel name (which is ComposrCMS). I think you'll then be able to do text chat while I'm streaming and see my screen and camera.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • 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.
Online now: No Back to the top

Post

Posted
Rating:
#6333
Avatar
Site staff
Adam is in the usergroup ‘Super-moderators’
Pretty sure you can view streams without an account, same as Youtube.
Online now: No Back to the top

Post

Posted
Rating:
#6334
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Great!  I'm on twitch.tv website.  There is something streaming on the screen.  There is a list of Recommended Channels on the left sidebar.
Online now: No Back to the top

Post

Posted
Rating:
#6335
Avatar
Site staff
Adam is in the usergroup ‘Super-moderators’
Probably an account will be needed to chat, but I know some places allow Guests to comment on streams. I'm not familiar with Twitch.tv either.
Online now: No Back to the top

Post

Posted
Rating:
#6336
Avatar
Standard member
starfish is in the usergroup ‘Fan in action’
Just joined.  Says you are "offline".
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

Philip, mytracker, Vaiva, MVLipwig, deepu_ms

Forum statistics:
  • 1,213 topics, 5,696 posts, 6,852 members
  • Our newest member is trotons
Birthdays:
Back to Top