Skip to content

Comments

Demo/Portal example add-on update#76

Open
QuackieMackie wants to merge 10 commits intoxenforo-ltd:mainfrom
QuackieMackie:demo_portal_error_fix
Open

Demo/Portal example add-on update#76
QuackieMackie wants to merge 10 commits intoxenforo-ltd:mainfrom
QuackieMackie:demo_portal_error_fix

Conversation

@QuackieMackie
Copy link
Contributor

@QuackieMackie QuackieMackie commented Jan 22, 2026

The add-on was a tad outdated, so I rewrote it using a Xenforo 2.3.8 Preview installation.
I changed as little as I could, only fixing errors as I saw them.

If I missed any, please let me know. :)

Summary by CodeRabbit

  • Refactor
    • Admin, public and service extension/class names updated for framework alignment; references and examples adjusted — no UI changes expected.
    • Public method signatures now return explicit boolean and support error-by-reference for clearer error handling.
    • Repository resolution and attachment handling modernised for more reliable lookups and clearer examples.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

Multiple documentation and code example updates reflecting widespread renaming of controller and service classes/files (e.g., Forum → ForumController, Creator → CreatorService, Editor → EditorService), an Entity method signature change to canFeatureUnfeature(&$error = null): bool, and repository class/name updates (including AttachmentRepository).

Changes

