Forum Replies Created
-
Hi Prashant,
So got it to work as follow:
<?php $data = bp_get_member_profile_data( 'field=Expertise' ); ?><?php $exp = array_map('trim',array_filter(explode(',',$data))); ?>
<?php for ($x = 0; $x < count($exp); $x++ ) : ?>
<?php echo ''.$exp[$x].''; ?> ,
<?php endfor;?>
Your code did help so thank you very much!
Greetz!
Hi,
Yes this gives a Link but it wraps all the data in 1 link. I need them to be SEPARATELY so people can search individually. For example a person has 4 Expertises like; API planning, APO, Product launching, Product transfer. I want them to be able to click on “API planning” or “APO”. This because other people with the same expertise, for example “APO”, wil be listed. Many people have many Expertise and they are separated with a comma (,).
Maybe this can be made possible by splitting the &data when there’s a comma. I think it’s also important to add “+” where theres a space for the URL Link to work, for example “API planning” should be “API+planning” on the URL link.
Thx!
Hi Prashant, I should have maybe started with listing following information:
1. Which version of WordPress are you running?
WordPress 4.9.82. Did you install WordPress as a directory or subdomain install?
Subdomain4. Did you upgrade from a previous version of WordPress? If so, from which version?
I installed the latest.5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting.
Yes6. Which version of BP are you running?
Latest Version 3.2.07. Did you upgraded from a previous version of BP? If so, from which version?
No8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones?
BuddyDrive, Custom Profile Filters for BuddyPress, Gravity Forms, K Elements, Really Simple SSL, rtMedia for WordPress, BuddyPress and bbPress, Slider Revolution, What The File,
WPBakery Page Builder9. Are you using the standard WordPress theme or customized theme?
Customized.10. Which theme do you use ?
Kleo Theme from seventhqueen11. Have you modified the core files in any way?
Yes I have, but always in the child-theme.12. Do you have any custom functions in bp-custom.php?
Yes
<?php
// hacks and mods will go here
define( 'BP_DEFAULT_COMPONENT', 'profile' );?>
15. Which company provides your hosting?
CompbellSo to answer your other questions, I added a new Profile Field with checkboxes. Indeed you have to select it and that’s why I can’t just wrap it in an anchor tag because I need the fields to be clickable separately.
In Profile fields the Expertises are individually links. In my Members page all the Expertises ar put in a Paragraph. But I’d like them to be individual links such as in Profile page.
See Screencast here: https://screencast-o-matic.com/watch/cF6QiCYqw6
Thx!
Not really the issue. My field type gets printed without problem.
I just would like them to have the same output as the profile-loop.php provides. So the link that redirects you to the Search page that shows all the people with the same field type.
This function
bp_the_profile_field_value()
should have some code written to build that URL link.Thx!
No my code is from the file member-header.php * Buddypress – Users Header.
What you sent me is from * Groups Home.This would be my code: https://pastebin.com/ck2wDwE2
Thx!
Not really the solution because I stumble again with the (‘) cutting in my php code.
I’m actually trying this:
But this is the result:
As you can see it works but the fields from “Expertise” are being printed before the <p></p> tags. I would like them to be printed inside the <p></p> tags.
Thx!
Not working yet.. What can be the issue?
Hi!
So I added it everywhere possible as seen here:
I think there’s no CSS hiding it. Even if there was it should print something when inspecting the elements right?
Thx!
Hi!
Well the class is now being displayed but the output from
bp_member_profile_data('field=Expertise')
is not printed within the <p>. It prints before the <div> and it’s now floating around.Other solutions?
Thx!
Hi!
I’ve added it before and after but it still doesn’t work.
What’s the next step?
Thx!
Hi!
Where can I find the function that creates the URL link from the giving field?
So what I mean is that in the file profile-loop.php the Field is loaded as a link just by adding
<dd><?php bp_the_profile_field_value(); ?></dd>
to it.This outputs the following code in my webpage
<dd><p>Change Control</p></dd>
So I’m wondering where this output is being set? If I have that I can hopefully add it to my members-loop.php
Thx!
Awesome this works! But now I lost the (“) to use in my class naming? How can still implement this?
Actually my html is not being read so my php output just comes as a block text.
Thx!
Hi,
I’m adding this after that line but it still does not appear. I’m inspecting the code when reloading and there’s nothing there. Indeed with some CSS I can place it right where I want it but it has to appear first.
Any other solutions?
Thx!
Does not work. I think it’s because de line I’m writing is within an echo already.
Full code:
<?php
/**
* Buddypress Members masonry
*
*
* @package WordPress
* @subpackage K Elements
* @author SeventhQueen <themesupport@seventhqueen.com>
* @since K Elements 1.0
*/$output = '';
extract(
shortcode_atts( array(
'type' => 'newest',
'member_type' => 'all',
'number' => 12,
'class' => '',
'rounded' => "rounded",
'avatarsize' => '',
'width_height' => '',
'online' => 'show'
), $atts )
);
//var_dump($avatarsize);$params = array(
'type' => $type,
'scope' => $member_type,
'per_page' => $number
);
if ($rounded == 'rounded') {
$rounded = 'rounded';
}$avatarquery = '';
if( $avatarsize == 'large' ) {
$avatarsizewh = explode( 'x', $width_height );
if( isset( $avatarsizewh[0] ) && isset($avatarsizewh[1] ) ) {
$avatar_width = $avatarsizewh[0];
$avatar_height = $avatarsizewh[1];
$avatarquery = 'type=full&width='.$avatar_width.'&height='.$avatar_height.' ';
}
}if ( function_exists('bp_is_active') ) {
if ( bp_has_members( $params ) ){
ob_start();
echo '<div class="wpb_wrapper">';
echo '<div id="members-dir-list" class="members dir-list">';
echo '<ul id="members-list" class="item-list row kleo-isotope masonry '.$class.'">';while( bp_members() ) : bp_the_member();
echo '<li class="kleo-masonry-item">'
.'<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">'
.'<div class="item-avatar '.$rounded.'">'
.''. bp_get_member_avatar($avatarquery) . kleo_get_img_overlay() . '';
if ($online == 'show') {
echo kleo_get_online_status(bp_get_member_user_id());
}
echo '</div>'.'<div class="item">
<div class="item-title">'
.''. bp_get_member_name() . '
</div><div class="item-meta"><p">
<?php echo bp_member_profile_data('field=Expertise'); ?>
</p></div><div class="item-meta">
<span class="activity">'.bp_get_member_last_active().'</span></div>';
if ( bp_get_member_latest_update() ) {
echo '<span class="update"> '. bp_get_member_latest_update().'</span>';
}do_action( 'bp_directory_members_item' );
echo '</div>';
echo '<div class="action">';
do_action( 'bp_directory_members_actions' );
echo '</div>';echo '</div><!--end member-inner-list-->
';
endwhile;echo '';
echo '</div>';
echo '</div>';
$output = ob_get_clean();
}}
else
{
$output = __("This shortcode must have Buddypress installed to work.","k-elements");
}So I actually found it but my code is not working. I’m having some issue with the php inline with html.
The file is kleo_bp_members_masonry.php and the code that I need to work is:
<div class="item-meta"><p> ' . bp_member_profile_data('field=Expertise') . '</p></div>
So the problem here is the mark (‘) that stops my php code but I need it here to show the specified profile field (Expertise) and using (“) does not help.
How can I fix this?
Found it thanks!