Support Forum

Custom Profile Field Display Blows Up

RI RickyMcG
RickyMcG
Member

Hi. I added a custom profile field. Display works fine when a member has actually added some values, but is blowing up when the values haven’t been touched.

Warning: implode(): Invalid arguments passed in /problem-with-post-edit-buttonome/m0nst3r/public_html/wp-content/sp-resources/forum-plugins/custom-profile-fields/template-tags/sp-custom-profile-fields-display-tag.php on line 28

As much as I tried to trap for null values, my PHP is a bit too rusty for that.

Help?

10 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Odd. I can’t reproduce this error.

Can you tell me where you are displaying this exactly and what values you have put un the list type custom profile field?

And if you saw that warning text on the display you really do need to get the php ini to stop displaying messages to the screen which is real bad…

RI RickyMcG
RickyMcG
Member

Attempting to display them on spProfileShow.php

# show profile info
sp_ColumnStart('tagClass=spProfileShowInfoSection spRight&width=65%', 'profileInfo'); sp_ProfileShowDisplayName('', __sp('Username'));
sp_ProfileShowFirstName('', __sp('First Name'));
sp_ProfileShowLastName('', __sp('Last Name'));
sp_ProfileShowLocation('', __sp('Location'));
sp_ProfileShowWebsite('', __sp('Website'));
sp_ProfileShowBio('', __sp('Bio'));
// MOD - SHOW PURCHASES //
echo '<div class="spColumnSection spProfileLeftCol"><p>Products:</p></div>';
echo '<div class="spColumnSection spProfileSpacerCol"></div>';
echo '<div class="spColumnSection spProfileRightCol">';
echo '<p>' . sp_CustomProfileFieldsDisplay('Purchases', $spProfileUser->ID) . '</p></div>';
sp_ColumnEnd('', 'profileInfo');

Re: PHP ini, good thought. It’s no biggie now, since I’m just setting things up … but I bet I’d forget. :-)

YS Yellow Swordfish
Yellow Swordfish
Member

… and the values you set up?

By the way – if you have updated the custom profile fields plugin to the latest version (released yesterday) you can remove all of that code and replace it with the single line:

sp_CustomProfileFieldsProfileDisplay('Purchases', $spProfileUser->ID, 'Purchases');

which will do all of the formatting and div creation for you. Actually as it handles the list type slightly differently it might be useful to know if this works without the warning… But would still like to see the values you used exactly so I can test with them

RI RickyMcG
RickyMcG
Member

Thanks! Had the new plugin. Just updated the code: works like a charm!

My guess is there’s a compatibility issue with the old code and the new plugin?

Values: The Big Deck, The Little Deck, The Expansion Pack

(It’s for a card game, if you haven’t guessed. :-)

Much obliged for your quick assistance!

RI RickyMcG
RickyMcG
Member

One more small nit: while I’m on the profile screen…

The Bio text section is adding a blank paragraph prior to the bio text itself, causing the text to display one line lower than the “Bio:” label.

Here’s the output from dev tools…

<div class=”spColumnSection spProfileRightCol”><p class=”spProfileShowBio”></p><p>Creator of Catalyst Cards, founder of Dangerous Kitchen, strategic facilitator and cartoonist in Atlanta, GA.</p>
<p></p></div>

From what I see of the other divs on the page (username, etc.), it looks like the text content is supposed to be inside that “spProfileShowBio” div, yes?

YS Yellow Swordfish
Yellow Swordfish
Member

Now that is really spooky! I couldn’t replicate your error with  my own data but CAN with your values. And there is nothing wrong with the values so who knows! I will write up an error report to get it cleaned up however. And thanks for the confirmation that things are fine using the new function.

Ok – I can see why the Bio is like it is. I am unsure why this seems to have only recently started so will need to dig a bit. I CAN offer you a temporary fix iff you feel like editing a code file – a pretty simple edit. But this wont be a proper fix – just a  workaround for now…

RI RickyMcG
RickyMcG
Member

Odd. Must be aliens. ;-)

OK. A simple workaround for now might be good. Shoot it over and I’ll see if I can NOT break things.

Thanks again!

YS Yellow Swordfish
Yellow Swordfish
Member

Real simple change.

The file you need to edit is at /simple-press/sp-api/sp-api-class-user.php

Starting fron the bottom of the file and working up you should quickly find a function named:

spUser_build_filter_list()

and if you look down the array list you will find an entry for ‘description’. This is set to ‘text’. Change ‘text’ to ‘title’ and it should correct the issue.