Skip to content

OUGC-Network/OUGC-Pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Project logo

OUGC Pages

Status GitHub Issues GitHub Pull Requests License


Create additional HTML or PHP pages directly from the Administrator Control Panel.

πŸ“œ Table of Contents

πŸš€ About

OUGC Pages is a versatile and feature-rich PHP plugin designed for MyBB forum administrators. It empowers administrators to effortlessly create, manage, and customize unlimited HTML or PHP pages within their forum. With this plugin, administrators can enhance their forum's functionality by adding unique and personalized content.

The plugin offers a user-friendly interface for creating, editing, and organizing pages, while its SEO-friendly URLs ensure optimal search engine visibility. Administrators can take advantage of features like seamless page export and import, extensive group access permissions, unlimited page categories, and automatic menu creation. From About Us pages to FAQ sections and more, it provides a comprehensive solution for creating engaging and dynamic custom content within MyBB forums.

Go up to Table of Contents

πŸ“ Getting Started

The following information will assist you into getting a copy of this plugin up and running on your forum.

Dependencies

A setup that meets the following requirements is necessary to use this plugin.

File structure

 .
 β”œβ”€β”€ inc
 β”‚ β”œβ”€β”€ plugins
 β”‚ β”‚ β”œβ”€β”€ ougc
 β”‚ β”‚ β”‚ β”œβ”€β”€ Pages
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ admin
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ module.php
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ templates
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ .html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminCategoryName.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminCategoryStatus.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminCodeMirror.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminCodeMirrorFooter.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminGroupSelect.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminPageName.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ category_link.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ category_list.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ category_list_empty.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ category_list_item.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ menu.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ menu_css.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ menu_item.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ navigation.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ navigation_next.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ navigation_previous.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ page_link.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ wrapper.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ wrapper_edited.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ wrapper_ucp.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ wrapper_ucp_nav.html
 β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ wrapper_ucp_nav_item.html
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ admin.php
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ adminHooks.php
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ core.php
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ forumHooks.php
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ settings.json
 β”‚ β”‚ β”œβ”€β”€ ougc_pages.php
 β”‚ β”œβ”€β”€ languages
 β”‚ β”‚ β”œβ”€β”€ espanol
 β”‚ β”‚ β”‚ β”œβ”€β”€ ougc_pages.lang.php
 β”‚ β”‚ β”‚ β”œβ”€β”€ admin
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ config_ougc_pages.lang.php
 β”‚ β”‚ β”œβ”€β”€ english
 β”‚ β”‚ β”‚ β”œβ”€β”€ ougc_pages.lang.php
 β”‚ β”‚ β”‚ β”œβ”€β”€ admin
 β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ config_ougc_pages.lang.php
 β”œβ”€β”€ admin
 β”‚ β”œβ”€β”€ modules
 β”‚ β”‚ β”œβ”€β”€ config
 β”‚ β”‚ β”‚ β”œβ”€β”€ougc_pages.php
 └── pages.php

Database Entity Relationship


Categories and Pages Entity Relationship

