Skip to content

Commit

Permalink
Merge pull request #223 from jensscherbl/integration
Browse files Browse the repository at this point in the history
Fix #222, Add Login Filter RE# #44, Remove redirects inside the filters to give all filters a chance to execute
  • Loading branch information
brendo committed Mar 22, 2013
2 parents 7728190 + ae6b253 commit c4a84c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 14 additions & 0 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ public function appendFilter($context) {
__('Members: Update Password')
);
}

if(!FieldManager::isFieldUsed(self::getFieldType('activation'))) {
// Add Member: Login filter
$context['options'][] = array(
'member-login',
in_array('member-login', $selected),
__('Members: Login')
);
}
}

/**
Expand Down Expand Up @@ -1151,6 +1160,11 @@ public function processPostSaveFilter(array &$context) {
if (in_array('member-update-password', $context['event']->eParamFILTERS)) {
$this->getMemberDriver()->filter_UpdatePasswordLogin($context);
}

// Login Member from event
if (in_array('member-login', $context['event']->eParamFILTERS)) {
$this->getMemberDriver()->filter_UpdatePasswordLogin($context);
}
}

/*-------------------------------------------------------------------------
Expand Down
7 changes: 1 addition & 6 deletions lib/member.symphony.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function isLoggedIn() {

public function filter_LockRole(array &$context) {
// If there is a Role field, this will force it to be the Default Role.
if(FieldManager::isFieldUsed($this->section->getFieldType('role'))) {
if(FieldManager::isFieldUsed($this->section->getFieldHandle('role'))) {
// Can't use `$context` as `$fields` only contains $_POST['fields']
if(isset($_POST['id'])) {
$member = parent::fetchMemberFromID(
Expand Down Expand Up @@ -370,10 +370,5 @@ public function filter_UpdatePasswordLogin(array $context) {
$this->section->getFieldHandle($identity) => $context['entry']->getData($this->section->getField($identity)->get('id'), true)->value,
$this->section->getFieldHandle('authentication') => $context['fields'][$this->section->getFieldHandle('authentication')]['password']
), false);

if(isset($_REQUEST['redirect'])) {
redirect($_REQUEST['redirect']);
}
}

}

0 comments on commit c4a84c2

Please sign in to comment.