By Andy on Thursday, 02 January 2014
Posted in Technical Issues
Replies 9
Likes 0
Views 674
Votes 0
Assuming this doesn't already exist (!) I'd like to create a custom module that simply shows the User Points balance of the currently logged in user... Is there a nice easy bit of PHP code that would do this?

Thanks!

I also added a really small improvement request to Voices... http://stackideas.com/voices/item/249 - I really hope it gets seen - It's so small it's not going to get many votes... but I don't think anyone would argue with it and I assume it's real simple to do. I mention this here because it's probably the same code as what I'm asking for above.
Hi,

It seems like you are using the Custom Html module but unfortunately that module doesn't support PHP code.
·
Friday, 03 January 2014 21:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Andy,

Use this code to get the user's points,


<?php
require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );

$user = Foundry::user();
echo $user->getPoints();
?>


This block of code is also available at http://docs.stackideas.com/developers/users/users
·
Friday, 03 January 2014 00:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark. Happy New Year.

When I try that code in a module, the output at the front-end that shows on the screen is:

getPoints(); ?>

Anything stupid I might be doing wrong?!
·
Friday, 03 January 2014 00:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Could you provide me an FTP access and also the file that you've modified so that I can inspect it for you?
·
Friday, 03 January 2014 11:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason - Thanks - I've added the FTP details to this ticket... There's no file modified here... It's a module that I'm trying to get this working in (standard 'custom code' module) - It's title is called 'Points Balance' - You can see it back end under module manager or front end when logged in (it's set to show to users only)

Hope it's something easy to get working!
·
Friday, 03 January 2014 20:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah i see. OK thanks - I'll try and find another way!
·
Friday, 03 January 2014 21:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

You're welcome.
·
Friday, 03 January 2014 21:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes - Downloaded a 'Advanced Custom Code' module from JED and now this code snippet works PERFECT. Strange the default Joomla Custom Code module doesn't allow PHP!

Thanks Superstars!
·
Friday, 03 January 2014 23:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating Andy Glad that your issues are resolved now.
·
Saturday, 04 January 2014 04:26
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post