Deny Badge Auto-Grant with Redirect

OK, let's say you plunked down 100K credits on a badge, and you find it isn't helping sales, really? What is an avatar to do? All the leeches want freebies, but are not playing the game to your advantage. Well, you can charge them for the badge by redirecting them to a product page instead of granting the badge when they click "Request Badge". The trick is to disconnect the JavaScript that grants the badge, and substitute it with the JavaScript that -you- want to run.

The technical trick here is that your JavaScript will typically run -before- the click event handler is added to the badge. The way to get around that is to place your code in a jQuery $(document).ready() statement, so that it doesn't run until -after- the badge granting code has been attached. And IMVU conveniently uses at least 2 JavaScript frameworks (YUI and jQuery) you can piggyback on. And since the event is attached to the button using YUI, you have to use YUI to remove it.

To use this code you need to do the following:
* Make sure your badge(s) are set to Auto-Grant on.
* Change myIMVUID to your own ID
* Change the productID to one of yours
* Change the badge numbers in the comma delimited list. They are numbered sequentially starting at 1. If you only have one badge, just use [1] with no commas inside.

That's it! It's up to you what you want your product page to say and do. I'll tell that if they buy a product with real credits (not promo) and PM me, they'll get the badge. I think that's fair, don't you?

This code snippet was originally contributed by Cheri Imvu. Go to the author' imvu website.