Need help about little coding...

16 years 11 months ago #38774 by Cano
Need help about little coding... was created by Cano
Hi everyone.

I would like to show a number points on the profilpage of the member.

So, i have added "points" field in the joomla_comprofiler table.
Then, i have opened cb.menu.php file,
And after this :
[code:1] //
User Status items for User Status Window:
// Hits
if ($params->get('hits', '1')==1) {
$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_HITS"]["_UE_HITS"]=null;
$this->menuList->addObjectItem($mi, $user->hits,"", "",
"","", _UE_HITS_DESC,""«»);
}
// Point system by Cano

$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_POINTS"]["_UE_POINTS"]=null;
$this->menuList->addObjectItem($mi, $user->points,"", "",
"","", _UE_POINTS_DESC,""«»);

// Online Status
if($ueConfig==1 && $params->get('online', '1')==1) {
$database->setQuery("SELECT COUNT(*) FROM #__session WHERE userid =". (int) $user->id);
$isonline = $database->loadResult();
$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_ONLINESTATUS"]["_UE_ONLINESTATUS"]=null;
$this->menuList->addObjectItem($mi, ($isonline > 0) ? _UE_ISONLINE : _UE_ISOFFLINE,"", "",
"","", _UE_ONLINESTATUS_DESC,""«»);
}[/code:1]

I have added that :

[code:1] // Try to show a table data

$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_POINTS"]["_UE_POINTS"]=null;
$this->menuList->addObjectItem($mi, $user->points,"", "",
"","", _UE_POINTS_DESC,""«»); [/code:1]

But it doesn't work really...
Look yourself img502.imageshack.us/my.php?image=bugxv0.jpg

Whereas i have change the value of points to 5 in phpmyadmin tool.

The value is already 0!


What's the problem ?
thx

Post edited by: Cano, at: 2007/05/31 21:25

Please Log in to join the conversation.

16 years 11 months ago #38822 by Cano
Replied by Cano on topic Re:Need help about little coding...
Finaly i've resolved the problem myself.

The code where :
[code:1]
// Point system by Cano
{
$database->setQuery("SELECT points FROM #__comprofiler WHERE id =". (int) $user->id);
$varpoints = $database->loadResult();
$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_POINTS"]["_UE_POINTS"]=null;
$this->menuList->addObjectItem($mi, $varpoints,"", "","","", _UE_POINTS_DESC,""«»);
}[/code:1]

Please Log in to join the conversation.

15 years 8 months ago #73042 by vilo
Replied by vilo on topic Re:Need help about little coding...
I was looking for some help and I was really happy to find your post on using:

$this->menuList->addObjectItem

I copied your code into plugin I am working on, adjusted it to my situation in hope it will allow me to add element to the status area of Profile page. However I've got error message instead which says:

Fatal error: Call to a member function addObjectItem() on a non-object in /Applications/MAMP/htdocs/www/traderhood/components/com_comprofiler/plugin/user/plug_cbgendertab/myplugin.php on line 63

That is basically saying it could not find function addObjectItem() I am trying to use.

Only place I found that function to be present is in the cb.menu.php.

My question to you is how did you made that function available to your plugin? Did you do some include of cb.menu.php in your plugin, or you copied it from cb.menu.php and recreated it in your plugin or something else entirely.

I am pulling my hair here for quite a while trying to figure out how to change values of existing tabs. Any help would be much appreciated.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.212 seconds

Facebook Twitter LinkedIn