1
TeijoRoka
Custom Filed Data Retrieval From Forum
  • 2005/10/2 21:27

  • TeijoRoka

  • Just popping in

  • Posts: 9

  • Since: 2005/10/2


Hello, I just started using XOOPS about a week ago and I've been really happy with it thus far. I'm currently using it to handle guild information for an online game.

However, there is one thing that with all my searching I can not figure out. I've created several custom fields through user management to hold game data. I'd like to publish the information entered into these fields under the user’s signature in newBB 2.2.
It seems like calling this information should be simple, but I can't figure it out. Could I please get a few pointers?

2
TeijoRoka
Re: Custom Filed Data Retrieval From Forum
  • 2005/10/4 13:33

  • TeijoRoka

  • Just popping in

  • Posts: 9

  • Since: 2005/10/2


*Polite bump*

Anyone? This is the last piece of the puzzle for my site. Should I be asking in another forum -- did I misstate the question?

3
TeijoRoka
Re: Custom Filed Data Retrieval From Forum
  • 2005/10/6 18:43

  • TeijoRoka

  • Just popping in

  • Posts: 9

  • Since: 2005/10/2


Well... I achieved my goal. The means are rather ugly (with only a week and a half of php under my belt and an iframe, why wouldn't they be). Below is how I did it on XOOPS 2.2, just in case someone else wants to refine it.

First, I created a form field called MNK. This would hold a number representing a users level.

Secondly, I made a copy of userinfo.php (in the folder for the profile module) and started hammering away at it. I shriveled it down and tried to squeeze it into a function (I don't know if the function really makes it any better).

I didn't want to pull the information for all the custom fields, just specific ones -- so I removed the loop that is in the standard userinfo.php. The result follows.

<?php

include '../../mainfile.php';
include_once 
XOOPS_ROOT_PATH '/modules/system/constants.php';

$uid intval($_GET['uid']);
if (
$uid <= 0) {
}

function 
ffSig($xoopsUser$uid) {

 if (
is_object($xoopsUser) && $uid == $xoopsUser->getVar('uid')) {
  include 
XOOPS_ROOT_PATH.'/header.php';
  
$thisUser =& $xoopsUser;
 } else {
  
$member_handler =& xoops_gethandler('member');
  
$thisUser =& $member_handler->getUser($uid);
  if (!
is_object($thisUser) || !$thisUser->isActive()) {
      
redirect_header("index.php",3,_PROFILE_MA_SELECTNG);
      exit();
  }
 }

 
$profile_handler =& xoops_gethandler('profile');
 
$fields =& $profile_handler->loadFields();
 
 
$pcJobMnk $fields['MNK']->getOutputValue($thisUser);
 echo 
$pcJobMnk;
}

ffSig($xoopsUser$uid);

?>


This seems to take the user ID from the url and writes the value of the variable for that user. I thought about using some Smarty stuff, but this was already too much for me to comprehend.

Next I edited my newbb_thread.html template, the following code was inserted just before the signature.

<iframe class="ffxisig"
src="http://www.website.com/xoops/modules/profile/userinfo2.php?uid=<{$topic_post.poster.uid}>"
width=310 height=110 scrolling="no" frameborder="0"></iframe>


(I need to clean up the iframe code so it takes further advantage of CSS.)

Seems very hackish to me (I hate the iframe ). But the best I could come up with.

In summation, I don't totally know what the php file does. The forum seems to open an iframe that passes the user id variable to the php file. The php page retrieves the information for the user ID that the variable represents and prints it to the page displayed within the iframe.

It seems to retrieve the information I'm looking for. Any optimization tips?

4
larceniii
Re: Custom Filed Data Retrieval From Forum
  • 2005/11/7 23:31

  • larceniii

  • Just popping in

  • Posts: 11

  • Since: 2005/6/14


Hey sounds Like you're about 1 Week ahead of me.
I was just diving in for My Clan site.

PM me and Hopefully we can figure this out together.

http://www.kill4play.com

I've added an XBL GamerTag Field and I was wondering how to retrieve it For use In a Custom Block.

I've been using XOOPS for a few Months now (Like 8 Months)

+LarcenIII

Login

Who's Online

214 user(s) are online (148 user(s) are browsing Support Forums)


Members: 0


Guests: 214


more...

Donat-O-Meter

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

Latest GitHub Commits