Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support collection of custom stats in stats frontend module #15138

Merged
merged 10 commits into from
May 27, 2017

Conversation

zero-24
Copy link
Contributor

@zero-24 zero-24 commented Apr 6, 2017

Summary of Changes

Similar to how the backend module triggers an event to add additional items to its output, this adds support for the mod_stats module to do the same.

A new onGetStats event is published with a single parameter, a context (hardcoded to mod_stats_admin) and any plugin responding to this event is expected to return an array matching this schema:

array(
    'title' => 'Stats Item Title',
    'data' => 'Data to be displayed',
    'icon' => 'Optional IcoMoon font icon for the row, defaulting to "info" if not set',
);

The title and data attributes MUST be defined or a row is not added.

Similar to the quickicons implementation, items can NOT be removed via the plugin event.

Testing Instructions

Add the following method to a system plugin:

    public function onGetStats($context)
    {
        return array(
            array(
                'title' => 'Plays Audio',
                'data'  => JText::_('JNO'),
                'icon'  => 'music',
            ),
        );
    }

With the admin stats module enabled, you should see a new row with this data.

Based on the same thing that @mbabker did for the backend: #10870

The weblinks part is moved here: https://github.com/joomla-extensions/weblinks/pull/333/files to be included in the 3.7 version.

@zero-24
Copy link
Contributor Author

zero-24 commented Apr 13, 2017

@franz-wohlkoenig as you have tested the weblinks PR you have also tested here ;)

@ghost
Copy link

ghost commented Apr 13, 2017

I have tested this item ✅ successfully on 9883fad


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@zero-24 zero-24 added this to the Joomla 3.7.1 milestone Apr 21, 2017
@mbabker mbabker changed the base branch from staging to 3.8-dev April 27, 2017 00:40
@mbabker mbabker modified the milestones: Joomla 3.8.0, Joomla 3.7.1 Apr 27, 2017
@sanderpotjer
Copy link
Member

@zero-24 adding the onGetStats function to a system plugin already adding a new row before applying your patch?

@zero-24
Copy link
Contributor Author

zero-24 commented Apr 30, 2017

Yes in the backend but not in the frontend module.

@sanderpotjer
Copy link
Member

I have tested this item 🔴 unsuccessfully on 9883fad


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@sanderpotjer
Copy link
Member

The custom data is displayed instead of the "article hits" when "Hit Counter" is set to yes in the module options.

Before patch:
screen shot 2017-05-01 at 09 51 43

After patch:
screen shot 2017-05-01 at 09 51 53

So the custom stats data is shown, but the hits value is gone.

@zero-24
Copy link
Contributor Author

zero-24 commented May 1, 2017

The custom data is displayed instead of the "article hits" when "Hit Counter" is set to yes in the module options.

fixed please test again @sanderpotjer

@sanderpotjer
Copy link
Member

I have tested this item ✅ successfully on f9dd52a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@sanderpotjer
Copy link
Member

@zero-24 thanks, that fixed it!

@astridx
Copy link
Contributor

astridx commented May 13, 2017

I have tested this item ✅ successfully on f9dd52a

I tested this successfully.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 13, 2017
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');

$app = JFactory::getApplication();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this line 148 ($app = JFactory::getApplication();), because it is already defined earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@gwsdesk
Copy link

gwsdesk commented May 22, 2017

I have tested this item ✅ successfully on 84c2ee7

I have tested this item ✅ successfully on f9dd52a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@gwsdesk
Copy link

gwsdesk commented May 22, 2017

I have tested this item ✅ successfully on f9dd52a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15138.

@mbabker mbabker merged commit 4887737 into joomla:3.8-dev May 27, 2017
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 27, 2017
@zero-24 zero-24 deleted the modstats branch May 27, 2017 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants