Log in

View Full Version : help - trying to show profile fields on showgroups


tipoboy
04-03-2009, 09:17 PM
hello i'm trying tom customize my showgroups page and call some additional profile fields, but i can only seem to show profile field 2 and no others, in the showgroups php file i found this code:

// 2 is the default location field and the one we always use in the template
$show['locationfield'] = $db->query_first("
SELECT profilefieldid
FROM " . TABLE_PREFIX . "profilefield
WHERE profilefieldid = 2
");

this is what i think might be causeing the problem, i used this code to call the profile fields in the showgroups template with no success:

<if condition="$user['field18']">
<div> Tell Us More:<br />
$user[field18]
</div>
</if>


could anyone help me put these profile fields in the showgroups page

any help would be appreciated

Lynne
04-03-2009, 09:31 PM
use the showgroups_start hook to add in the userfields that you want to grab. SEe if that works.

tipoboy
04-03-2009, 09:39 PM
use the showgroups_start hook to add in the userfields that you want to grab. SEe if that works.

thanks for the reply lynne could you possibly explain how i would do that?

Lynne
04-03-2009, 09:42 PM
Actually, I just looked and even though the hook is right above the query, it doesn't allow you to add any variables into the query. So, I think you'll have to add them manually - ie. add ",userfield.field18" into the select statement.

tipoboy
04-03-2009, 09:49 PM
Actually, I just looked and even though the hook is right above the query, it doesn't allow you to add any variables into the query. So, I think you'll have to add them manually - ie. add ",userfield.field18" into the select statement.

thanks again for the reply, buit now i'm lost i'm not great with customizing like that, is there an article you could point me in the direction of or give me a quick walk through of how to do it,

i'd very much appreciate if you could

thanks again

Lynne
04-03-2009, 10:40 PM
I don't know of an article about adding to queries. You can see what a select statement is like by looking at the mysql documentation. But, just look at the query in that page around line 99 (or 168 if it's for the moderators). You'll see all this stuff like "select this, that, theother" and you just need to add the other field to it before the FROM part. You'll really just want to play with it a bit. I think what I'm suggesting will work, but since I've never tried to add the fields to my usergroups list, I really don't know.

tipoboy
04-04-2009, 09:12 AM
I don't know of an article about adding to queries. You can see what a select statement is like by looking at the mysql documentation. But, just look at the query in that page around line 99 (or 168 if it's for the moderators). You'll see all this stuff like "select this, that, theother" and you just need to add the other field to it before the FROM part. You'll really just want to play with it a bit. I think what I'm suggesting will work, but since I've never tried to add the fields to my usergroups list, I really don't know.

an update, i remember doing the same thing in vb 3.6.8 and not having a problem, so i used the old showgroups php file and it worked, does anyone know, why it would work in 3.6.8 but not 3.8.2??

any help is again appreciated

Lynne
04-04-2009, 02:48 PM
an update, i remember doing the same thing in vb 3.6.8 and not having a problem, so i used the old showgroups php file and it worked, does anyone know, why it would work in 3.6.8 but not 3.8.2??

any help is again appreciated
You'd have to compare the queries to see why it is no longer working. I seem to recall looking at some of the queries and it used to be they would select user.* and now they are only selecting the specific user.whatever fields they need. This is better for memory and probably better practice.

tipoboy
04-04-2009, 04:08 PM
i have no idea about php(even though i wouldn't like learning but from what i can determine this is the difference,

showgroups.php 3.8.2:
// 2 is the default location field and the one we always use in the template
$show['locationfield'] = $db->query_first("
SELECT profilefieldid
FROM " . TABLE_PREFIX . "profilefield
WHERE profilefieldid = 2
");
$show['contactinfo'] = (bool)$vbulletin->userinfo['userid'];
function process_showgroups_userinfo($user)
{
global $vbulletin, $permissions, $stylevar, $show;
$user = array_merge($user, convert_bits_to_array($user['options'], $vbulletin->bf_misc_useroptions));
$user = array_merge($user, convert_bits_to_array($user['adminoptions'], $vbulletin->bf_misc_adminoptions));
cache_permissions($user, false);
fetch_online_status($user, true);
if ((!$user['invisible'] OR $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']))
{
$user['lastonline'] = vbdate($vbulletin->options['dateformat'], $user['lastactivity'], 1);
}
else
{
$user['lastonline'] = '&nbsp;';
}
fetch_musername($user);
return $user;
}

3.6.8 showgroups.php:
$show['locationfield'] = false;
function process_showgroups_userinfo($user)
{
global $vbulletin, $permissions, $stylevar, $show;
$post =& $user;
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
require_once(DIR . '/includes/functions_bigthree.php');
fetch_online_status($user, true);
if ((!$user['invisible'] OR $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']))
{
$user['lastonline'] = vbdate($vbulletin->options['dateformat'], $user['lastactivity'], 1);
}
else
{
$user['lastonline'] = '&nbsp;';
}
fetch_musername($user);
return $user;
}

could someone who knows about php tell me what the differnece is,

it wold maybe help me understand things a bit better :D

thanks again for the help so far