Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contribution Pages: alias userID to contactID, fixes org renewal with checksum and mid #22951

Closed
wants to merge 1 commit into from

Conversation

mlutfy
Copy link
Member

@mlutfy mlutfy commented Mar 15, 2022

Overview

Organisational membership renewal is a bit of a challenge. One can send a Scheduled Reminder to the individual related to an organisation, with the checksum/cid of the individual, and if their relationship to the org allows it, they can view the organisation and renew on-behalf.

However, the contribution page does not show any information about the membership being renewed.

Form have a way around that: we can pass the little-known mid URL argument (membership ID), but it only works if the user is logged-in (and not with a checksum). This membershiprenewallink extension by Jaap is pretty useful for that.

Looking at the code, there is a userID and contactID var, with a mysterious comment about it:

"this was used prior to the cleverer this_>getContactID - unsure now"

I can't see a good reason to distinguish between a logged-in user, and a checksum user.

Before

image

Passing the mid as an URL argument will cause a fatal error, because it checks against the $this->_contactID, which is NULL if we used a checksum.

After

Using the mid in the URL, we can now select the membership to renew, and everything works as expected:

image

@civibot
Copy link

civibot bot commented Mar 15, 2022

(Standard links)

@civibot civibot bot added the master label Mar 15, 2022
@mlutfy
Copy link
Member Author

mlutfy commented Mar 15, 2022

@mlutfy
Copy link
Member Author

mlutfy commented Feb 22, 2023

jenkins, test this please

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 6, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 6, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
@eileenmcnaughton
Copy link
Contributor

@mlutfy I took a look at this & put up an alternate proposal that makes it clearer what is being validated where & doesn't leak to the pledge checks... #27013

@mlutfy
Copy link
Member Author

mlutfy commented Aug 9, 2023

@eileenmcnaughton oh.. thanks! I had a quick look, enough to understand that this PR can be closed, but will do more testing.

@mlutfy mlutfy closed this Aug 9, 2023
mlutfy pushed a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 12, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
mlutfy pushed a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 12, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
mlutfy pushed a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 12, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 12, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
larssandergreen pushed a commit to larssandergreen/civicrm-core that referenced this pull request Aug 22, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
larssandergreen pushed a commit to larssandergreen/civicrm-core that referenced this pull request Sep 6, 2023
This is a reviewer response to civicrm#22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants