Click anywhere to close this dialog

Farewell

Great is the art of beginning, but greater is the art of ending
Henry Wadsworth Longfellow

I announce that I cease all development and activity in the programming universe indefinitely. My career has reached the turning point I was not expecting for at least another year, leaving me highly off guard and without laid-out plans for this hobby's continuity. I have begun a 5-year residency program in Neurosurgery which is clearly not compatible, time-wise, with programming.

I gave in all my passion for developing, and you gave me back your loyalty and trust, even when I did not deserve that much. Now it is the time for payback. I release all my present and past work as Open Source software, in the hope some talented developer will continue maintaining and expanding my vision of a modern, sleek forum software. The intrinsic flexibility of MyBB is the true hidden gem of an otherwise outdated codebase; I do hope the project can continue and be updated complying to the latest coding standards.

I hereby thank Euan, kawaii, andrewjs18, Ben, Matt, Omar G., effone, Eric J., Devilshakerz, Wildcard, JordanMussi and all the other team members I have had the opportunity to work with when I was a MyBB team member. I thank Tomm M, my mentor, who inspired me to pick up coding with his piece-of-art plugins. And finally, I thank all of you MyBBoost subscribers who have helped me getting through my toughest university years economically.

Yours sincerely, Filippo

Not compatible with SweetAlerts

13 Aug 2020
#1
This issue is marked as solved
Bankpipe is showing json output when using the plugin

https://community.mybb.com/mods.php?acti...w&pid=1306

Best answer

Shade 14 Aug 2020
Ah, it replaces things on the server side with a str_replace(). That's a bit basic and prone to issues. I'd need your board URL to see where's failing, but I'd recommend getting rid of the plugin entirely, load Swal.js on your own and use a front-end override for jGrowl. For example, I came up with the following function loaded in headerinclude template:

// Override jGrowl
        $.jGrowl = function(m, o) {
            
            var status = 'success';
            if (typeof o !== 'undefined' && o.theme.indexOf('error') != -1) {
                status = 'danger';
            }
            
            var label = (status == 'success') ? 'Success' : 'Error';
            var icon = (status == 'success') ? 'check' : 'close';
            
            var message = "<div class='uk-grid uk-grid-small uk-child-width-expand uk-flex-middle'>" +
                                "<i uk-icon='icon: " + icon + "' class='uk-width-auto'></i>" +
                                "<div>" +
                                    "<b class='uk-text-uppercase uk-text-small'>" + label + "</b>" +
                                    "<div>" + m + "</div>" +
                                "</div>" +
                            "</div>";
            
            $.notification = UIkit.notification(message, {
                status: status,
                 pos: 'bottom-right'
            });
            
        };
It's tailored to MyBBoost's framework (UIKit) but you get the idea. You basically redeclare $.jGrowl and return your own message handler instead of jGrowl's.

All replies

Shade 13 Aug 2020
#2
Hi, unfortunately I don’t support third party plugins unless they are widely used (eg: DVZ Shoutbox, MyAlerts). This sounds like an incompatibility with the way that plugin hijacks jGrowl, but I am not sure as I haven’t had a look at the plugin.
ProX 14 Aug 2020
#3
Hi, unfortunately I don’t support third party plugins unless they are widely used (eg: DVZ Shoutbox, MyAlerts). This sounds like an incompatibility with the way that plugin hijacks jGrowl, but I am not sure as I haven’t had a look at the plugin.
Shade (13 Aug 2020)
I guess it's this part.

/**
     * Replace all lines containing jGrowl with SweetAlert's code.
     *
     * @param string $fileName The name of the file.
     *
     * @author Skryptec <[email protected]>
     */
    public function replaceFilesWithSwal(string $fileName) {
        file_put_contents($fileName, implode('',
            array_map(function($data) {
                $match = stristr($data, '$.jGrowl');

                if($match) {
                    $filtered = explode(', ', trim(
                                    str_replace(
                                    [
                                        "{theme:'jgrowl_",
                                        "'});",
                                        '$.jGrowl('
                                    ], '', $match)
                                ));
                    
                    $title = ucfirst($filtered[1]) . '!';

                    $swal = "/** MySweetAlert2 */\nSwal.fire('$title', $filtered[0], '$filtered[1]');\n";

                    return $swal;
                }

                return $data;
            }, file($fileName))
        ));
    }
Especially this Swal.fire('$title', $filtered[0], '$filtered[1]'), how much of a change would it require to fit bankpipe?
Shade 14 Aug 2020
#4
Ah, it replaces things on the server side with a str_replace(). That's a bit basic and prone to issues. I'd need your board URL to see where's failing, but I'd recommend getting rid of the plugin entirely, load Swal.js on your own and use a front-end override for jGrowl. For example, I came up with the following function loaded in headerinclude template:

// Override jGrowl
        $.jGrowl = function(m, o) {
            
            var status = 'success';
            if (typeof o !== 'undefined' && o.theme.indexOf('error') != -1) {
                status = 'danger';
            }
            
            var label = (status == 'success') ? 'Success' : 'Error';
            var icon = (status == 'success') ? 'check' : 'close';
            
            var message = "<div class='uk-grid uk-grid-small uk-child-width-expand uk-flex-middle'>" +
                                "<i uk-icon='icon: " + icon + "' class='uk-width-auto'></i>" +
                                "<div>" +
                                    "<b class='uk-text-uppercase uk-text-small'>" + label + "</b>" +
                                    "<div>" + m + "</div>" +
                                "</div>" +
                            "</div>";
            
            $.notification = UIkit.notification(message, {
                status: status,
                 pos: 'bottom-right'
            });
            
        };
It's tailored to MyBBoost's framework (UIKit) but you get the idea. You basically redeclare $.jGrowl and return your own message handler instead of jGrowl's.
ProX 14 Aug 2020 Edited
#5
Yeah, your approach is so much better and works.