Skip to content

Commit

Permalink
Added Founding Member field everywhere necessary. (#128)
Browse files Browse the repository at this point in the history
* Adding founding member to display

* Debug

* Debug

* Removed debug text and added fontawesome

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Bugfixing

* Added admin edit for founding member

* Fixed style issue

* Fixing false issues
  • Loading branch information
cmowenby authored Apr 17, 2017
1 parent a16113b commit 03e17e7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
$personalEmail = $user->getEmails()[0]['address'];
$dm_email = $user->getPrimaryEmail();

$founding_bool = boolval($user->getCustomSchemas()['roles']['founding-member']);

$founding_true_check = $founding_bool ? 'checked="checked"' : '';
$founding_false_check = !$founding_bool ? 'checked="checked"' : '';

function isSelected($option, $target) {
if ($option == $target) {
echo "selected";
Expand Down Expand Up @@ -79,6 +84,13 @@ <h3 class="panel-title mas-title">Update Member</h3>
<input type="date" name="subscriptionExp" class="form-control" value= <?php echo $expDate; ?> >
</div>

<div class="form-group">
<label for="foundingTrue" class="control-label">Founding Member</label>
<br>
<input type="radio" id="foundingTrue" <?php echo $founding_true_check ?> value="true" name="founding"> True<br>
<input type="radio" id="foundingFalse" <?php echo $founding_false_check ?> value="false" name="founding"> False
</div>

<input type="hidden" name="action" value="update_member">
<input type="hidden" name="username" value="<?php echo $user->getPrimaryEmail();?>">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@
date_default_timezone_set('EST');
$creation_string = date("m-d-Y", $creation_time);

$founding_bool = boolval($user->getCustomSchemas()['roles']['founding-member']);
$founding_member = $founding_bool ?
'<i class="fa fa-check" aria-hidden="true"><span style="display: none">1</span></i>' : '<i class="fa fa-times" aria-hidden="true"><span style="display: none">0</span></i>';

$pass_filter =
(!isset($_GET["before"]) || $creation_time <= strtotime($_GET["before"])) &&
(!isset($_GET["since"]) || $creation_time >= strtotime($_GET["since"])) &&

// TODO Add founding member check
(!isset($_GET["founding"]) || true) &&
(!isset($_GET["founding"]) || (strtolower($_GET["founding"]) == ($founding_bool ? "true" : "false"))) &&

(!isset($_GET["type"]) || $_GET["type"] == $type) &&
(!isset($_GET["status"]) || $_GET["status"] == $status);
Expand All @@ -56,6 +59,7 @@
<td>$type</td>
<td>$status</td>
<td>$creation_string</td>
<td>$founding_member</td>
</tr>
END;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<th>Membership Plan</th>
<th>Subscription Status</th>
<th>Member Since</th>
<th>Founding Member</th>
</tr>
</thead>
<tbody>
Expand Down
3 changes: 3 additions & 0 deletions mas.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ function mas_admin_enqueue_styles($hook) {
return;
}

// FontAwesome
wp_enqueue_style( 'fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');

// Bootstrap
wp_enqueue_style( 'bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');

Expand Down
2 changes: 2 additions & 0 deletions postable/admin-member-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function prefix_admin_update_member() {
$rfidNumber = $_POST['rfidNumber'];
$subscriptionType = $_POST['membershipPlan'];
$subscriptionExpiry = $_POST['subscriptionExp'];
$founding_member = $_POST['founding'];

if ($subscriptionType === 'none') {
$subscriptionType = '';
Expand All @@ -31,6 +32,7 @@ function prefix_admin_update_member() {

$properties['customSchemas']['Subscription_Management']['Subscription_Type'] = $subscriptionType;
$properties['customSchemas']['roles']['rfid-id'] = $rfidNumber;
$properties['customSchemas']['roles']['founding-member'] = $founding_member == "true";
if (!empty($subscriptionExpiry)) {
$properties['customSchemas']['Subscription_Management']['Subscription_Expiration'] = $subscriptionExpiry;
}
Expand Down

0 comments on commit 03e17e7

Please sign in to comment.