Skip to content

About

YAF.NET (aka Yet Another Forum.NET) for mojoPortal

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

YAFNET-mojoPortal

YAF.NET (aka Yet Another Forum.NET) for mojoPortal

Adds a YAF.NET Forum feature to mojoPortal: put it on a page and the forum runs inside that page, with the mojoPortal login, users and roles.

  • YAF.NET 3.2.18 (the .NET Framework version, netfx branch)
  • mojoPortal 4.x (.NET Framework 4.8.1)
  • all databases of mojoPortal and YAF.NET: SQL Server, MySQL, PostgreSQL, SQLite (the forum tables, prefix yaf_, go into the mojoPortal database by default; with SQLite the forum gets its own database file App_Data\yaf.db)

Installation package

There is an installation package for each mojoPortal edition (database) - use the one of your mojoPortal:

mojoPortal edition package
SQL Server (mojoportal-mssql) YAF-mojoPortal-v<version>-mssql.zip
MySQL (mojoportal-mysql) YAF-mojoPortal-v<version>-mysql.zip
PostgreSQL (mojoportal-pgsql) YAF-mojoPortal-v<version>-pgsql.zip
SQLite (mojoportal-sqlite) YAF-mojoPortal-v<version>-sqlite.zip

The packages only differ in the YAF data provider and its database client. No source code or build tools are needed: extract the package and run

.\Install-YafMojoPortal.ps1 -MojoPortalWebDir C:\inetpub\mojoportal

or copy the files and merge the Web.config changes by hand - see the INSTALL.md in the package.

mojoPortal has no extension installer like DNN, so the package is a zip with the files for the web root (files\), the install script and the Web.config changes (web.config-changes.xml).

The packages are on the releases page. They are built by the Release GitHub workflow on every push to master when the YAF.NET version of the YAFNET submodule (yafsrc\GlobalAssemblyInfo.cs, also the version of the module) is newer than the latest release - so a submodule update to a new YAF.NET version creates the next release. The module is built against the assemblies of a mojoPortal release (MOJOPORTAL_VERSION in .github/workflows/release.yml).

Getting Started with Development

This project is dependent upon the parent solution, YAFNET (like the YAFNET-DNN module).

YAFNET-mojoPortal\
  YAFNET\            git submodule: https://github.com/YAFNET/YAFNET.git, branch netfx (YAF.NET 3.2.x)
  yafsrc\            NTFS junction -> YAFNET\yafsrc (created by init-yafsrc.ps1, not in git)
  yaf_mojoportal\    the mojoPortal module (YAF.MojoPortal.slnx)
  init-yafsrc.ps1
  1. Clone this repository.

  2. From a Windows PowerShell prompt in the repo root, run .\init-yafsrc.ps1. This initializes the YAFNET submodule and creates the junction yafsrc\ -> YAFNET\yafsrc\.

  3. Build YAF.NET and the module and install them into a mojoPortal site:

    .\yaf_mojoportal\deploy\Deploy-YafMojoPortal.ps1 -MojoPortalWebDir C:\path\to\mojoportal\Web -BuildYaf

    -BuildYaf restores the YAF packages and builds yafsrc\YAF.NET-SqlServer.slnx (needed once and after a submodule update), without it only the module is built. The default -MojoPortalWebDir is a mojoPortal checkout next to the YAFNET folder (..\..\mojoportal\Web from the repo root). Use -ConnectionString for a separate forum database. The script can be run again for updates.

To later update to a newer commit of the YAFNET netfx branch, run git submodule update --remote YAFNET (the yafsrc junction does not need to be recreated) and deploy again with -BuildYaf.

To build the installation package:

.\yaf_mojoportal\deploy\Build-Package.ps1 -BuildYaf

The zips (one for each database, -Database mssql,mysql,pgsql,sqlite to build only some) are created in yaf_mojoportal\bin\package\. Deploy-YafMojoPortal.ps1 takes -Database too (default mssql). Building the module needs the mojoPortal assemblies: -MojoPortalWebDir can be any mojoPortal 4.x site (only its bin folder is used), not the mojoPortal source.

