BbCode pages

BbCode pages [Paid] 1.3.1

No permission to buy ($25.00)

Xon

Well-known member
Xon submitted a new resource:

BbCode pages - Enhance pages with bb-code

Adds a "bb-code mode" to Page node type, which supports bb-code and attachments, with edit history support.

Page nodes in 'bb-code mode' support editing via the front-end, in addition to the admincp.

The original "template" data is updated with the HTML of what a guest would see for that bb-code.

Permissions;
  • View attachments to pages
  • Can edit any page
  • Upload attachments to pages
  • Upload videos to pages
  • Attachment Size (kb)
  • Maximum Attachment Count

Read more about this resource...
 
Xon updated BbCode pages with a new update entry:

1.0.3 - Bugfix update.

  • Fix handling of when an admin edits a non-bb-code page and saves it as bb-code. This fixes cases where attachment counter bugs count and doesn't correctly work.

    When an admin edits a non-bb-code page from the front-end, the existing template will be rendered to html and then to bb-code. This is a lossy and not particularly reliable process, so it is recommended the original template contents is kept on hand to be manually converted to bb-code

Read the rest of this update entry...
 
Is there a recommended way of managing sidebars? Over the next few months I'll be creating a bunch of pages that look like the stock XF layout of having a main content area and then a right sidebar.

EDIT: I should mention, I'm not planning on using widgets in the sidebars as the content of each pages sidebar will be static content unique to the individual page so I just need to do the layout.
 
Brilliant add on.

Does it work with help pages?

Just the page node-type.

Actually, it's worth noting that it kind of can! The add-on takes the BB code and converts it to HTML which you can then simply paste into Help pages, HTML templates, widgets, etc. Because the add-on converts BB code to HTML so well, I think you should add that to its description, Xon. More people should know about the utility of this!

For example, the add-on with output all this crazy HTML from what I made with BB code:
HTML:
<div class="bbTable">
<table style='width: 100%'><tr><th></th><th><div style="text-align: center"><b><span style="font-size: 18px">Regular Member</span></b>&#8203;</div></th><th><div style="text-align: center"><span style="font-size: 18px"><span style="color: rgb(44, 130, 201)">Tacoma3G Supporter</span></span>&#8203;</div></th></tr><tr><td><div style="text-align: right">add new posts &amp; threads:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">search all posts &amp; threads:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">edit your posts:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">edit profile details:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">buy, sell, trade items:&#8203;</div></td><td><div style="text-align: center">yes, limited&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">participate in giveaways:&#8203;</div></td><td><div style="text-align: center">yes, limited&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">upload photos &amp; videos to posts:&#8203;</div></td><td><div style="text-align: center">photos only&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">use private messaging:&#8203;</div></td><td><div style="text-align: center">receive only&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">add profile avatar &amp; banner image:&#8203;</div></td><td><div style="text-align: center">avatar only&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">change website colors &amp; use dark mode:&#8203;</div></td><td><div style="text-align: center">light/dark only&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">use push notifications:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">use custom user title in posts:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">change username:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">use built-in forum bookmarks system:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">add custom signature to posts:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">access private forum sections:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">custom build thread URL:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">blue username &amp; supporter badge:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">access exclusive vendor discounts:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr><tr><td><div style="text-align: right">use new website features early:&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="✖️" title="Multiplication sign    :heavy_multiplication_x:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2716.png" data-shortname=":heavy_multiplication_x:" />&#8203;</div></td><td><div style="text-align: center"><img class="smilie smilie--emoji" loading="lazy" alt="☑️" title="Check box with check    :ballot_box_with_check:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2611.png" data-shortname=":ballot_box_with_check:" />&#8203;</div></td></tr></table>
</div>

Which I can then paste wherever I want, allowing me to create this nice donating members benefits overlay (which is actually part of a different add-on by @Siropu:

1646839739200.webp
 
@Xon - found a couple bugs.

1. (This ended up being the answer to the question I had about the widget not displaying): If you edit the BB code part, then add HTML into the HTML part, the newly added HTML will not show on the frontend. Whether you add the BB code, save, then add the HTML, save - or add both BB code and HTML and then save only once, it won't show. It also won't show if you edit the template directly.

To get it to work, I had to clear all BB code and HTML and save, basically starting fresh. Only then could I add the BB code, save, add to the HTML, save, and see it on the frontend.

If this was confusing I can try to take a video of it.

2. Permissions behave odd: A page that is a child of a node where the node is private, inherits the privacy. Therefore, the page is private without manually making it as such. Standard XF behavior.

But with the add-on, the page will display red on the node permissions list, suggesting it has custom settings. I didn't give it custom settings but it had user permissions for my account showing. I didn't give myself explicit permissions. Clicking into those permission settings, all permissions are set to inherit, which is the XF default, which should = no explicit permissions are set and therefore should not show my name or the red text.

The reason this was happening was because of some confusion between the page permissions and the user / user group permissions. I assume having permissions to use BB code pages as a user or user group was making the page permissions think it was no longer default.


Request:

I don't know how difficult this would be, but could you create a second version of this add-on that only does the conversion part and is not built into the pages on the back or frontend? I really like the BB code to HTML conversion because it lets me paste the HTML in all sorts of widgets, pages, templates, etc. So I have been using it more for that than anything. It would be handy to have a stripped down version that only provides the converter.
 
1. (This ended up being the answer to the question I had about the widget not displaying): If you edit the BB code part, then add HTML into the HTML part, the newly added HTML will not show on the frontend. Whether you add the BB code, save, then add the HTML, save - or add both BB code and HTML and then save only once, it won't show. It also won't show if you edit the template directly.

To get it to work, I had to clear all BB code and HTML and save, basically starting fresh. Only then could I add the BB code, save, add to the HTML, save, and see it on the frontend.

If this was confusing I can try to take a video of it.
I think the confusion is the add-on isn't really designed to switch between bb-code mode => html like that so gets a little confused in it's state tracking.

2. Permissions behave odd: A page that is a child of a node where the node is private, inherits the privacy. Therefore, the page is private without manually making it as such. Standard XF behavior.

But with the add-on, the page will display red on the node permissions list, suggesting it has custom settings. I didn't give it custom settings but it had user permissions for my account showing. I didn't give myself explicit permissions. Clicking into those permission settings, all permissions are set to inherit, which is the XF default, which should = no explicit permissions are set and therefore should not show my name or the red text.

The reason this was happening was because of some confusion between the page permissions and the user / user group permissions. I assume having permissions to use BB code pages as a user or user group was making the page permissions think it was no longer default.
This is standard XF node behaviour. Private nodes without any permissions still show up as red/marked as customized.
 
This is standard XF node behaviour. Private nodes without any permissions still show up as red/marked as customized.
Right, but this was a node without customized permissions that is a child of a node that does have the private setting.

1647046707703.webp

The two nodes that say [TEST] were showing as red but with the add-on disabled, they go back to normal like this. Either way, not a big deal.
 
Hello @Xon

This addon was recently added to a site and this error popped up after installation when trying to edit an existing page via AdminCP. (The pre-existing pages can be viewed by end users without issue, but management cannot edit any pages at all after install & configuration of this addon)

Note: This does NOT impact the creation and editing of NEW pages after the addon is installed. This appears to be operating normally.

Code:
ErrorException: [E_WARNING] Attempt to read property "Page" on null src/addons/SV/BbCodePages/Attachment/PageText.php:157
Generated by: sys_bot Nov 12, 2022 at 12:17 PM
Stack trace
#0 src/addons/SV/BbCodePages/Attachment/PageText.php(157): XF::handlePhpError(2, '[E_WARNING] Att...', '/home/nginx/dom...', 157)
#1 src/addons/SV/BbCodePages/Attachment/PageText.php(88): SV\BbCodePages\Attachment\PageText->getPageTextFromContext(Array)
#2 src/XF/Repository/Attachment.php(22): SV\BbCodePages\Attachment\PageText->getConstraints(Array)
#3 src/addons/SV/BbCodePages/XF/Admin/Controller/Page.php(53): XF\Repository\Attachment->getEditorData('svPageText', Object(SV\BbCodePages\Entity\PageText), NULL)
#4 src/addons/SV/BbCodePages/XF/Admin/Controller/Page.php(31): SV\BbCodePages\XF\Admin\Controller\Page->getAttachmentData(Object(SV\BbCodePages\XF\Entity\Page))
#5 src/XF/Admin/Controller/AbstractNode.php(59): SV\BbCodePages\XF\Admin\Controller\Page->nodeAddEdit(Object(SV\ElasticSearchEssentials\XF\Entity\Node))
#6 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\AbstractNode->actionEdit(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Page', 'Edit', Object(XF\Mvc\RouteMatch), Object(SV\BbCodePages\XF\Admin\Controller\Page), NULL)
#8 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\BbCodePages\XF\Admin\Controller\Page), NULL)
#9 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2353): XF\Mvc\Dispatcher->run()
#11 src/XF.php(524): XF\App->run()
#12 admin.php(13): XF::runApp('XF\\Admin\\App')
#13 {main}
Request state
array(4) {
  ["url"] => string(45) "/admin.php?pages/terms-expanded.94/edit"
  ["referrer"] => string(44) "https://xyzyourfavoritesitexyz.com/admin.php?nodes/"
  ["_GET"] => array(1) {
    ["pages/terms-expanded_94/edit"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

Disabling the addon returns normal administrative functions to edit existing pages.

Environment:
XF 2.2.11
NGINX 1.21.6
PHP 8.0.25
Standard Library 1.14.0
BB Codes Pages 1.1.1

Steps to reproduce: (tested on clean staging server as well)
1) Install addon by uploading files to server, execute CLI install command.
2) Confirm Permission Settings/Configuration
3) Attempt to Edit Existing Page > Error results as noted above.
 
Last edited:
Back
Top Bottom