1659 posts Building the Web.
  • Has been a beta tester for an Envato feature
  • Sells items exclusively on Envato Market
  • Has sold $250,000+ on Envato Market
  • Had an item featured on Envato Market
+7 more
ZoomIt says

Ok, ok.. don’t get excited: it’s not a plugin :(, it’s a core modification, but it works. Tried the plugin way but there are not many / none good resources on the internet about Vanilla Addons, so would have taken me much more if it was even possible.

Enough talk:
  1. Download and install latest vanilla forums ( ’2.0.17.8’ )
  2. Open _install/conf/config.php and make sure the registration methor line looks like this
    $Configuration['Garden']['Registration']['Method'] = 'Basic';
  3. Open _install/applications/dashboard/views/entry/registerbasic.php and make sure it looks like this -> http://pastie.org/2404174
  4. Download Purchase Verificator from http://wiki.envato.com/selling/tips-selling/essential-resources-for-marketplace-authors/
  5. Unpack and edit config.php to match your details
  6. Open _install/applications/controllers/ and copy both config.php and Envato_marketplaces.php
  7. Open _install/applications/controllers/class.entrycontroller.php and add at line 806 or so ( function RegisterBasic )
             require dirname(__FILE__).'/Envato_marketplaces.php';
        require dirname(__FILE__).'/config.php';
    
        $e = new Envato_marketplaces();
        $e->set_api_key($config['api_key']);
            $v = $e->verify_purchase($config['username'],$_POST['User/DiscoveryText']);
            if(!isset($v->buyer)){
                die('Press Back Button and enter the correct purchase code..');
            }
  8. All done!

Demo ( setup in my forums ) -> http://bit.ly/q9fhre

Download link to the already customised package -> http://bit.ly/mX527H

973 posts
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
aaranmcguire says

I dont get what this is?

160 posts
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Interviewed on an Envato blog
  • Had an item featured in an Envato Bundle
+6 more
jordie says
aaranmcguire said
I dont get what this is?

Vanilla is a forum software package you can put on your website. The modification ZoomIt shows here allows you to create a customers only forum which only lets people view/post to the forum if they’ve been verified with Envato that they have infact made a purchase from you.

Pretty neat actually! I was thinking about opening up some forums, so I’ll bookmark this for later. :)

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says

That looks great! I’m going to bookmark this and give it a try sometime. :)

438 posts
  • Has been part of the Envato Community for over 4 years
  • Sells items exclusively on Envato Market
  • Located in United States
christopherjon says

coolies!

Now, can we get this for bbpress?

:)

2042 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Provided great feedback to improve the user experience on Envato Market
  • Interviewed on an Envato blog
+9 more
revaxarts says

I was searching in the past for such a solution and came up with this:

  1. add a new registration method to the list:
    open the applications/dashboard/class.settingscontroller.php file and add followin line to the RegistrationMethods array (around line 630):
    'Purchasecode' => "New users need an Envato purchase code." 
    
  2. now modify the applications/dashboard/class.entrycontroller.php:
    Add this new private function:
    private function RegisterPurchasecode($InvitationCode) {
      if ($this->Form->IsPostBack() === TRUE) {
         $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.'));
         }
         // Add validation rules that are not enforced by the model
         $this->UserModel->DefineSchema();
        // $this->UserModel->Validation->ApplyRule('Name', 'Username', $this->UsernameError);
         $this->UserModel->Validation->ApplyRule('TermsOfService', 'Required', T('You must agree to the terms of service.'));
         $this->UserModel->Validation->ApplyRule('Password', 'Required');
         $this->UserModel->Validation->ApplyRule('Password', 'Match');
         // $this->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge');
    
         try {
            $Values = $this->Form->FormValues();
            unset($Values['Roles']);
            $AuthUserID = $this->UserModel->Register($Values);
    
            if (!$AuthUserID) {
               $this->Form->SetValidationResults($this->UserModel->ValidationResults());
            } else {
               // The user has been created successfully, so sign in now.
               Gdn::Session()->Start($AuthUserID);
               if ($this->Form->GetFormValue('RememberMe'))
                  Gdn::Authenticator()->SetIdentity($AuthUserID, TRUE);
    
               $this->FireEvent('RegistrationSuccessful');
               $this->UserModel->SendWelcomeEmail($AuthUserID, '', 'Register');
               // ... and redirect them appropriately
               $Route = $this->RedirectTo();
               if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
                  $this->RedirectUrl = Url($Route);
               } else {
                  if ($Route !== FALSE)
                     Redirect($Route);
               }
            }
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
      } else {
         $this->InvitationCode = $InvitationCode;
      }
      $this->Render();      
    }
    
    
    and this one:
       private function verifyPurchasecode($purchasecode) {
            $username = 'YOUR_ENVATO_USERNAME'; // authors username
            $api_key = 'YOUR_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'];
       }
    
    
    (courtesy dtbaker)
  3. Let’s add the “view” for this: create a new file: applications/dashboard/views/entry/registerpurchasecode.php or themes/YOUR_THEMENAME_/views/entry/registerpurchasecode.php
    This contains the HTML of the registrations Form. Copy the content from the applications/dashboard/views/entry/registerbasic.php and append or prepend this to the list:
    <  li   >
       &lt;?php echo $this?&gt;Form->Label('Purchase Code', 'InvitationCode');
          echo $this->Form->TextBox('InvitationCode', array('value' => $this->InvitationCode));
       ?&gt;
    < /li >
    
  4. Now you have access to a new registration mode in the dashboard

I did this with vanilla 2.18.2b: http://rxa.li/support

Unfortunately it’s not possible to wrap it in a plugin and you can’t “simple” update your forum. But I guess repeating these steps will do it. At least you can switch back to “normal” registration mode any time

3085 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Interviewed on an Envato blog
+6 more
Raincutter says

Been looking for something like this since quite some time. Will be trying it quite soon. Thanks much revaxarts.

118 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 50+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ZenThemes says

Now that’s pure masterclass :-) I’ve been looking for something like this for quite some time.

Well done mates!

567 posts
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
radykal says

@ revaxarts

I tried your solution. It´s working but without the new registerpurchasecode.php. I put the code in registerbasic.php, so I think you forgot to mention how to tell the registration which form to select?!

You know what I mean??

2042 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Provided great feedback to improve the user experience on Envato Market
  • Interviewed on an Envato blog
+9 more
revaxarts says
radykal said
@ revaxarts

I tried your solution. It´s working but without the new registerpurchasecode.php. I put the code in registerbasic.php, so I think you forgot to mention how to tell the registration which form to select?!

You know what I mean??

In my case it uses the RegisterPurchasecode method because is choose the Purchasecode option at the dashboard > registrations. If the file registerpurchasecode.php exists it will use this one.

All other registration methods work the same way (i think ;) )

by
by
by
by
by
by