Tips and tricks
Setup Vanilla Forums With Envato API Purchase Verification
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:
- Download and install latest vanilla forums ( ‘2.0.17.8’ )
- Open _install/conf/config.php and make sure the registration methor line looks like this
$Configuration['Garden']['Registration']['Method'] = 'Basic';
- Open _install/applications/dashboard/views/entry/registerbasic.php and make sure it looks like this
[php]<?php if (!defined('APPLICATION')) exit(); ?> <h1><?php echo T("Apply for Membership") ?></h1> <div class="Box"> <?php $TermsOfServiceUrl = Gdn::Config('Garden.TermsOfService', '#'); $TermsOfServiceText = sprintf(T('I agree to the <a id="TermsOfService" class="Popup" target="terms" href="%s">terms of service</a>'), Url($TermsOfServiceUrl)); // Make sure to force this form to post to the correct place in case the view is // rendered within another view (ie. /dashboard/entry/index/): echo $this->Form->Open(array('Action' => Url('/entry/register'), 'id' => 'Form_User_Register')); echo $this->Form->Errors(); ?> <ul> <li> <?php echo $this->Form->Label('Email', 'Email'); echo $this->Form->TextBox('Email'); echo '<span id="EmailUnavailable" class="Incorrect" style="display: none;">'.T('Email Unavailable').'</span>'; ?> </li> <li> <?php echo $this->Form->Label('Username', 'Name'); echo $this->Form->TextBox('Name'); echo '<span id="NameUnavailable" class="Incorrect" style="display: none;">'.T('Name Unavailable').'</span>'; ?> </li> <li> <?php echo $this->Form->Label('Password', 'Password'); echo $this->Form->Input('Password', 'password'); ?> </li> <li> <?php echo $this->Form->Label('Confirm Password', 'PasswordMatch'); echo $this->Form->Input('PasswordMatch', 'password'); echo '<span id="PasswordsDontMatch" class="Incorrect" style="display: none;">'.T("Passwords don't match").'</span>'; ?> </li> <li> <?php echo $this->Form->Label('Purchase code? <a href="http://farm7.static.flickr.com/6002/5929085164_d858b3f7dc_b.jpg">Find it here</a>', 'DiscoveryText'); echo $this->Form->TextBox('DiscoveryText', array('MultiLine' => FALSE)); ?> </li> <li> <?php echo $this->Form->CheckBox('TermsOfService', $TermsOfServiceText, array('value' => '1')); echo $this->Form->CheckBox('RememberMe', T('Remember me on this computer'), array('value' => '1')); ?> </li> <li class="Buttons"> <?php echo $this->Form->Button('Sign Up'); ?> </li> </ul> <?php echo $this->Form->Close(); ?> </div>[/php]
- Download Purchase Verificator from http://wiki.envato.com/selling/tips-selling/essential-resources-for-marketplace-authors/
- Unpack and edit config.php to match your details
- Open _install/applications/controllers/ and copy both config.php and Envato_marketplaces.php
- Open _install/applications/controllers/class.entrycontroller.php and add at line 806 or so ( function RegisterBasic )
[php]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..'); }[/php]
- All done!
[button link=”http://digitalzoomstudio.net/downloads/vanilla.zip”]Download Customized Version[/button]