1
sceilig
Displaying values from a Multiple select box (combobox)
  • 2006/5/10 21:18

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I added a multi selectbox in Extended Profiles for users and then wanted to display the selected values on the user's profile page. I dont have any problem looping through users and displaying all other data but because of the way XOOPS handles multiple select boxes in the database, I dont know what XOOPS class or function I should use to extract and display this data.

Say if I have a field called user_category and the values are:
-- committee member
-- board member
-- staff member

And a user can be part of all 3 categories.

Here is how XOOPS stores this data for this field:
a:2:
{i:0;s:1:"2";i:1;s:1:"1";}

I just dont understand the syntax being used here. Is there any documentation or is there a XOOPS function I can use to extract the info and display it as this for a user:
User Category: committee member, staff member

2
sceilig
Re: Displaying values from a Multiple select box (combobox)
  • 2006/5/16 6:26

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I find it frustrating to try and develop modules in XOOPS since the documentation about what classes and functions to use is just not available, and the support forums dont work too well in providing answers to these questions.

Anyway after some trawling other modules I found this answer to my own question, in case others stumble across this issue.

If you have a multiselect field (called say member_category) in extended profiles and you want to access the values of that field for a specific user.

Quote:

$member_handler =& xoops_gethandler('member');
$thisUser =& $member_handler->getUser($uid);

$profile_handler =& xoops_gethandler('profile');
$fields =& $profile_handler->loadFields();
$categoryarray = $fields['member_category']->getOutputValue($thisUser));

print_r($categoryarray);


I think not having easy access to info on what XOOPS classes to use means modules can end up not being created as efficiently.

Login

Who's Online

292 user(s) are online (220 user(s) are browsing Support Forums)


Members: 0


Guests: 292


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits