TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 508
  • Total: 508

Combining Custom Profile Field with Profile

Started by feeble, May 17, 2006, 05:55:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

feeble

Test Code to show how to combine unknown's Custom Profilefield with users profile
To add these custom profile fields i used a modified - Xfire mod

If you need help with what you need this for, please feel free to ask.

Since the data in the Custom Profilefield is stored in the theme table, we need to combine the data into one array for use. This is just one possible solution

Quick Demo: two custom profiles (xfire and bf2pid) linked upto the correct profile.
http://www.nsxhq.com/index.php?page=37

Note: So that only users from membergroup 11 in the table
if(preg_match('/11/i', $row['additionalGroups']))

if you need anyhelp at all with incorporating this into your site please feel free to ask.
Code: Copy and Paste straight into an article - Make sure you edit out preg_match line, and change the details to your correct custom profilefields

global $db_prefix, $scripturl;

$request = db_query("
SELECT ID_MEMBER, realName, posts, additionalGroups
FROM ".$db_prefix."members", __FILE__, __LINE__);
$return = array();
$counter = 0;
$ifxfire = "";
$ifbf2pid = "";
while ($row = mysql_fetch_assoc($request))
{
if(preg_match('/11/i', $row['additionalGroups']))
{
$request_member = db_query("
SELECT ID_MEMBER, variable, value
FROM {$db_prefix}themes
WHERE  ID_MEMBER='".$row['ID_MEMBER']."'", __FILE__, __LINE__);
while ($row_member = mysql_fetch_assoc($request_member))
{
if($row_member['variable'] == "Xfire")
$ifxfire = $row_member['value'];
if($row_member['variable'] == "bf2pid")
$ifbf2pid = $row_member['value'];
}
$return[$counter] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'bf2pid' => $ifbf2pid,
'xfire' => $ifxfire);
$ifxfire = "";
$ifbf2pid = "";
$counter++;
}
}

mysql_free_result($request);

$temp_array = array();
foreach ($return as $member)
{
$temp_array[] = "<tr><td>".$member['link']."</td><td>".$member['xfire']."</td><td>".$member['bf2pid']."</td></tr>";
}

echo "<table  width='95%' align='center'><thead><tr>
<th >Name (".$counter.")</th>
<th >Xfire</th>
<th >BF2 Pid</th>
</tr></thead><tbody>";
echo implode('', $temp_array);
echo "</tbody></table>";


Example Use: BF2 Leaderboard
http://www.nsxhq.com/index.php?page=33
Using the above method this leaderboard:
-Only adds members in the clan to the leaderboard
-If user is on the leaderboard - then highlight that user

animecosmo

Again, I know this is old, but I'm new to TP so am reading all the old snippets. I'm confused as to what exactly this does. Could someone please explain?

feeble

lol wow this is really old, dont even think i use this any more

basically, some mods store user data in the theme table. this just got the data and matched it correctly with the forum user

This website is proudly hosted on Crocweb Cloud Website Hosting.