Skip to main content
added 469 characters in body
Source Link
Patrick Kenny
  • 29.4k
  • 19
  • 139
  • 316

For example, consider a dating website. Each user has an Age stored in their profile. They also have a Max age and Min age, which are the maximum and minimum ages of people they hope to receive interest from (in other words, users with ages outside the range Min age - Max age should not be allowed to contact that user).

How can I build a page in Views that filters the results for the current user to only show other users that both meet the current user's age range and for which the current user falls under the Max age and Min agemeets their age ranges? (In

In other words, I need to only show users for whichsomehow filter the current user is a potential match)results like this:

  • Only show users that have ages within the range of the current user's Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users from 18-25)
  • Only show users for which the current user has an age that falls within the range of their Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users who want to receive messages from someone age 20)

Is this something I can somehow do with contextual filters, or do I need to write my own custom filter?

For example, consider a dating website. Each user has an Age stored in their profile. They also have a Max age and Min age, which are the maximum and minimum ages of people they hope to receive interest from (in other words, users with ages outside the range Min age - Max age should not be allowed to contact that user).

How can I build a page in Views that filters the results for the current user to only show users for which the current user falls under the Max age and Min age? (In other words, to only show users for which the current user is a potential match)

Is this something I can somehow do with contextual filters, or do I need to write my own custom filter?

For example, consider a dating website. Each user has an Age stored in their profile. They also have a Max age and Min age, which are the maximum and minimum ages of people they hope to receive interest from (in other words, users with ages outside the range Min age - Max age should not be allowed to contact that user).

How can I build a page in Views that filters the results for the current user to show other users that both meet the current user's age range and for which the current user meets their age ranges?

In other words, I need to somehow filter the results like this:

  • Only show users that have ages within the range of the current user's Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users from 18-25)
  • Only show users for which the current user has an age that falls within the range of their Max age and Min age (example: current user is 20 and wants to see users from 18-25; filter to show users who want to receive messages from someone age 20)

Is this something I can somehow do with contextual filters, or do I need to write my own custom filter?

Source Link
Patrick Kenny
  • 29.4k
  • 19
  • 139
  • 316

How can I filter users within a user-configurable range in Views?

For example, consider a dating website. Each user has an Age stored in their profile. They also have a Max age and Min age, which are the maximum and minimum ages of people they hope to receive interest from (in other words, users with ages outside the range Min age - Max age should not be allowed to contact that user).

How can I build a page in Views that filters the results for the current user to only show users for which the current user falls under the Max age and Min age? (In other words, to only show users for which the current user is a potential match)

Is this something I can somehow do with contextual filters, or do I need to write my own custom filter?