Skip to content

Conversation

@ziegenberg
Copy link
Contributor

@ziegenberg ziegenberg commented Oct 6, 2025

Note: Please fill out all relevant sections and remove irrelevant ones.

🔀 Purpose of this PR:

  • Fixes a bug

📝 Description:

  • When editing a post, we get an exception with the following stack trace:
Cannot access private property mod_moodleoverflow\discussion\discussion::$userid

line 69 of /mod/moodleoverflow/classes/anonymous.php: Error thrown
line 582 of /mod/moodleoverflow/classes/post/post_control.php: call to mod_moodleoverflow\anonymous::is_post_anonymous()
line 125 of /mod/moodleoverflow/post.php: call to mod_moodleoverflow\post\post_control->build_postform() 

📋 Checklist

Please confirm the following (check all that apply):

  • I have phpunit and/or behat tests that cover my changes or additions.
  • Code passes the code checker without errors and warnings.
  • Code passes the moodle-ci/cd pipeline on all supported Moodle versions or the ones the plugin supports.
  • Code does not have var_dump() or var_export or any other debugging statements (or commented out code) that should not appear on the productive branch.
  • I ran all tests thoroughly checking for errors. I checked if bootstrap had any changes/deprecations that require changes in the plugins UI.

Cannot access private property mod_moodleoverflow\discussion\discussion::$userid

line 69 of /mod/moodleoverflow/classes/anonymous.php: Error thrown
line 582 of /mod/moodleoverflow/classes/post/post_control.php: call to mod_moodleoverflow\anonymous::is_post_anonymous()
line 125 of /mod/moodleoverflow/post.php: call to mod_moodleoverflow\post\post_control->build_postform()

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
@TamaroWalter
Copy link
Contributor

Hi @ziegenberg, thank you for your contribution. The only problem is that the function does not work in every case with a instance of the discussion class. Because of that, I proposed another solution in #233. This PR will be closed. But I will take this bug as a motivation to continue on changing the posts and discussion structure of moodleoverflow.
Kind regards
Tamaro

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