Cohort / File(s) Summary
Documentation
docs/lets-build-an-add-on.md
Updated code blocks and examples to match renamed classes, file paths, method signature changes, and repository name corrections.
Admin controller extensions
Demo/Portal/XF/Admin/Controller/...
.../Forum.php.../ForumController.php
Extension target updated from XF\Admin\Controller\Forum to XF\Admin\Controller\ForumController; extension class and file renamed to ForumController.
Public (pub) controller extensions
Demo/Portal/XF/Pub/Controller/...
.../Forum.php.../ForumController.php, .../Thread.php.../ThreadController.php
Base pub controller classes changed to ForumController and ThreadController; extension classes and file paths renamed accordingly.
Service classes
Demo/Portal/XF/Service/Thread/...
Creator.phpCreatorService.php, Editor.phpEditorService.php
Service class and file renames: CreatorCreatorService, EditorEditorService; references and base-class names updated.
Entity method change
Demo/Portal/XF/Entity/Thread.php
Method signature updated to canFeatureUnfeature(&$error = null): bool (pass-by-reference error parameter and explicit bool return).
Repository usage and attachment
.../Repository/..., files referencing XF\Repository\Attachment
Repository resolution modernised to class-based calls (e.g., repository(FeaturedThread::class)); XF\Repository\Attachment replaced by XF\Repository\AttachmentRepository.
Miscellaneous code blocks
Demo/Portal/..., src/...
Numerous code snippet updates to reflect new class names, namespaces, and method signatures across examples.
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "Demo/Portal example add-on update" is vague and generic, using non-descriptive language that fails to convey meaningful information about the specific changes made. Provide a more specific title that captures the main refactoring effort, such as "Refactor Demo/Portal add-on class names and update method signatures for XF 2.3.8" or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/lets-build-an-add-on.md`:
- Line 753: Line 753 contains a hard tab before the function declaration public
function canFeatureUnfeature(&$error = null): bool — replace the hard tab with
spaces to match surrounding indentation and satisfy MD010; update the whitespace
at the start of that line (the declaration for canFeatureUnfeature) so it uses
the same number of spaces as other lines in the file.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa8a30a and f8b88bb.

⛔ Files ignored due to path filters (1)
  • docs/files/Demo-Portal-1.0.0 Alpha.zip is excluded by !**/*.zip
📒 Files selected for processing (1)
  • docs/lets-build-an-add-on.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/lets-build-an-add-on.md

753-753: Hard tabs
Column: 1

(MD010, no-hard-tabs)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@docs/lets-build-an-add-on.md`:
- Around line 828-830: The lines inside the setupThreadEdit function use hard
tabs for indentation which violates MD010; open the function definition for
public function setupThreadEdit(\XF\Entity\Thread $thread) and the docblock line
referencing \Demo\Portal\XF\Service\Thread\EditorService and replace tabs with
spaces so all indentation is space-based (consistent with the project's 2- or
4-space style).
- Around line 369-371: The prose instructs creating `Forum.php` but the example
code block and title use `ForumController.php`; update the instructional text to
reference `ForumController.php` so the filename in the narrative matches the
code block (path: src/addons/Demo/Portal/XF/Admin/Controller and the file name
shown in the code block/Title), ensuring the description, the example filename,
and any subsequent mentions consistently use `ForumController.php`.
- Line 367: Update the wording to use the correct indefinite article before
"Extension class name": change "a Extension class name" to "an Extension class
name" in the sentence that references the base class
`XF\Admin\Controller\ForumController` and the extension
`Demo\Portal\XF\Admin\Controller\ForumController` (the sentence ending with "We
should create that class before clicking Save.").
♻️ Duplicate comments (1)
docs/lets-build-an-add-on.md (1)

754-754: Replace hard tab indentation to satisfy MD010.
This is the same hard‑tab issue previously reported for this line.

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8b88bb and 597a371.

⛔ Files ignored due to path filters (1)
  • docs/files/Demo-Portal-1.0.0 Alpha.zip is excluded by !**/*.zip
📒 Files selected for processing (1)
  • docs/lets-build-an-add-on.md
🧰 Additional context used
🪛 LanguageTool
docs/lets-build-an-add-on.md

[misspelling] ~367-~367: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...orumController`. And we need to specify a "Extension class name" which is the cla...

(EN_A_VS_AN)


[typographical] ~433-~433: There might be a comma missing.
Context: ...CP_CreatorService { } ``` While we're here we will also create another extension. ...

(IF_PRP_PRP_COMMA)


[style] ~765-~765: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e and feature or unfeature accordingly. We are going to need two new class extensi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~767-~767: Consider removing “of” to be more concise
Context: ... that in the relevant location. Here is all of the code for the extended class: ```php ti...

(ALL_OF_THE)

🪛 markdownlint-cli2 (0.18.1)
docs/lets-build-an-add-on.md

754-754: Hard tabs
Column: 1

(MD010, no-hard-tabs)


828-828: Hard tabs
Column: 1

(MD010, no-hard-tabs)


829-829: Hard tabs
Column: 1

(MD010, no-hard-tabs)


830-830: Hard tabs
Column: 1

(MD010, no-hard-tabs)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/lets-build-an-add-on.md (1)

870-899: Fix the file path in the code block title to match the forum controller section.
The prose says to edit the extended forum controller, but the code block title shows XF/Pub/Controller/ThreadController.php. This can misdirect readers.

Proposed fix
-```php title="src/addons/Demo/Portal/XF/Pub/Controller/ThreadController.php"
+```php title="src/addons/Demo/Portal/XF/Pub/Controller/ForumController.php"
🤖 Fix all issues with AI agents
In `@docs/lets-build-an-add-on.md`:
- Line 433: Update the sentence in the documentation text to include a comma
after "here": change "While we're here we will also create another extension."
to "While we're here, we will also create another extension." in the
docs/lets-build-an-add-on.md file (the line describing creating the extension
class Demo\Portal\XF\Pub\Controller\ForumController and the file path
src/addons/Demo/Portal/XF/Pub/Controller/ForumController.php).
♻️ Duplicate comments (1)
docs/lets-build-an-add-on.md (1)

754-754: Hard tabs remain in code block indentation.
Please replace hard tabs with spaces to satisfy MD010.

Also applies to: 828-829

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 597a371 and e39d6e9.

📒 Files selected for processing (1)
  • docs/lets-build-an-add-on.md
🧰 Additional context used
🪛 LanguageTool
docs/lets-build-an-add-on.md

[typographical] ~433-~433: There might be a comma missing.
Context: ...CP_CreatorService { } ``` While we're here we will also create another extension. ...

(IF_PRP_PRP_COMMA)


[style] ~765-~765: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e and feature or unfeature accordingly. We are going to need two new class extensi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~767-~767: Consider removing “of” to be more concise
Context: ... that in the relevant location. Here is all of the code for the extended class: ```php ti...

(ALL_OF_THE)

🪛 markdownlint-cli2 (0.18.1)
docs/lets-build-an-add-on.md

754-754: Hard tabs
Column: 1

(MD010, no-hard-tabs)


828-828: Hard tabs
Column: 1

(MD010, no-hard-tabs)


829-829: Hard tabs
Column: 1

(MD010, no-hard-tabs)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

{

}
```

While we're here we will also create another extension. The base will be `XF\Pub\Controller\Forum` and the extension class will be `Demo\Portal\XF\Pub\Controller\Forum`. Creating the following code in the path `src/addons/Demo/Portal/XF/Pub/Controller/Forum.php` and click "Save":
While we're here we will also create another extension. The base will be `XF\Pub\Controller\ForumController` and the extension class will be `Demo\Portal\XF\Pub\Controller\ForumController`. Creating the following code in the path `src/addons/Demo/Portal/XF/Pub/Controller/ForumController.php` and click "Save":
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a comma after “here” for readability.
Small grammar fix: “While we're here, we will also create another extension.”

🧰 Tools
🪛 LanguageTool

[typographical] ~433-~433: There might be a comma missing.
Context: ...CP_CreatorService { } ``` While we're here we will also create another extension. ...

(IF_PRP_PRP_COMMA)

🤖 Prompt for AI Agents
In `@docs/lets-build-an-add-on.md` at line 433, Update the sentence in the
documentation text to include a comma after "here": change "While we're here we
will also create another extension." to "While we're here, we will also create
another extension." in the docs/lets-build-an-add-on.md file (the line
describing creating the extension class
Demo\Portal\XF\Pub\Controller\ForumController and the file path
src/addons/Demo/Portal/XF/Pub/Controller/ForumController.php).

@QuackieMackie
Copy link
Contributor Author

QuackieMackie commented Jan 26, 2026

I have gone through this documentation and built the add-on along with it. I committed all the fixes and I believe it is now up-to-date.

That said in the method Demo\Portal\XF\Pub\Controller\ThreadController::finalizeThreadReply I am getting this error:

Method 'setFeatureThread' not found in \XF\Service\Thread\ReplierService

I downloaded the 2.0.0 Xenforo files and checked the Replier and couldn't find this setFeatureThread method. What would you suggest is done with it? @chrisdeeming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants