Skip to content

Commit

Permalink
org.civicrm.volunteer#577 Resolving incorrect backend url generation (#…
Browse files Browse the repository at this point in the history
…607)

* org.civicrm.volunteer#577 Resolving incorrect backend url generation for WP on volunteer/signup page

* Adding volunteer patch to fix WP URL generation bug
  • Loading branch information
shaneonabike authored Aug 27, 2024
1 parent 3e95676 commit 2a3ea23
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CRM/Volunteer/Form/VolunteerSignUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function redirectLegacyRequests() {
if($vid != NULL) {
$path = "civicrm/vol/";
$fragment = "/volunteer/opportunities?project=$vid&dest=event";
$newURL = CRM_Utils_System::url($path, NULL, FALSE, $fragment, FALSE, TRUE);
$newURL = CRM_Utils_System::url($path, NULL, FALSE, $fragment, TRUE, FALSE);
CRM_Utils_System::redirect($newURL);
}
}
Expand Down Expand Up @@ -766,7 +766,7 @@ protected function setDestination() {
$fragment = '/volunteer/opportunities';
}

$this->_destination = CRM_Utils_System::url($path, $query, FALSE, $fragment);
$this->_destination = CRM_Utils_System::url($path, $query, FALSE, $fragment, TRUE, FALSE);
}

/**
Expand Down
12 changes: 9 additions & 3 deletions volunteer.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,22 @@ function _volunteer_civicrm_pageRun_CRM_Event_Page_EventInfo(&$page) {
//VOL-191: Skip "shopping cart" if only one need
if ($openNeeds['count'] == 1) {
$need = $openNeeds['values'][0];
$url = CRM_Utils_System::url('civicrm/volunteer/signup', "reset=1&needs[]={$need['id']}&dest=event");
$url = CRM_Utils_System::url('civicrm/volunteer/signup',
"reset=1&needs[]={$need['id']}&dest=event", // query string
FALSE, // absolute
NULL, // fragment
TRUE, // FrontEnd
FALSE // Backend
);
} else {
//VOL-190: Hide search pane in "shopping cart" for low role count projects
$hideSearch = ($openNeeds['count'] < 10) ? "hideSearch=always" : (($openNeeds['count'] < 25) ? "hideSearch=1" : "hideSearch=0");
$url = CRM_Utils_System::url('civicrm/vol/',
NULL, // query string
FALSE, // absolute?
"/volunteer/opportunities?project={$project->id}&dest=event&{$hideSearch}", // fragment
TRUE, // htmlize?
TRUE // is frontend?
TRUE, // Frontend
FALSE // Backend?
);
}

Expand Down

0 comments on commit 2a3ea23

Please sign in to comment.