Skip Navigation

[Resolved] Displaying content based on Buddypress profile options

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 5 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1362823

Hi there,

I'm trying to build an alogrithm that displays certain content based on information stored in a Buddypress profile. For example, if a user selects certain options, it displays content based on those options.

Do you have any idea how to do this?

#1363003

Hello, I'm not a Buddypress expert so I'm not really sure how to access profile information from their system. That's something you would need to ask their support team about. What I can show you is how to use conditional HTML in Toolset to show and hide content based on other data conditions.
So let's say you're able to access a piece of Buddypress information with a shortcode like this:

[buddypress field="some-field-slug"][/buddypress]
[php]
You know that field holds a numeric value of 1, 2, 3, 4, or 5. If the field holds a value of 3 or lower, you want to display a welcome message. If the field holds a value of 4 or higher, you want to display a warning message. Here's how that could look:
[php]
[wpv-conditional if="( '[buddypress field="some-field-slug"][/buddypress]' lt '4' )"]
 Welcome to the site!
[/wpv-conditional]

[wpv-conditional if="( [buddypress field="some-field-slug"][/buddypress] gte '4' )"]
 Warning! Your subscription is about to expire.
[/wpv-conditional]

These are just examples, again, I'm not sure how to get information out of BuddyPress. We have more information about conditional HTML available here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/