576 posts
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
  • Elite Author
+9 more
radykal
says

Ok, but for me its not working. I can select the Purchasecode method in the dashboard, but when I go to the register form for the users I dont see any additional input field that I add in the registerpurchasecode.php, which is located in the same folder as the other register php files.

When I select the purchase code option and save it, it still use the registerbasic.php. I test it on my local machine, maybe that why its not working?!

21 posts
  • 4 Years of Membership
  • Affiliate Level 1
  • Collector Level 1
  • Exclusive Author
+1 more
AgileApricot
says

I’ve got the same problem as radykal.

5492 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Australia
  • Author Level 3
+5 more
Australia
says

Latest build is 2.0.18.1

Contact x00 at vanillaForums.org he my be interested doing this as a paid mod

4 posts
  • 3 Years of Membership
  • Affiliate Level 1
  • Author Level 3
  • Collector Level 1
+2 more
nook_themes
says

Good stuff. Thank you!

350 posts Gambit
  • 5 Years of Membership
  • Affiliate Level 2
  • Author Level 7
  • Collector Level 4
+6 more
bfintal
says

I know this is an old thread, but I’m currently making my own support forum and the code posted earlier in the thread doesn’t work anymore with Vanilla’s current version. Using the original code as an inspiration, I made a few changes and it now works. Woot!

First off, I removed the new registration method and stuck with the basic (aka. recaptcha) registration method instead and modified the core scripts for that one.

Here’re the changes I made:

1. In the script applications/dashboard/controllers/class.entrycontroller.php, modify the private function RegisterCaptcha.. add this code right after the first IF statement:

$this->InvitationCode = $this->Form->GetValue('InvitationCode');
$verify = $this->verifyPurchasecode($this->InvitationCode);
if(!$verify['success']){
    $this->UserModel->Validation->AddValidationResult('InvitationCode', T('The provided purchase code is invalid.'));
}

2. Append this function to the end of the entry controller class (same file as above):

    private function verifyPurchasecode($purchasecode) {
        $username = 'ENVATO_USERNAME'; // authors username
        $api_key = 'ENVATO_API_KEY'; // api key from my account area
        $url = "http://marketplace.envato.com/api/edge/$username/$api_key/verify-purchase:$purchasecode.json";
        $ch = curl_init($url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        $json_res = curl_exec($ch);
        $data = json_decode($json_res,true);
        if(!empty($data['verify-purchase'])){
            $data['verify-purchase']['success'] = true;
        }else{
            $data['verify-purchase']['success'] = false;
        }
        return $data['verify-purchase'];
   }

3. Edit the registration view script (or create a new theme then create a registration view script there): applications/dashboard/views/entry/registercaptcha.php and add the necessary input in the form:

      <li>
        <?php
            echo $this->Form->Label('Purchase Code', 'InvitationCode');
            echo $this->Form->TextBox('InvitationCode', array('value' => $this->InvitationCode));
        ?>
      </li>

This works for me in version 2.0.18.2

You’ll have to tailor the registration fields to what you want afterwards :)

33 posts
  • Author Level 7
  • Collector Level 3
  • Elite Author
  • Weekly Top Seller
+5 more
Tricycle
says

Hi Bfintal, thanks for this code for the most recent VF version. I will try it out today and let you know if I get it running.

Best Regards, Oisin

350 posts Gambit
  • 5 Years of Membership
  • Affiliate Level 2
  • Author Level 7
  • Collector Level 4
+6 more
bfintal
says

Cool! Just for reference, here’s my forum where I got it working: http://support.gambit.ph/entry/register

1899 posts Multimedia Artistry
  • Elite Author
  • 4 Years of Membership
  • Freebie
  • Most Wanted Winner
+4 more
dnp_theme
says

Cool! Just for reference, here’s my forum where I got it working: http://support.gambit.ph/entry/register

Awesome!! Thanks!! Will definitly replace my phpBB3 forum with vanilla and your awesome code.

phpBB3 is better but it cannot have Envato verification code and it’s tooooo BIG to manage.

45 posts
  • Collector Level 2
  • Mo Bro
  • 3 Years of Membership
  • United States
premiumwd
says

hey all is it possible to direct me to a wordpress modification so users can register only by the purchase code? I have the api and the file buy I need a little help implementing it and testing it?

Thanks in advance

273 posts The WordPress geeks
  • Beta Tester
  • Community Superstar
  • Elite Author
  • Feedback Guru
+9 more
ThemeFuzz
says

Hi,

If you want a wordpress solution, i recommend you search on codecanyon were you will find an awesome plugin created for the envator authors ( i don’t want to give direct link because i am not allowed :P ).

Best regards, Stefan

by
by
by
by
by
by