From: Steve Sutton Date: Thu, 12 Apr 2018 20:36:36 +0000 (-0400) Subject: Start working on front end form for new member X-Git-Tag: v1.0.0^2~54 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6aeb639247d4d5a8752b3cab39b1c4fa6cfec30f;p=WP-Plugins%2Fglm-member-db-billing.git Start working on front end form for new member Adding new membership form for the front end. Setting up valid action and a shortcode. --- diff --git a/css/front.css b/css/front.css new file mode 100644 index 0000000..5c16336 --- /dev/null +++ b/css/front.css @@ -0,0 +1,91 @@ +/* glm-billing-form */ +.glm-billing-form { + margin: 10px 0; + max-width: 400px; + padding: 20px 12px 10px 20px; + font-size: .813rem; +} +.glm-billing-field { + width: 100%; + padding: 0; + margin: 3px 0 0 0; +} +.glm-billing-label { + width: 100%; + font-weight; bold; + padding: 0; + margin: 7px 0 0 0; +} +.glm-billing-left-half { + width: 49%; + float: left; + margin: 3px 3px 0 0; +} +.glm-billing-right-half { + width: 49%; + float: left; + margin: 3px 0 0 3px; + clear: right; +} +.glm-billing-input { + padding: 3px 0; +} +.glm-billing-input label { + width: 100%; + display: block; +} +.glm-billing-input input[type=text], +.glm-billing-input input[type=date], +.glm-billing-input input[type=datetime], +.glm-billing-input input[type=number], +.glm-billing-input input[type=search], +.glm-billing-input input[type=time], +.glm-billing-input input[type=url], +.glm-billing-input input[type=email], +.glm-billing-input textarea, +.glm-billing-input select{ + height: 2rem; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + border:1px solid #BEBEBE; + padding: 4px; + margin:0px; + -webkit-transition: all 0.30s ease-in-out; + -moz-transition: all 0.30s ease-in-out; + -ms-transition: all 0.30s ease-in-out; + -o-transition: all 0.30s ease-in-out; + outline: none; + width: 100%; +} +.glm-billing-input input[type=text]:focus, +.glm-billing-input input[type=date]:focus, +.glm-billing-input input[type=datetime]:focus, +.glm-billing-input input[type=number]:focus, +.glm-billing-input input[type=search]:focus, +.glm-billing-input input[type=time]:focus, +.glm-billing-input input[type=url]:focus, +.glm-billing-input input[type=email]:focus, +.glm-billing-input textarea:focus, +.glm-billing-input select:focus{ + -moz-box-shadow: 0 0 8px #88D5E9; + -webkit-box-shadow: 0 0 8px #88D5E9; + box-shadow: 0 0 8px #88D5E9; + border: 1px solid #88D5E9; +} +.glm-billing-input table { + width: 100%; +} +.glm-billing-input .price { + width: 50px; + text-align: right; +} +.glm-billing-form fieldset legend { + font-size: 1rem; + font-weight: bold; + margin-top: 2rem; +} + +.glm-billing-form input[type=submit] { + margin-top: 20px; +} diff --git a/models/front/billing/becomeMember.php b/models/front/billing/becomeMember.php new file mode 100644 index 0000000..8d0e66d --- /dev/null +++ b/models/front/billing/becomeMember.php @@ -0,0 +1,141 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ +define('GLM_MEMBERS_BILLING_MEMBER_MENU', true); +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoices.php'; +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/billingSupport.php'; + +class GlmMembersFront_billing_becomeMember // extends GlmDataBilling +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the Billing data class + * + * Note, the third parameter is a flag that indicates to the Contacts + * data class that it should flag a group of fields as 'view_only'. + */ + // parent::__construct(false, false, true); + + } + + public function modelAction($actionData = false) + { + // Initialize Variables Here + $option = ''; + $view = 'becomeMember'; + $management = false; + $messages = array(); + $paymentSuccess = false; + $paymentError = false; + $payable_types = false; + + // Check to see if a user is logged in + // If they are then they should not see the Become a member form at all. + if ( isset( $this->config['loggedInUser'] ) + && isset( $this->config['loggedInUser']['contactUser'] ) + && isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) + ) { + $option = 'alreadyMember'; + } + + // Call in the support class + $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config ); + + if ( isset( $_REQUEST['option'] ) ) { + $option = $_REQUEST['option']; + } + + switch ( $option ) { + case 'alreadyMember': + $view = 'alreadyAMember'; + break; + + default: + $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); + break; + + } + + // Compile template data + $templateData = array( + 'option' => $option, + 'billing_settings' => $this->config['billing_settings'], + 'management' => $management, + 'messages' => $messages, + 'paymentSuccess' => $paymentSuccess, + 'paymentError' => $paymentError, + 'payable_types' => $payable_types, + ); + + // Return status, any suggested view, and any data to controller. + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/billing/'.$view.'.html', + 'data' => $templateData + ); + + } + + +} diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 5aa6d09..0cecf1d 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -96,17 +96,35 @@ $glmMembersBillingShortcodes = array( 'member_id' => false, 'template' => false, ), - ) + ), + 'glm-members-billing-become-member-form' => array( + 'plugin' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'menu' => 'billing', + 'action' => 'becomeMember', + 'table' => false, + 'attributes' => array( + 'member_id' => false, + 'template' => false, + ), + ), ); $glmMembersBillingShortcodesDescription = ' ShortcodeAttributeDescription - - [glm-members-billing-renew-form] -   - - Displays a Membership Renewal Form. - - + + [glm-members-billing-renew-form] +   + + Displays a Membership Renewal Form. + + +ShortcodeAttributeDescription + + [glm-members-billing-become-member-form] +   + + Displays a Become Member Form. + + '; diff --git a/setup/validActions.php b/setup/validActions.php index d0b1626..7469196 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -86,12 +86,12 @@ $glmMembersBillingAddOnValidActions = array( ), 'member' => array( 'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, - // 'index' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, ), ), 'frontActions' => array( 'billing' => array( - 'renew' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'renew' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'becomeMember' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, ), ) ); diff --git a/views/front/billing/alreadyAMember.html b/views/front/billing/alreadyAMember.html new file mode 100644 index 0000000..a789c24 --- /dev/null +++ b/views/front/billing/alreadyAMember.html @@ -0,0 +1,3 @@ +

Sorry!

+

We see you are already logged in as a member.

+ diff --git a/views/front/billing/becomeMember.html b/views/front/billing/becomeMember.html new file mode 100644 index 0000000..afa480c --- /dev/null +++ b/views/front/billing/becomeMember.html @@ -0,0 +1,306 @@ + +

Membership Renewal

+
+ + {if $paymentSuccess}Payment Completed{/if} + {if $paymentError}Error With Payment{/if} + + {if $messages} + {foreach $messages as $message} +
{$message}
+ {/foreach} + {/if} + +
+ + + + +
+
+ Membership Class +
+
+ {foreach $payable_types as $type} + + {/foreach} +
+
+ +
+
+ Total Due +
+
+
+
+
+
+ +
+ Membership Information + +
+
+ First Name +
+
+ +
+
+
+
+ Last Name +
+
+ +
+
+
+
+ Email +
+
+ +
+
+
+
+ Confirm Email +
+
+ +
+
+ +
+
+ Address +
+
+ +
+
+
+
+ City +
+
+ +
+
+
+
+ State / Province +
+
+ +
+
+
+
+ Zip +
+
+ +
+
+
+
+ Email Address +
+
+ +
+
+ +
+ +
+ Payment Options + +
+
+ Select Payment Option +
+
+ + +
+
+ +
+
+ Name on Card +
+
+ +
+
+ +
+
+ Card Type +
+
+ +
+
+
+
+ Card Number +
+
+ +
+
+
+
+ Card Expiration +
+
+ +
+
+
+
+ C V V +
+
+ +
+
+ + {if $billing_settings.proc_methods == 2} +
+
+ You may also have us save your credit card details with our secure credit card processor to + simplify future payments. Doing so will replace any previous credit card details you saved. +
+
+ +
+
+ {/if} + +
+ + + +
+
+ + + +