We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42393
    • 143 Posts
    I did my first mini-hack today. I'm just sharing the experience with a specific example.

    I don't like the idea that the dashboard News Feed and Security Feed widgets load All news, All the time. So I modified \manager\controllers\default\dashboard widget.modx-news.php and widget.modx-security.php with a simple counter which breaks out of the foreach loop after 3 items. I noticed that someone had done something similar with another feed in this other forum post. It could also be done like this:
    $items = array_slice($rss->items, 0, $num_items);
    and then
    foreach (array_keys($items) as $key) {}

    That's my newbie solution to (a) fixing a minor annoyance, and (b) learning how the dashboard works.

    I also noticed that the PieX and FeedX include options for this as well, and that dashboard feeds use modRSSParse, based on MagPie which doesn't seem to have this functionality built-in. (?)

    Side note: In my research it "dawned on me" that there is a direct relation between /manager/controllers and /manager/templates, something that I'm sure is obvious to people who work in here all the time but it was new to me. Yippie, very clean and good info for getting a better understanding of the whole environment. I also found the API pages. I don't know I've missed those but they were somewhat helpful.

    Questions:

    1. I'm thinking that's probably not the best way to make a customization. It will get blown away on the next update. Is there a system of overrides which allows a hack like this to get called instead of the default? Or is the accepted procedure to merge customizations back into the core after each update?
    2. Is this the kind of thing to submit as a possible patch to core, using a new system parameter rather than hard-coding the limit?
    3. Would there have been a better way to do this?
    4. I've been looking for a way to get the original RSS query to return less data so that the limit doesn't need to be set on the already parsed array of items like this. Any ideas?
    5. Is any part of this data cached anywhere? I'm just trying to improve performance. If the RSS XML, the parsed items, or the rendered data are already saved somewhere, then maybe this solution is overkill?
    6. Is there a list anywhere of other helpful dashboard widgets that people use?
    7. I was surprised that when looking at default dashboard widgets that there is no way to tell where the scripts are stored. I mean, you can see the default widgets but none of the properties as set under New Widget. So I had to hunt in the file system to find the scripts. I see the text for the default widgets are in the lexicon as w_*. Apparently these really are hard-coded and site-specific widgets are stored differently?
    8. Have I missed some documentation describing this part of the environment?

    I'm hoping this thread will also help others to understand how this works...

    Thanks!




      Loved ModX when I was using it a few years ago. Shifted to WordPress, sorry. Thanks, all.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You're best off creating your own custom widgets, and your own custom dashboards. It's almost always best to leave the default of anything in the Manager alone.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        1. As Susan said, duplicate and create your own dashboard (widget) is best.
        2. Absolutely; would love to limit the amount of items on my dashboard too.
        3. I'm not sure. Don't think so.
        4. It's an RSS feed that doesn't accept parameters to the knowledge, so no sorry sad
        5. Yes; I believe the raw feeds are cached.
        6. There's a couple in the extras repo, tho I think it's fairly limited atm. I released a feed reader from my site tongue VersionX also comes with a dashboard widget for recently edited resources (which is slightly different from the default RER widget, as that is limited to your own edits) and there will soon be a CloudFlare dashboard widget if you're using that.
        7. Not sure, would have to look into it. I do believe they're stored in the same way, just in the core instead of elsewhere.
        8. This comes to mind: http://rtfm.modx.com/display/revolution20/Dashboards
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 42393
          • 143 Posts
          All great info. TYVM
            Loved ModX when I was using it a few years ago. Shifted to WordPress, sorry. Thanks, all.