Hello There, Guest! › Register

MyDownloads 3.0.1 released.
Looking for a custom plugin for your site? Ask here for a quote.

Adding the total at the home stat

Hello, after making this little change at this great plugin : http://forums.mybb-plugins.com/Thread-TU...ints-index

I have an other idea but I don t know how to start it.

I would like to add, at the home page, the total amount of point generated by users.
I ve easily implemented it at the newpoints.php page using this function on the plugin newpoints.php

PHP Code:
function get_total()
$total 0;
$query $db->write_query("
        SELECT newpoints FROM "
.TABLE_PREFIX."users WHERE newpoints>0
$points $db->fetch_array($query))
$total $total $points['newpoints'];

and then adding this to the menu :

PHP Code:
$menu[0] = '<a href="#">Total: 'newpoints_format_points(get_total()) . '</a>'

But now, how can i call this variable, or the function from the portal template ?

thank you

You must add a hook to portal_start or portal_end (either should work depending on what you want to do) and then add that variable to the global variables list.

Also, you should use MySQL to SUM all that, don't leave it to PHP.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

Thank you for your explanation, the problem is fixed Smile

Users browsing this thread: 1 Guest(s)