Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Compatible Plugins › BuddyPress › Display PMP Pro Level on BP Member Directory Cards
- This topic has 9 replies, 2 voices, and was last updated 5 years, 7 months ago by Joss.
-
AuthorPosts
-
JossParticipant@joss
- 34 Topics
- 85 Posts
Hi,
You gave me a code snippet to display Member Type and City on BP Member Directory Cards last week.
I found another solution to display city on card profile, now I would like to display Paid Membership Pro Level, can you modify your code bellow to display PMP Pro Level on BP Member Directory Cards and Profile…?
Thanks a lot,
Joss/* YOUR CODE */
add_action( ‘gwangi_buddypress_member_xprofile_custom_fields’, ‘gwangi_buddypress_member_type’, 10 );
add_action( ‘gwangi_buddypress_member_xprofile_custom_fields’, ‘gwangi_buddypress_member_type’, 10 );function gwangi_buddypress_member_type() {
if ( bp_is_user() ) {
$user_id = bp_get_displayed_user()->id;
}
else {
$user_id = bp_get_member_user_id();
}$member_type_name = bp_get_member_type( $user_id );
$member_type = bp_get_member_type_object( $member_type_name );
?>
<div class=”bp-member-xprofile-custom-field bp-member-type”><?php echo $member_type->labels[‘singular_name’]; ?></div>
<?php
}if ( ! function_exists( ‘gwangi_bp_xprofile_location_member_location’ ) ) :
/**
* Print the HTML for BP xProfile Location Field in the BP Member Directory.
*
* @since 1.1.9
*/
function gwangi_bp_xprofile_location_member_location() {
if ( function_exists( ‘xprofile_get_field_data’ ) ) :
$location = xprofile_get_field_data( ‘Mon adresse’, bp_get_member_user_id() );
$allowed_html = array(
‘a’ => array(
‘href’ => array(),
‘rel’ => array(),
),
);if ( ! empty( $location ) ) :
$location_parts = explode( ‘, ‘, $location );
if ( ! empty( $location_parts[1] ) ) : ?>
<div class=”bp-member-xprofile-custom-field bp-member-location”><?php echo wp_kses( $location_parts[1], $allowed_html ); ?></div>
<?php
endif;
endif;
endif;
}
endif;February 20, 2019 at 17:00 #5412@themosaurus- 1 Topics
- 1675 Posts
Hi @joss,
Unfortunately, your request is outside the scope of the support that we can provide for our theme. It’s more a customization request than a simple fine tuning of a function that we’ve created for our theme.
Please also note that this issue is related with the use of Paid Memberships Pro, not with the use of your theme. It’s best if you try to reach the plugin authors as they will be more informed and better suited to help you.
To go further, we invite you to post your request on their support forums:
To help you to quickly add this feature to the member cards and profiles, we recommend that you ask the PMPro support team to give the function to hook to the following theme action:
gwangi_buddypress_member_xprofile_custom_fields
.We remain available for all support requests related with the use of your theme.
Best,
February 21, 2019 at 13:57 #5430JossParticipant@joss- 34 Topics
- 85 Posts
Hi,
It’s YOUR code snippet !!
You don’t want to modify it ?
Yet I’m sure you have the skills to do that…
add_action( 'gwangi_buddypress_member_xprofile_custom_fields', 'gwangi_buddypress_member_type', 10 ); function gwangi_buddypress_member_type() { if ( bp_is_user() ) { $user_id = bp_get_displayed_user()->id; } else { $user_id = bp_get_member_user_id(); } $member_type_name = bp_get_member_type( $user_id ); $member_type = bp_get_member_type_object( $member_type_name ); ?> <div class="bp-member-xprofile-custom-field bp-member-type"><?php echo $member_type->labels['singular_name']; ?></div> <?php } if ( ! function_exists( 'gwangi_bp_xprofile_location_member_location' ) ) : /** * Print the HTML for BP xProfile Location Field in the BP Member Directory. * * @since 1.1.9 */ function gwangi_bp_xprofile_location_member_location() { if ( function_exists( 'xprofile_get_field_data' ) ) : $location = xprofile_get_field_data( 'Location', bp_get_member_user_id() ); $allowed_html = array( 'a' => array( 'href' => array(), 'rel' => array(), ), ); if ( ! empty( $location ) ) : ?> <div class="bp-member-xprofile-custom-field bp-member-location"><?php echo wp_kses( $location, $allowed_html ); ?></div> <?php endif; endif; } endif;
February 21, 2019 at 14:36 #5435@themosaurus- 1 Topics
- 1675 Posts
Hi @joss,
Yes, we do have the skills to change this. However, we don’t have the knowledge required to display this PMPro info… And we don’t know which function to use as this request is not related with the use or fine tuning of our product, but pretty much with the improvement of your PMPro experience.
So, it’s best if you try to reach the plugin authors as they will be more informed and better suited to help you.
We remain available for all support requests related with the use of your theme.
Best,
February 21, 2019 at 14:48 #5436@themosaurus- 1 Topics
- 1675 Posts
Please also note that you don’t need to edit our snippet to achieve this as we recommend to add a new function to the following theme action:
gwangi_buddypress_member_xprofile_custom_fields
.Best,
February 21, 2019 at 14:49 #5437JossParticipant@joss- 34 Topics
- 85 Posts
Hi,
I seemed to have answered this conversation…Look at the reply of PMP Pro support :
—
“Hello. Since I’m unfamiliar with the theme specifics, I can give an overview on how to access a users membership level, and level description. Your theme developer should be able to then assist with having it actually display in their theme.First, we need to get the members membership level. This can be done using the function pmpro_getMembershipLevelForUser():
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/functions.php#L1693
$level = pmpro_getMembershipLevelForUser();
The $level is a PHP object and contains the necessary information. You can access the level name as $level->name and the description is $level->description.”
—Can you make me this code snippet now ?
Thanks,
JossFebruary 26, 2019 at 21:33 #5592@themosaurus- 1 Topics
- 1675 Posts
Hi @joss,
We really appreciate the way that you value our coding skills. However, your request doesn’t imply any correction of our codebase, like when we shared the snippet to change the display of xProfile fields for instance. You’re expecting the addition of a new feature…
You can either ask us to move this request to our “Feature Request” forum. In this case, we’ll implement this feature in a coming update if other Gwangi users show interest for this.
If you’re in a hurry, we recommend you try to reach MeshPros and request a customization quote:
These guys are the author of Match me for BuddyPress, a plugin that recommended to provide the matchmaking feature to your website. You might be already using it. They’ve quite a lot of experience with WordPress and BuddyPress development and might be better suited to help you.
If you’re on a tight budget, we recommend you to require the services from Envato Studio freelancers (https://studio.envato.com/explore/websites-programming). This web platform gives you access to developers who have already experience with theme customizations, and for very competitive prices.
Best,
March 4, 2019 at 15:50 #5646 -
AuthorPosts
You must be logged in to reply to this topic.