Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Custom Profile Field Display Blows Up
Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 1:13 pm

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?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 9, 2015 - 1:28 pm

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...

andy-signature.png
YELLOW
SWORDFISH
Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 2:09 pm

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. :-)

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 9, 2015 - 3:20 pm

... 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

andy-signature.png
YELLOW
SWORDFISH
Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 3:33 pm

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!

Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 3:44 pm

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?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 9, 2015 - 4:44 pm

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...

andy-signature.png
YELLOW
SWORDFISH
Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 4:58 pm

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!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 9, 2015 - 5:07 pm

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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
RickyMcG
Member
Free Members
sp_UserOfflineSmall Offline
Feb 9, 2015 - 7:26 pm

Done and done. Thanks so much for your help!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625