I've got a custom profile field for the users to put their Xbox Live gamertag into. Then on memberlist.php I made it to display their Xbox Live Gamercard instead of just the gamertag. The problem is when they have a space in their gamertag it wont render the card, it give an error. This is because Xbox Live requires them to have %20 to fill in the spaces, now what can I do to make it render as %20 instead of space? This is with phpBB 3(.3, I think)
Could you show me how to write that? I'm unfamiliar with PHP for the most part and am more of a HTML/CSS fella. Thanks.
If you're going to use a site. At least your www.PHP.net $gamertag = urlencode($gamertag); I don't know your variable name, but there's a guess. Dan
// Custom Profile Fields $profile_fields = array(); if ($config['load_cpf_viewprofile']) { include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $cp = new custom_profile(); $profile_fields = $cp->generate_profile_fields_template('grab', $user_id); $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); } Code (markup): I believe this is what I need to parse it into urlencode, or should I make it's own variable somehow.... hmmm?
Ok I changed my mind, here's the code you really need: // Go through the fields in correct order foreach (array_keys($this->profile_cache) as $used_ident) { foreach ($field_data as $user_id => $row) { $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; } } return $user_fields; } else if ($mode == 'show') { // $profile_row == $user_fields[$row['user_id']]; $tpl_fields = array(); $tpl_fields['row'] = $tpl_fields['blockrow'] = array(); foreach ($profile_row as $ident => $ident_ary) { $value = $this->get_profile_value($ident_ary); if ($value === NULL) { continue; } $tpl_fields['row'] += array( 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], 'PROFILE_' . strtoupper($ident) . '_NAME' => $ident_ary['data']['lang_name'], 'PROFILE_' . strtoupper($ident) . '_EXPLAIN'=> $ident_ary['data']['lang_explain'], 'S_PROFILE_' . strtoupper($ident) => true ); $tpl_fields['blockrow'][] = array( 'PROFILE_FIELD_VALUE' => $value, 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], 'PROFILE_FIELD_NAME' => $ident_ary['data']['lang_name'], 'PROFILE_FIELD_EXPLAIN' => $ident_ary['data']['lang_explain'], 'S_PROFILE_' . strtoupper($ident) => true ); } return str_replace(" ", "%20", $tpl_fields); Code (markup): My good try is at the very bottom that starts with return str_replace... Can somebody please help me thanks