Here be questions and here be answers.
Having some problems trying to use vae_update to increment a count of votes for an entry. My code is below, and I've tried different permutations of casting and such, even using the explanation in the docs. $exhibition = vae($resourceId); $votes = $exhibition['votes']; $intVotes = intval($votes) + 1; vae_update($exhibition->id, array('votes' => $intVotes));Regardless of whether the 'votes' field has no value or a number, it sets the field value to 2. Setting a var to vae_update always returns true.
$exhibition = vae($resourceId); $votes = $exhibition['votes']; $intVotes = intval($votes) + 1; vae_update($exhibition->id, array('votes' => $intVotes));
Errors in the original post - should be fixed. (the code not the issue)
I would expect that code to work. However, I must warn you that running contests through Vae collections is an extremely bad idea and we warn against it in our documentation. The reason is that contests are almost guaranteed to invite high amounts of abuse and spamming to that page. When that happens, in order to keep the rest of your site from running too slowly, the only thing we can do is shut down all updates to your content entirely.Furthermore, this code wouldn't provide any protection against fraudulent votes.Seriously, I'm pretty sure that *every* person who has run a contest on Vae has run into these problems and wishes they used something more purpose-built for contests. I can think of at least 5 instances where it has been a major problem for the designer and the client.
Well, this mechanism is not accessible via the web - it's in a webservice query posted via a mobile application. The fraudulent vote issue is also not a problem in this context. If hypothetically it were used legitimately - called a few hundred times a day across the entire collection - would that cause the content lock you refer to?
You could try running the contest via something like parse.com and then read the current count back via file_get_contents.
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership