Code Monkey home page Code Monkey logo

advanced-sidebox's Introduction

Advanced-Sidebox 3.1.19

Advanced Sidebox Logo

A plugin for MyBB forums that displays custom boxes on various forum pages.

ASB is the side box plugin for MyBB forums. It is versatile, powerful, and built using the advice of its users.

Features:

  • create an unlimited amount of side boxes on the left, right or both
  • add side boxes to almost any page
  • side boxes can be created using core modules (listed below) or static HTML created by the admin
  • static HTML (termed custom side boxes) may be imported/exported to XML to backup, restore and share
  • side boxes expand/collapse just like the MyBB core windows
  • JavaScript visibility toggle icons for columns (uses cookies to remember states)
  • intuitive, drag and drop, side box management interface in ACP
  • context-sensitive help pages in ACP
  • easily extensible from single file modules for third-party developers and the hobbyist admin
  • CodeMirror supported when editing custom side boxes (if enabled in ACP)
  • compatible with Page Manager pages and custom scripts
  • AJAX Update integrated into the core and eight of the core modules! (listed below)

Controls:

  • which user group(s) the side boxes display for
  • which script(s) the side boxes display in
  • which theme(s) the side boxes display on
  • disable the plugin for specific themes
  • admin option to allow users to disable side boxes globally from usercp.php

Current default side box types available:

  • New Birthdays
  • New Forum Age AJAX-ready
  • Forum Goals AJAX-ready
  • Top Poster
  • Slideshow
  • Recent Posts AJAX-ready
  • Who's Online AJAX-ready
  • Latest Threads AJAX-ready
  • Welcome
  • Statistics
  • Private Messages AJAX-ready
  • Search
  • Random Quotes AJAX-ready
  • Staff Online AJAX-ready
  • You can also create your own custom box types with static content

advanced-sidebox's People

Contributors

avril-gh avatar destroy666x avatar howman avatar tanweth avatar wildcardsearch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

advanced-sidebox's Issues

Add Import/Export Functionality

The feedback I've been receiving suggests that because that complexity of the possible settings for this plugin import/export of sideboxes, custom box types and possibly even user-preference settings would be a good addition.

Work is picking up so I won't be able to get it done overnight but I'd like to see this for the next minor version 1.4.

How hard would it be

How hard would it be to make your side-boxes collapsible like the forums are?

How Useful Is The Custom Box Type?

I'm not talking about user-defined box types that can be exported/imported. I mean the 'on-the-fly' boxes you can create without saving a type.

It has occurred to me that this option seems fairly pointless and I have been thinking of removing it by 1.4 but I thought I'd get some feedback from anyone reading this.

Do you think it should stay or go?

Group Permissions Issue

The first boxes group permissions are affecting the subsequent boxes. Will add a simple reset to permission-check boolean in each iteration.

Online Staff Module Privacy Issue

Instead of showing the users that have displaygroups as moderators this module is showing any user who has access to moderation or administration tools. This would cause any user with staff privilege to be shown whether the admin wishes to or not.

Will be fixed in next commit as well as a complete redesign of that module.

Custom Titles Not Implicit

When a side box is using a custom title and is edited, leaving the custom title on/off switch to on with a blank custom title text field results in the title resetting to default.

I feel this action should be that if left blank (and custom title is still on) then it should maintain its current custom title. Will fix.

Private Message Box Needs Work

The Private Messages default module is weak and also wastes a lot of execution producing content that is already available through the $mybb object.

Need to remove unnecessary code, eliminating those queries as well.

Also, it would be nice to add a little more functionality to the Search Box as well.

Add More Scripts

Work on the core has progressed to the point that I am willing to say for certain that we will add 2-3 new scripts by 1.5

Add CodePress Support

I really don't like using CodePress but some do so maybe it would be for the best to use CodePress in the custom side box edit page (and maybe other pages later) if admin has CodePress enabled in ACP.

This shouldn't be hard to handle.

Why Even Have Install/Uninstall For Each Module?

The core already automatically handles install/removal(uninstalls first)/upgrade so why not just create a simpler system and just have any valid modules automatically be installed/upgraded upon detection.

I propose removing the Install/Uninstall option from the popup and just leaving the delete option.

Improve staff online module

It has been found that in certain scenarios, leftover code from older versions of module
is causing interferences within 'staff online' module rendering its output incorrect.

I have assigned myself to this issue here avril-gh/Advanced-Sidebox#6

MySQL error after uninstalling

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'adv_sidebox_on_index'' at line 1
Query:
DELETE FROM mybb_settings WHERE name=''adv_sidebox_on_index'

Just worried...

While im working more and more on this project i began to see things that began to make me worried. I think it would be good if i share this thought with you.

To put it simply, it seems to me, that even tho you introduce your intentions as attempt to make asb simple, i began to see that what you do, is increasing weight and complexity of core with each move, which then introduce next and next new problems which are slowing you down and pushing side tracked to solve them.
But solution eventually opening next doors to future issues which piling up without end. Its just going slowly straight into dark forest full of thickets.

Module Deletion Broken

For some reason in acp_function.php the script is calling the install() method rather than the remove() method.

Will be fixed soon and I also noticed that return values aren't being used appropriately. Will fix.

Can't Uninstall Add-on Modules Permanently

The upgrade script in Sidebox_addon::load() isn't checking to see if the addon was already installed prior to versioning and is being re-installed regardless of admins wishes.

Need to add check and only upgrade if the module is currently installed.

Few minor enhancements

  1. Staff Online shows empty box if the rank doesn't have specified image. Should check if it has and if not don't draw anything.
  2. There is a typo in Private messages when logged out, a redundant " after register.
  3. If no staff is online it says "nothing to show", I think it should be rather something like "There is currently no staff online." as the Who's Online box has.

I'd attach the fixes as they're really simple but I still don't have idea how to do it.

multiple issues caused by closing tags of sidebox inserted in wrong position.

Test environment - clean MyBB 1.6.9 / Adv Sidebox 1.3 / PHP 5.4.10

Issue's :

  1. Certain sideboxes (eg. search sidebox) not appear on expected position.
    Instead they show self above or below forums.
  2. Collapse function does not work for certain sideboxes (eg. search sidebox)
  3. Some other sideboxes (eg. custom sidebox) act as working ok
    (may collapse and can be placed on left or right), however the bug is visible
    in html output plus footer still is not positioned as expected. (100% width)
  4. When sideboxes are published, footer of MyBB is not positioned as expected
    (sideboxes columns take space on its sides while they shouldnt)
  5. W3C html validator shows that layout are broken.

Cause :
All mentioned above issues are caused by inserting 'sideboxes closing code' not only at wrong position (after footer while it should be inserted before footer) but also with 2 extra closing div tags which finally break layout.
By 'sideboxes closing code' (which is inserted after footer) i understand this part :

    </td></tr></table></div><div>

Which then create html output like this :

                    </div>
                    </div> 
                    <!-- end: footer -->
                    </td>
                </tr>
            </table>
        </div>
    </div>

These 2 divs at top are contained within footer itself and after adding sideboxes code below footer there are allready 4 closing divs total, which are (2 extra closing divs) breaking layout.
Whats more, inserting it after footer cause sideboxes push footer and create blank space (columns ) on its sides.

Fix :
'sideboxes closing code' should be inserted before footer.
Also assuming that footer allready contain these 2 required closing divs,
we should insert only 'closing tables tags' without closing divs.

    </td></tr></table>

Which then would give :

                        <!-- (...) -->

                        </td>
                    </tr>
                </table>

                <!-- (...) -->
                </div>
                </div> 
                <!-- end: footer -->

Proof of concept :
There are more places in code where 'sideboxes closing code' is inserted which should be fixed, but for quick demonstration i changed it in one place only.

Tested with one 'custom sidebox' published on left side.
file 'adv_sidebox.php line 235 original code : (inserts stuff with extra divs after footer)

$templates->cache['index'] = str_replace('{$footer}', '{$footer}</td></tr></table></div></div>', $templates->cache['index']);

file 'adv_sidebox.php line 235 fixed code : (insert stuff before footer without divs assuming that required divs are allready included within footer)

$templates->cache['index'] = str_replace('{$footer}', '</td></tr></table>{$footer}', $templates->cache['index']);

After fixing this, html output appear to be valid (tested with W3C html validator),
also footer maintain its 100% width and sidebox column are in expected position.

Add Context-sensitive Help

This plugin has quite a few things going on and I can see a need for some guidance for admins.

Will try to get what I've done pushed tonight.

Latest Threads still causing issues

It seems to open up more space above the middle portion of the portal. I went to my templates and copied the recent threads template for my template and pasted it into the custom boxes and used that instead. It works fine with the custom box.

Default avatars

In welcome box there is no default avatar, in other boxes I think it should be drawn from theme not images root.

Improve Template Handling For Showthread and Forumdisplay

As has been pointed out on MyBB forums, when side boxes are added on forumdisplay.php or showthread.php the side boxes are not aligned with the first MyBB core window (subforum, forums, thread, etc)

Will look into correcting this.

columns not working correctly

Just tried the updated version and it doesn't seem to be splitting the columns at all. It looks as though there's only one column with the leftside/middle/rightside going from top to bottom.

Currently using this theme -- http://mods.mybb.com/view/blackevo4-2

On a side note,
Maybe add an option to specify custom variables to manually add/edit themes to work? would prob make it universal to themes.

Online Avatars

I love the olnline avatar modules you have(Staff online/ members online). However the size of the avatars are a bit to large. Could you add a setting to set the width|height of the avatars? also maybe have the option to have text only without the avatars.

Custom Box Wrap Issue

If a side box created from a user-defined custom box has a wrap_content property of false it is shown incorrectly.

This has already been fixed (but not pushed) I am just documenting it in case it pops back up.

Custom Boxes Not Displaying

The change in custom box display has caused an unexpected problem with custom sidebox type display. To prevent this, eval() will no longer be used with custom boxes, but rather direct template insertion.

support for module option 'box tittle'

Additional option per module where user may set custom text
which will be displayed in frontends box window tittle. (contained in wrapper)

For now there is no way to change it as its out of module control because its
hardcoded within box wrapper (and pulled from $settings['name'] for all boxes of this type)

If user would display the same box type twice,
but with different settings which would possibly make box to display something different,
still tittles of these boxes appear the same and are uncustomisable by user.

Add Version Control and Upgrade Module

As @Wolfseye has brought to my attention, there are a few plugins that maintain version control and are able to allow users to upgrade the plugin, even when there are changes made with massive ramifications, without having to uninstall the plugin.

Thanks to pavemen for allowing me to check out his code for MyBB Publisher and use some of the versioning routines. He and his affiliated site will receive full credit.

I am in the testing stage so it shouldn't be long before I can get a beta release on GitHub.

Note: When this feature is tested and working properly and all other issues are closed it will be released to MyBB as version 1.4

Thoughts are welcome. ๐Ÿ˜„

Update to private messages box

There was fiew things in
inc / plugins / adv_sidebox / modules / private_messages / adv_sidebox_module.php

Line 82, did not work.
For eg. when user is logedin and administrator disable pm's then user will
get message that he 'should register to view' (while he is registered and logedin) ect ect.
Line 107 to 110 caused strange outcome where if forum is installed in folder and not root,
then link within this message for some unknown reason is invalid and lead to non exsisting
page. ( if it would be root/foldername/something then output was root/something
and fodlername just magically vanished)

There was also fiew other things, which made me decide to update this module.

Line 107 to 110 removed and its functionality has moved to line 82 and below)
Line 82 changed and new lines added to properly handle possible situations,
Line 100 to 103, shortened into one line with same functionality.

Language file changes :
In PM's section - removed arrays, standarised format, messages added.
All pm box messages are 100% customisable within language file pm's block
(including text which appear as links, "login", "register", "control panel")

Functionality :
When user is loged in, he will receive standard output from pm's module.

When user is not logedin he will receive message :
'Please login or register to use this functionality.' (where "login" and "register" are links)

When user is logedin but disabled pm's in usercp he will receive message :
'You have disabled this functionality in control panel.' (where "control panel" is link)

When user is loged in but group cant use pm's or its disabled globaly
he will receive message :
'You dont have privileges to access this functionality, or it has been disabled by administrator. You may contact administrator for assistance.'

Code :
inc / plugins / adv_sidebox / modules / private_messages / adv_sidebox_module.php
Lines 82 to 110 has been removed and replaced with this :

if(!$mybb->user['uid'])
{
    // user is guest - output "please login or register" block with login and register links.
    $private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_no_messages."</td></tr>","<a href='".$mybb->settings['bburl']."/member.php?action=login'>".$lang->adv_sidebox_pms_login."</a>","<a href='".$mybb->settings['bburl']."/member.php?action=register'>".$lang->adv_sidebox_pms_register."</a>");
}
elseif (!$mybb->user['receivepms'])
{
    // user dont want pm's - output "you have disabled pms in control panel" block with link to usercp.
    $private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_user_disabled_pms."</td></tr>","<a href='".$mybb->settings['bburl']."/usercp.php?action=options'>".$lang->adv_sidebox_pms_usercp."</a>");
}
elseif (!$mybb->usergroup['canusepms'] || !$mybb->settings['enablepms'])
{
    // admin has disabled pm's - output "no privileges or disabled by admin" block.
    $private_messages = $lang->sprintf("<tr><td class='trow1'>".$lang->adv_sidebox_pms_disabled_by_admin."</td></tr>","<a href='".$mybb->settings['bburl']."/usercp.php?action=options'>".$lang->adv_sidebox_pms_usercp."</a>");
}
else
{
    switch($db->type)
    {
        case "sqlite":
        case "pgsql":
            $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='" . $mybb->user['uid'] . "'");
            $messages['pms_total'] = $db->fetch_field($query, "pms_total");

            $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='" . $mybb->user['uid'] . "' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
            $messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
            break;
        default:
            $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='" . $mybb->user['uid'] . "'");
            $messages = $db->fetch_array($query);
    }
    // the SUM() thing returns "" instead of 0 (make it int anyway)
    $messages['pms_unread'] *= 1;

    $lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_unread']);
    eval("\$private_messages = \"" . $templates->get("adv_sidebox_pms") . "\";");
}

inc / languages / english / adv_sidebox.lang.php
Line 62 to 63 removed and replaced with this :

// pm's
$l['adv_sidebox_pms_no_messages'] = 'Please {1} or {2} to use this functionality.';
$l['adv_sidebox_pms_login'] = 'login';
$l['adv_sidebox_pms_register'] = 'register';
$l['adv_sidebox_pms_user_disabled_pms'] = 'You have disabled this functionality in {1}.';
$l['adv_sidebox_pms_usercp'] = 'control panel';
$l['adv_sidebox_pms_disabled_by_admin'] = 'You dont have privileges to access this functionality, or it has been disabled by administrator. You may contact administrator for assistance.';

Query not necessary?

In adv_sidebox.php:

$query = $db->simple_select("users", "show_sidebox", "uid = '{$user['uid']}' AND show_sidebox='1'", array("order_dir" => 'DESC'));

    if($db->num_rows($query) > 0)
    {
        // checked
        $checked = 'checked="checked" ';
    }

Change to:

if($mybb->user['show_sidebox'] > 0)
    {
        // checked
        $checked = 'checked="checked" ';
    }

Not sure if can be like that, but seems to work.

Custom Title Textbox Description

When a custom title is in use a description is given but when a box without a custom title has the Use Custom Title setting to yes there is no description.

Disabling Who's Online causes File Errors

Uninstalling the Who's Online block causes errors in header. Below is the error im receiving. Not a huge issue but i didnt like the Who's Online with the avatars so i wanted to disable this and use my own custom version.
error

Update- I just notriced that the staff online block is attached somehow to the member list. I understand the issue now. Feel free to close this if you feel this isnt a bug.

Warning's when no sideboxes present

MyBB 1.6.9 / PHP 5.4.10

when there are no sideboxes present in 'manage sideboxes' tab, (for example - just after installing plugin)
following warnings occur in website front page

Warning [2] Invalid argument supplied for foreach() - Line: 99 - File: inc/plugins/adv_sidebox.php PHP 5.4.10 (Linux)

/inc/plugins/adv_sidebox.php 99 errorHandler->error
/inc/class_plugins.php 101 adv_sidebox_start
/index.php 25 pluginSystem->run_hooks

Ofcourse warnings can be hidden but it would be better to fix it now while there are still no other issues, than fight it later when many new warnings would accumulate on stack.

invalid html output when sidebox content empty

I have found that when content of sidebox is empty
then nothing is output within sidebox's tags,
which then is seen as invalid html by W3C validator
because there should be at least something like

It may happen in any situation when user not provide any content by himself,
or something prevents this content from being shown.
(eg. content may no more exsist (was deleted), user may have no privilages to view it, ect)
Good example of this is 'private messages' module, where if user is not loged in,
then ofcourse there are no messages for him as guest, and then content of sidebox
is empty which is output as invalid html (nothing here)

As always there are many solutions to this.
If there is no content for sidebox then content may be set to
or simply whole sidebox may be not displayed.
However, as there are many users, there are same many expectations from them
on how it should work.

  • part of them will dont like sidebox vanish 'now and then', 'breaking' user layout,
    and will want it to stay no matter what.
  • other part of users will probably ask 'why not hide it if there is nothing to show)

This is why i think that most universal solution would be,
'give user choice on what should happen when there is no content within sidebox'
by adding option in configuration->settings->advanced sidebox
'display empty sideboxes ?' 'yes / no'
and then -
When 'yes' enabled - empty content would be replaced and output as
When 'no' enabled - sidebox without content would be not displayed at all.

Good opportunity to turn 'bug' into 'new feature' hehe.

Module does not receive `his` settings.

for 1.4 feature branch

When module is added multiple times like

left - some module
left - some module 
left - some module 

then module function - somemodule_asb_build_template($settings)
does not receive his own $settings but possibly $settings of first module.

Eg.

left - some module - receive settings from 1st
left - some module - receive settings from 1st (not from 2nd as it should)
left - some module - receive settings from 1st (not from 3th as it should)

Rework Addon Module Settings

After much thought I think it would be best if each addon module just provided information to the core and allowed control of install/uninstall/is_installed/upgrades/etc be controlled by the core.

For instance if settings and templates were provided as associative arrays in the _info() function of that module then the core could handle making sure the module is installed properly.

In the end (before/when 1.4 is released) I'd like each sidebox to get a copy of it's parent addon modules settings that can contain completely separate values per side box.

I'd also like to add versioning, author info (link too) and built-in upgrade functionality to the addon modules.

Thoughts are welcome.

@avril-gh I have already made a little progress with this and while it will require a little restructuring of your Online Staff addon module I think you will be able to see why it is better.

I have made some changes to your module but no functionality has been changed at all. I am only reformatting the templates and settings.

Random quote Read More

Firstly, I think the image should be moved to adv_sidebox/images like other are. Now it's from external source (your site?) and that may cause problems if your site is down.

Secondly, maybe making it more theme specific would be better than image. I'm not sure what though. That's my try of redesigning it:
https://docs.google.com/file/d/0B6pgReiHWGdScE1aUG5DVzU4UUU/edit
https://docs.google.com/file/d/0B6pgReiHWGdSQ0NEUmVHNTFvMXc/edit

I added setting for max character display, if the post is longer it's cut off as it was but additionaly Read More is added, if not it isn't added.

Edit: Don't know if the modified code was added to requests (new to github), if not let me know.

Admin CP link error

done as requested going from version 1.4.2 to 1.5 Deactivate in ACP, Overwrite previous files
and then Activated again.

Now when i try to either use the link in the configuration section of the Admin CP or the Manage sidebox link in the plugin section i get this error.

Fatal error: Call to undefined method DirectoryIterator::getExtension() in /home/*******/public_html/testforum/inc/plugins/adv_sidebox/adv_sidebox_classes.php on line 1796

Random quote linebreak

There is a possibility that the query will get a post like:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa

It stretches the whole sidebar then.
What about checking for xx amount of chars (depending on width) and breaking the line if a word is longer than that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.