erDiagram
    CATEGORIES {
        int cid PK "category identifier"
        string(100) name "Only 100 characters allowed"
        string(255) description "Only 255 characters allowed"
        string(100) url UK "Only 100 characters allowed"
        string(255) allowedGroups "Only 255 characters allowed"
        int disporder "Display order"
        int visible "1 for enabling the category"
        int breadcrumb "1 for displaying the category inside the page breadcrumb"
        int displayNavigation "1 for displaying previous/next navigation inside pages"
        int buildMenu "1 for building a category menu"
        int wrapucp "1 to wrap the category inside the UserCP sidebar"
    }
    PAGES {
        int pid PK "page identifier"
        int cid FK "category identifier"
        string(100) name "Only 100 characters allowed"
        string(255) description "Only 255 characters allowed"
        string(100) url UK "Only 100 characters allowed"
        string(255) allowedGroups "Only 255 characters allowed"
        int disporder "Display order"
        int visible "1 for enabling the page"
        int menuItem "1 for displaying to category menu"
        int wrapper "1 to use a page wrapper"
        int wol "1 to update session location"
        int php "1 for PHP pages"
        int classicTemplate "1 for using a theme template"
        int init "Initialization point"
        string template "Page contents"
        int dateline "Edition time stamp"
    }
    CATEGORIES ||--|{ PAGES : contains

Installing

Follow the next steps in order to install a copy of this plugin on your forum.

  1. Download the latest package from the MyBB Extend site or from the repository releases.
  2. Upload the contents of the Upload folder to your MyBB root directory.
  3. Browse to Configuration Β» Plugins and install this plugin by clicking Install & Activate.
  4. Browse to Configuration Β» Manage Pages to create page categories and pages.

Updating

Follow the next steps in order to update your copy of this plugin.

  1. Browse to Configuration Β» Plugins and deactivate this plugin by clicking Deactivate.
  2. Follow step 1 and 2 from the Install section.
  3. Browse to Configuration Β» Plugins and activate this plugin by clicking Activate.
  4. Browse to Configuration Β» Manage Pages to create page categories and pages.

If you are updating to 1.8.33 from any previous version:

  1. After following the above steps, make sure to review your settings, templates, categories, and pages, as they suffered major updates for this version.

Template Modifications

The building of category menus requires that you edit the header template for each of your themes.

  1. Open the header template for editing.
  2. Find <li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>.
  3. Add <!--OUGC_PAGES_FOOTER--> right after.
  4. Save the template.

Go up to Table of Contents

πŸ›  Settings

Below you can find a description of the plugin settings.

Global Settings

  • Use SEO friendly URLs yesNo Key: seo Default: no
    • Whether if to enable SEO friendly URLs for pages.
  • Page URL Scheme text Key: seo_scheme Default: page-{url}
    • Enter the Page URL scheme. Leave empty to disable SEO URLs for Pages.
  • Category URL Scheme text Key: seo_scheme_categories Default: category-{url}
    • Enter the Category URL scheme. Leave empty to disable SEO URLs for Categories.
  • Items Per Page numeric Key: perpage Default: 20
    • Maximum number of items to show per page in the ACP list.
  • UserCP Nav Priority select Key: usercp_priority Default: 40
    • The priority given to UserCP navigation categories.

File Level Settings

Additionally, you can force your settings by updating the SETTINGS array constant in the ougc\Pages\Core namespace in the ./inc/plugins/ougc_pages.php file. Any setting set this way will always bypass any front-end configuration. Use the setting key as shown below:

define('ougc\Pages\Core\SETTINGS', [
    'seo' => false,
    'seo_scheme' => 'page-{url}',
    'seo_scheme_categories' => 'category-{url}',
    'perpage' => 20,
    'usercp_priority' => 40
]);

Enable PHP Pages

PHP code is disabled by default when uploading the plugin files. You can allow initExecute() to run eval() by setting the enableEval setting to true. This setting can not be set from the front-end and has to be set by editing the plugin settings at file-level in the ./inc/plugins/ougc_pages.php file:

define('ougc\Pages\Core\SETTINGS', [
    'enableEval' => true
]);

Configure Friendly Urls

To successfully use friendly urls for your page categories and pages, you need to follow the next steps:

  1. Enable the Use SEO friendly URLs global setting.
  2. Update your .htaccess or your NGINX configuration file to include the necessary rewrite rules.

The following would be the rewrite rules for .htacccess when using the default URL schemes:

RewriteRule ^category\-([^./]+)/?$ pages.php?category=$1 [L,QSA,NC]
RewriteRule ^page\-([^./]+)/?$ pages.php?page=$1 [L,QSA,NC]

The following would be the rewrite rules for NGINX when using the default URL schemes:

rewrite ^/((?i)category-([^./]+))$ /pages.php?category=$2;
rewrite ^/((?i)page-([^./]+))$ /pages.php?page=$2;

Go up to Table of Contents

πŸ“ Templates

The following is a list of templates available for this plugin. Uncommon in plugins, we use some templates exclusively for the Administrator Control Panel.

  • ougcpages
    • front end; used when viewing a category or non-PHP pages
  • ougcpages_adminCategoryName
    • back end; used when viewing categories
  • ougcpages_adminCategoryStatus
    • back end; used when viewing a category or page
  • ougcpages_adminCodeMirror
    • back end; used when adding or editing a page
  • ougcpages_adminCodeMirrorFooter
    • back end; used when adding or editing a page
  • ougcpages_adminGroupSelect
    • back end; used when adding or editing a category or page
  • ougcpages_category_link
    • back end; used for building a category link
  • ougcpages_page_link
    • back end; used for building a page link
  • ougcpages_adminPageName
    • back end; used when viewing pages in a category
  • ougcpages_category_list
    • front end; used when viewing a category
  • ougcpages_category_list_empty
    • front end; used when viewing a category
  • ougcpages_category_list_item
    • front end; used when viewing a category
  • ougcpages_menu
    • front end; used when category buildMenu is 1
  • ougcpages_menu_css
    • front end; used when category buildMenu is 1
  • ougcpages_menu_item
    • front end; used when category buildMenu is 1
  • ougcpages_navigation
    • front end; used when category displayNavigation is 1
  • ougcpages_navigation_next
    • front end; used when category displayNavigation is 1
  • ougcpages_navigation_previous
    • front end; used when category displayNavigation is 1
  • ougcpages_wrapper
    • front end; used when page wrapper is 1
  • ougcpages_wrapper_edited
    • front end; used page category wrapper is 1
  • ougcpages_wrapper_ucp
    • front end; used when category wrapucp is 1
  • ougcpages_wrapper_ucp_nav
    • front end; used when category wrapucp is 1
  • ougcpages_wrapper_ucp_nav_item
    • front end; used when category wrapucp is 1

Go up to Table of Contents

πŸ“– Usage

The following is a description of the Administrator Control Panel module form fields.

Categories: Main

  • Display Order text
    • The display order for each category.
  • Status text
    • Toggle category enabled status.

Categories: Add or Edit

  • Category Name text
    • Display name for this category.
  • Category Description text
    • Insert the description for this category.
  • Unique URL text
    • Insert the unique URL identifier for this category.
  • Viewable for Groups select Default: all
    • Select the groups that are allowed to browse this category.
  • Display in Breadcrumb yesNo Default: yes
    • Toggle to display this category in the navigation breadcrumb.
  • Show Navigation yesNo Default: yes
    • Toggle to show a previous/next pagination when browsing pages in this category.
  • Build Menu yesNo Default: yes
    • Toggle to build a dropdown menu for this category in the header.
  • Wrap UserCP Menu yesNo Default: no
    • If enabled, a section will be added to the UserCP for browsing this category and the category will be wrapped as if it was a UserCP section. Beware of errors if you allow guest access.

Pages: Main

  • Display Order text
    • The display order for each category.
  • Status text
    • Toggle category enabled status.

Pages: Add or Edit

  • Category select
    • Select the category this page belongs to.
  • Page Name text
    • Display name for this page.
  • Page Description text
    • Insert the description for this page.
  • Unique URL text
    • Insert the unique URL identifier for this page.
  • Viewable for Groups select Default: all
    • Select the groups that are allowed to see this page.
  • Add to Menu yesNo Default: yes
    • If "Build Menu" is enabled for this category, add link to this page in it.
  • Use Template Wrapper yesNo Default: yes
    • If enabled, the contents of non-PHP pages will be wrapped within the ougcpages_wrapper template.
  • Show In Who Is Online (WOL) List yesNo Default: yes
    • If disabled, activity within this page will be displayed as "Unknown location" pointing to the home page.
  • Eval PHP Code yesNo Default: no * See Enable PHP Pages.
    • If enabled, this page wilL be parsed as plain PHP code. Disable to use HTML content instead.
  • Use Theme Template yesNo Default: no
    • If enabled, the "Page Content" below will be ignored and a theme template will be used instead. The name for the template should follow the format ougcpages_pagePID, for example: ougcpages_page18
  • PHP Initialization Point select
    • Select the script section where this page should be loaded in when "Eval PHP Code" is enabled.
      • Initialization: Not even all plugins are checked at this point. Very low resource consumption. Around 4-6 queries are ran by this point.
      • Global Start: Mainly only session and language have been loaded. Around 6-8 queries are ran by this point.
      • Global Intermediate: Theme and templates have been loaded without header, welcome block, or footer being available yet. Around 8-10 queries are ran by this point.
      • Global End: Default; if unsure select this. Has the most compatibility for all forum features. Around 9-13 queries are ran by this point.
  • Page Content text
    • Insert the page HTML or PHP content below.

Pages: Import

  • Local File file
    • Select the XML file to import from your computer.
  • URL File text
    • Insert the URL of the XML file to import.
  • Ignore Version Compatibility yesNo Default: yes
    • Should this page be imported regardless of the version of OUGC Pages or Page Manager it was created for?.

Example Pages

The download package ships with nine example pages that can be used as production pages or as a reference for designing custom pages.

Browse Files

  • Forum stats signature File: Signature/OUGC_Pages_Signature.xml
    • A dynamically generated signature image that displays stats about your forum.
  • Banned List File: OUGC_Pages_Banned_List.xml
    • Displays a list of banned accounts.
  • HTML Test Page File: OUGC_Pages_HTML_Test_Page.xml
    • Plain HTML page meant to serve as reference.
  • List Profile Fields File: OUGC_Pages_List_Profile_Fields.xml
    • Displays a list of users and their custom profile fields values.
  • New Thread File: OUGC_Pages_New_Thread.xml
    • A new thread page meant to serve as reference.
  • PHP Test Page File: OUGC_Pages_PHP_Test_Page.xml
    • Basic PHP page that uses the MyBB parser meant to serve as reference.
  • Profile Fields File: OUGC_Pages_Profile_Fields.xml
    • Allow users to update their custom profile fields.
  • ShoutBox Page File: OUGC_Pages_ShoutBox_Page.xml
    • Displays the DVZ Shoutbox in a custom PHP page.
  • Sticky Threads File: OUGC_Pages_Sticky_Threads.xml
    • Displays a list with all sticky threads.

Third Party Support

Below is a list and short description of any compatibility with third party MyBB plugins.

  • PHP in Templates / Template Conditionals
    • If installed, you should be able to use any allowed syntax, expression, or tags inside the Page Content for pages, as this page field is parsed as a template.

Go up to Table of Contents

🧩 Plugins

Provides a list of available variables, functions, and methods for plugins to use.

Variables available at the global scope:

  • (array) $categoriesCache array containing cached categories data when visible is equal to 1 and allowedGroups is not empty, ordered by cid, disporder, array key is set to category identifier cid:
    • (string) name
    • (string) description
    • (string) url
    • (string) allowedGroups
      • -1 for all groups
      • CSV for allowed groups
    • (int) breadcrumb
    • (int) displayNavigation
    • (int) buildMenu
    • (int) wrapucp
  • (array) $pagesCache array containing cached pages data when visible is equal to 1 and allowedGroups is not empty, ordered by pid, disporder, array key is set to page identifier pid:
    • (int) cid
    • (string) name
    • (string) description
    • (string) url
    • (string) allowedGroups
      • -1 for all groups
      • CSV for allowed groups
    • (int) menuItem
    • (int) wrapper
    • (int) wol
    • (int) php
    • (int) classicTemplate
    • (int) init
    • (int) dateline
  • (bool) $isCategory true if current page is a category.
  • (bool) $isPage``true if current page is a page.
  • (int) $categoryID current category identifier.
  • (int) $pageID current page identifier, 0 when $isPage is false.
  • (array) $categoryData array containing current category page:
    • (string) name
    • (string) description
    • (string) url
    • (string) allowedGroups
      • -1 for all groups
      • CSV for allowed groups
    • (int) breadcrumb
    • (int) displayNavigation
    • (int) buildMenu
    • (int) wrapucp
  • (array) $pageData array containing current page, empty when $isPage is false.
    • (int) cid
    • (string) name
    • (string) description
    • (string) url
    • (string) allowedGroups
      • -1 for all groups
      • CSV for allowed groups
    • (int) menuItem
    • (int) wrapper
    • (int) wol
    • (int) php
    • (int) classicTemplate
    • (int) init
    • (string) template
    • (int) dateline

List of available hooks:

  • ougcPagesExecutionInit
  • ougcPagesExecutionGlobalStart
  • ougcPagesExecutionGlobalIntermediate
  • ougcPagesExecutionGlobalEnd
  • oucPagesCategoryInsertEnd Array object is passed by reference with the following variables:
  • oucPagesCategoryUpdateEnd Array object is passed by reference with the following variables:
    • (array) categoryID inserted/updated category identifier.
    • (array) categoryData array containing category data (not always available)
      • (string) name
      • (string) description
      • (string) url
      • (string) allowedGroups
        • -1 for all groups
        • CSV for allowed groups
        • empty for none
      • (int) disporder
      • (int) visible
      • (int) breadcrumb
      • (int) displayNavigation
      • (int) buildMenu
      • (int) wrapucp
  • oucPagesCategoryDeleteEnd Variable passed by reference:
    • (int) $categoryID deleted page identifier.
  • oucPagesPageInsertEnd Array object is passed by reference with the following variables:
  • oucPagesPageUpdateEnd Array object is passed by reference with the following variables:
    • (array) pageID inserted/updated page identifier.
    • (array) pageData array containing page data (not always available)
      • (int) cid
      • (string) name
      • (string) description
      • (string) url
      • (string) allowedGroups
        • -1 for all groups
        • CSV for allowed groups
        • empty for none
      • (int) disporder
      • (int) visible
      • (int) menuItem
      • (int) wrapper
      • (int) wol
      • (int) php
      • (int) classicTemplate
      • (int) init
      • (string) template
      • (int) dateline
  • oucPagesPageDeleteEnd Variable passed by reference:
    • (int) $pageID deleted page identifier.
  • oucPagesStart
  • oucPagesEnd

List of available methods at the ougc\Pages\Core namespace:

  • loadLanguage(): void { ... }
  • getSetting(string $settingKey = ''): string { ... }
  • cacheUpdate(): void { ... }
  • cacheGetPages(): array { ... }
  • cacheGetCategories(): array { ... }
  • initExecute(int $pageID): never { ... }
  • initSession(): void { ... }
  • categoryInsert(array $inputData = [], int $categoryID = 0, bool $doUpdate = false): int { ... }
  • categoryUpdate(array $inputData = [], int $categoryID = 0): int { ... }
  • categoryDelete(int $categoryID): bool { ... }
  • categoryGet(int $categoryID, string $categoryUrl = ''): array { ... }
  • categoryQuery(array $fieldList = ['*'], array $whereConditions = ['1=1'], array $queryOptions = []): array { ... }
  • categoryGetByUrl(string $categoryUrl): array { ... }
  • categoryGetLink(int $categoryID): string { ... }
  • pageInsert(array $inputData = [], int $pageID = 0, bool $doUpdate = false): int { ... }
  • pageUpdate(array $inputData = [], int $pageID = 0): int { ... }
  • pageDelete(int $pageID): int { ... }
  • pageGet(int $pageID, string $pageUrl = ''): array { ... }
  • pageQuery(array $fieldList = ['*'], array $whereConditions = ['1=1'], array $queryOptions = []): array { ... }
  • pageGetByUrl(string $url): array { ... }
  • pageGetLink(int $pageID): string { ... }

List of available constants

The following is a list of constants are defined dynamically, defined()should be used to make sure they are defined.

  • OUGC_PAGES_STATUS_IS_CATEGORY
    • int defined as the category identifier when trying to view a valid category
  • OUGC_PAGES_STATUS_IS_PAGE
    • int defined as the page identifier when trying to view a valid page
  • OUGC_PAGES_STATUS_CATEGORY_INVALID
    • bool defined as true when trying to view an invalid category
  • OUGC_PAGES_STATUS_CATEGORY_NO_PERMISSION
    • bool defined as true when permission to view a category is denied
  • OUGC_PAGES_STATUS_PAGE_INVALID
    • bool defined as true when trying to view an invalid page
  • OUGC_PAGES_STATUS_PAGE_NO_PERMISSION
    • bool defined as true when permission to view a page is denied
  • OUGC_PAGES_STATUS_PAGE_INIT_GLOBAL_START
    • int defined as the page identifier when trying to view a valid page which php value is 1 and init value is 2
  • OUGC_PAGES_STATUS_PAGE_INIT_GLOBAL_INTERMEDIATE
    • int defined as the page identifier when trying to view a valid page which php value is 1 and init value is 3

Go up to Table of Contents

⛏ Built Using

Go up to Table of Contents

✍️ Authors

See also the list of contributors who participated in this project.

Go up to Table of Contents

πŸŽ‰ Acknowledgements

Go up to Table of Contents

🎈 Support & Feedback

This is free development and any contribution is welcome. Get support or leave feedback at the official MyBB Community.

Thanks for downloading and using our plugins!

Go up to Table of Contents