Script (yaf_mojoportal\deploy\)
Build-Package.ps1 builds YAF.NET (-BuildYaf) and the module, creates the package folder and the zip
Install-YafMojoPortal.ps1 installs a package into a site (part of the package)
Deploy-YafMojoPortal.ps1 development: Build-Package.ps1 + Install-YafMojoPortal.ps1 in one step

Install into mojoPortal

  1. Run the install script of the package or the deploy script (see above).
  2. Open /Setup/Default.aspx of the site once - mojoPortal registers the feature ("Configuring YAF.NET Forum").
  3. Add the YAF.NET Forum feature to a page and open the page as a mojoPortal administrator: the forum database and the board are created on that first visit, the administrator becomes the forum host admin.
  4. The application pool needs write access to ~/yaf/uploads (attachments, albums, avatars).

What the install script changes

Where What
bin the YAF assemblies and YAF.MojoPortal.Module.dll. Assemblies that mojoPortal already has are never replaced (a rebuild of mojoPortal would bring them back), the YAF references are redirected to them. Lucene.Net 4.8 is not deployed (see Search).
~/yaf/ the YAF pages, controls, scripts, themes and languages, and its own web.config (YAF control prefixes, UTF-8, handlers)
~/YafForum/, App_GlobalResources, Setup/applications/yafnet the mojoPortal feature
Web.config (backup Web.config.<date>.bak) the YAF.* app settings, the yafnet connection string, owin:AutomaticAppStartup=false and binding redirects to the assembly versions in bin

Nothing has to be added to global.asax, the module registers itself (PreApplicationStartMethod).

Module settings

Setting
Forum Board ID the YAF board of the module (default 1)
Use the language of the site the forum language follows the mojoPortal culture (when YAF has the language)

The module title gets a "Forum Administration" link for editors (YAF checks the admin rights itself).

How it works

  • Login: mojoPortal does the login, the YAF login, registration and logout are turned off (YAF.AllowLoginAndLogoff=false). Guests that need to log in are sent to the YAF "custom login redirect url" (host settings), which the module sets to the mojoPortal login page (with a return url to the forum page).
  • Users: each mojoPortal user gets a YAF login account (yaf_AspNetUsers, id = mojoPortal user guid) and a forum user. Name, display name and email follow mojoPortal.
  • Roles: mojoPortal Admins are forum host admins and members of the YAF Administrators group. To map a mojoPortal role, create a YAF group with the same name as the role - the membership then follows mojoPortal (checked every 5 minutes per user). YAF groups without a matching role are managed in the forum only. All users are in the YAF start groups (e.g. Registered Users).
  • Links: the forum links are the url of the mojoPortal page plus the forum parameters (/forum?g=Topics&f=2). The page is saved in the board settings (for links in emails).
  • Web API: mojoPortal registers the attribute routes (also the ones of the YAF controllers), the module maps the YAF calls ~/yaf/api/... to them and adds the YAF filters and the session state for these calls only.
  • Search: mojoPortal needs Lucene.Net 3.0.3, YAF 3.2 uses Lucene.Net 4.8 - both have the same file name, so the YAF search is replaced by a database search (MojoPortalSearch). It understands the queries of the YAF search page (topic, author, tags, phrases), no search index is needed.
  • Upgrades: deploy a newer YAF 3.2.x, the database is upgraded automatically on the next visit.

Known limitations

  • Some profile functions of YAF are only hidden for DNN (YAF core checks Config.IsDotNetNuke), so they are visible inside mojoPortal although mojoPortal manages them: change password, delete account and the user import/sync in the forum admin. They work on the forum login accounts only and have no effect on the mojoPortal login.
  • The YAF scripts bring Bootstrap 5 (JavaScript); a mojoPortal skin that loads another Bootstrap version can conflict.
  • The forum sends its emails with its own mail settings (system.net/mailSettings), not with the SMTP settings of mojoPortal.

Uninstall

Remove the feature from the pages, delete ~/yaf, ~/YafForum, Setup/applications/yafnet, App_GlobalResources/YafForumResources.resx and bin/YAF*.dll, and restore Web.config from the backup. The forum tables (yaf_*, also the login accounts yaf_AspNet*) stay in the database (with SQLite: App_Data\yaf.db).

About

YAF.NET (aka Yet Another Forum.NET) for mojoPortal

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages