wildcardsearch / advanced-sidebox Goto Github PK
View Code? Open in Web Editor NEWA plugin for MyBB forums that displays custom boxes on various forum pages.
License: GNU General Public License v3.0
A plugin for MyBB forums that displays custom boxes on various forum pages.
License: GNU General Public License v3.0
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.
Add an option to override mybb's portals' max thread setting,
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.
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.
Oryginally reported by geminii at MyBB foum Post: #152
When I turn on the Advanced Sidebox 1.3.4, my attachments is disappear, and I can't download it.
Preliminary identified possible source of issue - 'latest threads addon'.
$thread is declared as global and modified in adv_sidebox/modules/latest_threads/adv_sidebox_module.php causing thread titles to all get changed to the last thread in the latest_threads list.
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.
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.
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.
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. ๐
Missed the change from objects to arrays. Have fixed and will update soon.
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.
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.
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
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?
The left-hand template was never copied to the new add-on module style.
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.
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.
We can discuss here issue reported on MyBB forums by Lexy
I posted request to Lexy to provide screenshots without blured address bar parameters.
(noticed the screenshot two even while blured, had unusual long parameters list)
It can be everything, not necessarily plugin fault.
Anyway, we need more info to trace it.
How hard would it be to make your side-boxes collapsible like the forums are?
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.
Finally repaired PC with XAMPP to test, found an issue. Screenshot explains everything. Happens no matter which forums I want to pull it from or if I leave the field blank.
https://docs.google.com/file/d/0B6pgReiHWGdSX19fMWVqbUdOaUE/edit?usp=sharing
Edit:
As I see it's done like that for messages with less than 20 chars. Why?
I'd attach the fixes as they're really simple but I still don't have idea how to do it.
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.
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.
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.
This feature has been requested more than once and I now see a way to make it happen.
Will be added upon release of 1.4
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'
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.
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.
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.
In welcome box there is no default avatar, in other boxes I think it should be drawn from theme not images root.
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
Test environment - clean MyBB 1.6.9 / Adv Sidebox 1.3 / PHP 5.4.10
Issue's :
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.
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.';
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.
The first boxes group permissions are affecting the subsequent boxes. Will add a simple reset to permission-check boolean in each iteration.
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.
$theme
was mistakenly deleted from the global list by me ๐
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.
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.
SuperAdmin can automatically edit side boxes, but any other admin is disallowed acces by default.
This shouldn't be the case.
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.
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
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.
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?
At times BBCode (specifically [img]
code) gets through and causes a nasty display.
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.
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.
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)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.