help on making a cb module

17 years 7 months ago #21227 by duronl
help on making a cb module was created by duronl
Hey there,
I need help on making a module.

I want a module that shows a gamercard wich is linked to a gamertag: i created a field called cb_gamertag.
Now i made a module to show a gamercad.
this is how it looks.

<?php
/**
* @version 1.0 $
* @package CB Gamercard
* @copyright (C) 2006 Luuk Ros | www.globalxboxcommunity.com
* @license www.gnu.org/copyleft/gpl.html GNU/GPL
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$cb_gamertag = $params->get( 'cb_gamertag' );
$position = $params->get( 'position' );

><<?php echo $position; ?>>
<iframe src="gamercard.xbox.com/card" scrolling="no" frameBorder="0" height="140" width="204">>
?>


But it wont take the field cb_gamertag,
can any one help me out so that the <?php echo $cb_gamertag; ?> is linked to the field cb_gamertag.
So that when a user logs in it will show his gamercard when he has filled in the field cb_gamertag

Thanks in adcance
Luuk

Post edited by: duronl, at: 2006/09/20 16:38

Founder of Stampgasten.nl & globalxboxcommunity.com
Check: www.stampgasten.nl | www.globalxboxcommunity.com

Please Log in to join the conversation.

17 years 7 months ago #21228 by nant
Replied by nant on topic Re:help on making a cb module
you have to read the database table (comprofiler) to get the field value for the current user.

Please Log in to join the conversation.

17 years 7 months ago #21232 by duronl
Replied by duronl on topic Re:help on making a cb module
Ok thanks for the tip.

If an one else got some more idee's
and maybe how to use the value in the code??
youre welcome to replay.

Founder of Stampgasten.nl & globalxboxcommunity.com
Check: www.stampgasten.nl | www.globalxboxcommunity.com

Please Log in to join the conversation.

17 years 7 months ago #21263 by duronl
Replied by duronl on topic Re:help on making a cb module
Where exactly can i find this database file ??

Founder of Stampgasten.nl & globalxboxcommunity.com
Check: www.stampgasten.nl | www.globalxboxcommunity.com

Please Log in to join the conversation.

17 years 7 months ago #21266 by nant
Replied by nant on topic Re:help on making a cb module
if you have never written a module before you should start studying some of the existing ones to learn.

[code:1]
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $my;

$query = "SELECT cb_gamertag FROM #__comprofiler WHERE id = ". $my->id;
$database->setQuery( $query );
$cb_fieldvalue = htmlspecialchars($database->loadResult());

echo 'cb_gamertag value for current user is ' . $cb_fieldvalue;
?>
[/code:1]

the above code displays the value of a cb_gamertag field (assuming it has been created in the CB backend) for the current logged in user and should get you started.

Please Log in to join the conversation.

17 years 7 months ago #21294 by duronl
Replied by duronl on topic Re:help on making a cb module
Thanks alot m8,
Cant tell you how much this helped Thanks again.

I got it working on my site.
Only thing i like to ask now is how can i make it so that it will only show when you login in.
cause when your not logged in you see a litle error page ifram.

Check it here: www.globalxboxcommunity.com
Register to site and fill in gamertag field to test it.
If you dont got a gamertag or dont feel like registering.
Use username: Test password: test12

But it would really apreciate if you would register.

Greatings

Post edited by: duronl, at: 2006/09/21 13:04

Founder of Stampgasten.nl & globalxboxcommunity.com
Check: www.stampgasten.nl | www.globalxboxcommunity.com

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.411 seconds

Facebook Twitter LinkedIn