site news v1.9

site news v1.9

Westley Roberts發表於
Number of replies: 32

Ok, I've searched everywhere and cannot figure out what I'm not seeing.  I have the site news turned on so it shows above the courses on the main page.  It's saying no news has been posted, and I cannot, for the life of me, figure out how to post anything to that forum.  Is there a button somewhere I'm not seeing or am I just completely retarted? :/  Also, once I figure out how to add news, is there anything special I need to do besides create a custom role to allow one student (student body president, etc) to be the only person allowed to post to the site news?

Thanks alot in advance for the help.

評比平均分數: -
In reply to Westley Roberts

Re: site news v1.9

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
If you have the capability to post news then you should see a button "Add a new topic" at the top if the news items (if any).

If you don't my immediate thought is that you have a role that doesn't allow it. Are you logged in as administrator? You should at least have the mod/forum:startdiscussion capability in a role defined at the site level.

For your student you can define a role with just the necessary forum capabilities and assign them to that role in Users > Permissions > Assign System Roles.
In reply to Howard Miller

Re: site news v1.9

John Isner發表於
Actually a news forum uses mod/forum:addnews, not mod/forum:startdiscussion. Other than that, I agree with Howard: there is something fishy about permissions if the administrator cannot add site news.
In reply to Howard Miller

Re: site news v1.9

Bob Puffer發表於
I have the same problem on my site and have exhausted all the role settings I can find to no avail. I cannot start a new topic but can edit any of my previous postings. My workaround... recycle old news (if the networks can do it, why not Moodlers?). Would be nice if somebody stumbled on an answer.

In reply to Westley Roberts

Re: site news v1.9

Simon Rae發表於

I have a possibly related problem, but I think it's something to do with permissions, although I can't find the relevant setting!

If I log in as Admin, I can see and send posts to the Site News forum - great! Similarly, if I log out, then I can still 'see' but not add posts - which makes sense!

My problem is that if I log on with another account - such as a teacher or student - all I see is a message saying:

"Subject (hidden)

Author (hidden)
This post cannot be viewed by you, probably because you have not posted in the discussion yet."
Which is bizarre considering non-logged-in users can view the posts!
Any thoughts?
Thannks,
Simon...
In reply to Simon Rae

Re: site news v1.9

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Yes that's right. Logged out users (Guest role) have slightly more rights than logged in users (authenticated user role) in that respect.

You can fiddle with the authenticated user capabilities to sort that one.

I didn't design it 吐舌頭
In reply to Westley Roberts

Re: site news v1.9

Westley Roberts發表於

Ok.  So I think I narrowed down the problem some.... I have no "start new discussion" button... anywhere.  If I click on the site news option in the main menu block... it just says nothing has been posted, and doesn't give me an option to post anything.  If I click on forums in the activity block, I see the site news forum and 0 discussions, but if I click on either one it doesn't give me an option to start a discussion.  Yes I'm logged in as administrator, and yes I've double checked the administrator permissions and they look right, 99% of everything is allowed. 

the site is at www.christpuncher.org/moodle if anyone thinks they can tell from there, it's on a test server and nothing's set up yet, so if someone wants a look around or thinks they can help, email me at xipander@gmail.com and I can create an admin account for you to double check my configs on. 

It is a custom theme, I don't know if that would have anything to do with it.  I changed it to the standard theme and still didn't get the buttons. so...

Thanks in advance if anyone can help.

In reply to Westley Roberts

Re: site news v1.9

John Isner發表於
What is the value of Site administration -> Front page -> Front page settings -> News items to show? If the value is zero, the "Add a new topic" button will not show.
In reply to John Isner

Re: site news v1.9

Westley Roberts發表於
It's set to 3.  Everything was on defaults... but thanks to your help, I found the problem.  There was no "front page roles" assigned.  My admin account was set as an administrator in the user > permission > system roles. but when I checked the "front page roles" section there was nobody assigned to any of them.  So I added the admin account and... viola... there's the button.  Thanks alot for everybodies help.
In reply to Westley Roberts

Re: site news v1.9

John Isner發表於
That doesn't sound right. It is normal that no roles are assigned in the Front page context. When you login as administrator, you get the Administrator role in the System context, and this role gives you mod/forum:addnews ("Add news" ) = Allow in the Front page context. The fact that you had to assign yourself the Administrator role in the Front page context confirms my original suspicion that somthing is fishy with your roles setup.

I recommend that you install the Roles debugger so that we can see what's going on. I know you think everything is working now, but IMO you will have more problems and the Role debugger will make it very easy to diagnose them. It's an easy install. Just drop a single file in your Moodle root directory.
In reply to John Isner

Re: site news v1.9

Bob Puffer發表於
So... John. Thanks for your information. I've run the Roles debugger logged in as Admin and find the following:
  1. When I run it in the context type of "System" (with or without a contextid of "1") the Admin has the roles of R1 and R7
  2. When I run it on the context type of "Course" with a context id of "1" the Admin has the same System roles of R1 and R7 but the Guest role (R6) for the Course context.
Any enlightenment would sure be appreciated.

In reply to Bob Puffer

Re: site news v1.9

John Isner發表於
Well done! Run it again with
  • Capability = mod/forum:addnews
  • Context type = Course
  • Context id = 1
If you have a screen capture program, make a screenshot of the Role debugger output (the whole page) and post it here or mail it to me (my email address is on my profile page). If no screenshot program, you can just copy/paste the output.

From the information you gave me so far, we can see that the administrator has the Guest role in the front page course. The whole report will explain how that happened. I'm guessing you have Site administration -> Front page -> Front page settings -> Default front page role = Guest.

In reply to John Isner

Re: site news v1.9

Bob Puffer發表於
In reply to Bob Puffer

Re: site news v1.9

John Isner發表於
Bob,
There are a couple of things that bother me about this picture.
  • The predefined Administrator role by default has mod/forum:addnews ("Add news") = Allow. In upper left hand corner of the table, we see R1(N) which means the default has been changed from Allow to Not set. Please check to see if this was done. If so, I recommend pressing the Reset to defaults button on the Administrator role and any other predefined role that you have changed.
  • The Authenticated user role is not being automatically assigned to the admin user in the System context, so we expect to see R1(A),R7(N) in the upper right-hand corner. This is a real puzzle. **One possibility is that you didn't run the script properly -- see below.
  • I would have expected to see R6(N) in the top row under Katie (R6 is the Guest role, which you have as the default front page role).
**I should have mentioned the correct way to run the roles debugger is to
  1. login to Moodle as the user whose permissions you want to explore (in your case, the admin user)
  2. navigate (still in Moodle) to the context where you what to explore permissions (in your case, you're already there)
  3. in a separate browser window or tab, run the rolesdebug.php script.
These instructions are in the documentation but since you had already ran the script before, I forgot to mention this. Run it again this way. If the results are different, post them. Otherwise, let me know and we'll do some more research.
In reply to John Isner

Re: site news v1.9

Bob Puffer發表於
Unfortunately I did consult your excellent documentation and did run the procedure correctly. To test that out I ran it again this morning and found the same screen of information you see in my previous post. There are Administrator account overrides for Front Page... the mod/forum :addnews is set to "inherit". I assume that means inherit the permissions from the system role of administrator. The system administrator has no overrides and has the mod/forum:addnews permission set to "Allow". I don't understand the procedures for "resetting" the administrator role?
In reply to Bob Puffer

Re: site news v1.9

John Isner發表於
If you overrode Administrator in the Front page context, the table should be showing overrides in row 2, but row 2 is empty.

"Inhert" means that the override simply doesn't have any effect on the particular permission. Overriding the Administrator role is usually (but not always) meaningless, since the Administrator has moodle/site:doanything ("Can do everything") = Allow, which generally but not always trumps other permissions. Naturally if you set doanything = Not set it would be a different story.

To reset the Administrator role (or any predefined role) back to its defaults, go to the Site administration -> Users -> Permissions -> Define roles -> Manage roles tab and click Administrator (the role name, not the edit icon). On the next page you will see a row of buttons near the top. One of them is Reset to defaults. I doubt resetting Administrator will have any bearing on your problem.

One possibility is that you are not running Moodle 1.9. You never said explicitly that you were, but I assumed it from the title of the discussion. The Role debugger only works with Moodle 1.9.

Another possibility: if your site was upgraded to 1.9, perhaps the role mappings got messed up. So maybe Guest got mapped to Administrator. I have no idea. Rolesdebug.php just reports the contents of the current user's permission data, which is in turn extracted from the database. You could run the script again with the following line (around line 76) uncommented

// echo("USER->access = <br/>");

(to uncomment the line, remove the two leading slashes). This will produce a lot of output, so don't post it here, but email it to me as text (not screenshot).


In reply to John Isner

Re: site news v1.9

Bob Puffer發表於
Was this the only line you wished uncommented? Uncommenting this line only echos the line to the screen once and doesn't produce any other output than that already reported in the previous posting.
In reply to Bob Puffer

Re: site news v1.9

John Isner發表於
Sorry, my instructions were completely idiotic. You need to change this line (around line 77):

// print_object($access);

to
print_object($access);



In reply to Bob Puffer

Re: site news v1.9

John Isner發表於
Hi Bob,
In your email the table shows the correct role assignments, so there must be a difference between this time and last time. Any ideas?

The table has the expected entries:
  • R1 and R7 in cell (1,1) (R7 is missing in your screenshot)
  • R6 in cell (1,2) (this cell is empty in your screenshot)
HOWEVER you typed "mod/forum :addnews" with a space after the word 'forum'. The Roles debugger does not check that the capability is valid (I will add a check), so the table shows
  • R1(N), R7(N) in cell (1,1)
  • R6(N) in cell (1,2)
rather than
  • R1(A), R7(N)
  • R6(N)
which is what we hope to see.

I was curious about something else in the data. Did you happen to restore your front page course (Site administration -> Front page -> Front page restore) from a course that was not itself a front page course? The context of your front page course is /1/650 internally. I have never seen it be anything other than /1/2.

If you don't mind, re-run the Roles debugger with the mod/forum:addnews spelled properly. Leave the print_object line uncommented. Send the output to me in another email.
In reply to Westley Roberts

Re: site news v1.9

Niels Walet發表於
I seem to have succeeded in reaching the same effect:

After setting the default user for the frontpage to guest (so that everyone can see the announcements), I can no longer add announcements to the site news forum.

I have just tried to override permissions (adding a local administrator role to the administrator on the site forum, allowing everything to this person), but that doesn't solve it.

Resetting the frontpage role to none doesn't do it--and checking with rolesdebug.php on course 1 doesn't throw up anything unusual.

Any suggestions what to look at next?

Niels Walet
In reply to Niels Walet

Re: site news v1.9

Niels Walet發表於
Bad to reply to yourself, but:
I have traced this to the administrator user having "has_capability('moodle/legacy:guest', $coursecontext, NULL, false)", even though I haven't upgraded from 1.7....
This looks like a pretty big mess to me. I'll hack the relevant forum modules and see whether that solves the problem.

Niels
In reply to Niels Walet

Re: site news v1.9

Dean Montgomery發表於
We also have the same problem - can't post to "Site news" forum even though I'm an administrator... I've also tracked it back to the same spot in the code.

mod/forum/lib.php
if (has_capability('moodle/legacy:guest', $context, $USER->id, false)) {

This particular moodle has been upgraded several times and is now at 1.9.2

Please let me know when you find a fix.
In reply to Dean Montgomery

Re: site news v1.9

Niels Walet發表於
my hack (in 1.9.1):
comment out the two occurences of
if (has_capability('moodle/legacy:guest', $context, $USER->id, false)) {
 return false;
 }
in lib.php; also
($forum->type != 'news'
 and (isguestuser() or !isloggedin() or has_capability('moodle/legacy:guest', $context, NULL, false))) ) {

remove the

"or has_capability('moodle/legacy:guest', $context, NULL, false)"
in post.php needed to make more changes: The following occurs twice:

 if (has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) { // User is a guest here!
> $SESSION->wantsurl = $FULLME;
> $SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
> redirect($CFG->wwwroot.'/course/enrol.php?id='.$course->id, get_string('youneedtoenrol'));
> } else {
> print_error('nopostforum', 'forum');
> }
Comment out!

Since I don't allow guests in, this has no risk for me.
Niels
In reply to Niels Walet

Re: site news v1.9

Michael Fisher發表於
"Resetting the frontpage role to none"
This worked for me but it is not a good work-around as I would like everyone to be able to read the site news.
In reply to Niels Walet

Re: site news v1.9

Helen Foster發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片
Hi Niels,

To enable everyone to see the site news, you should set the default front page role to student. As you've found, setting it to guest causes problems - it really shouldn't be available as an option. wink

For other reasons why an admin can't post in the site news forum, please see the Forum module FAQ.
In reply to Helen Foster

Re: site news v1.9

Ron Meske發表於
Hi Helen,

That does explain the confusion we encountered when first setting up Moodle. It seems to be counter intuitive based on how settings are described in the settings for User Policies and Front Page.

Let me explain what I mean.

We do not allow guests into our Moodle, requiring everyone to log in prior to getting to the front page. Under user policies we have default role for all users set to authenticated user and Default role for users in a course is set to student. This all makes sense so far.

The Front Page settings has News as one of the items to display when users are logged in. The Default front page role is set to None which is the default. Based on the descriptions for the settings one would be led to believe that any user logged in would be able to see and interact with whatever is displayed.

Based on these settings any user that did not have a role assigned manually was not able to see the News items which didn't make sense because of the Front Page setting for what to display to logged in users. And as you point out if the Default Front Page role is changed to student then everything works as it should.

What is not clear, if you change the Default Front Page role to student, how does it impact guests if you do not require a login or have allowed guest access to your Moodle site. Since we require all users to log in, we don't have a problem with this.

My recommendation is to modify the descriptions on the Front Page settings so that it is clear that if you want logged in users to interact with Site News, and other items that need more permissions, that you either need to override authenticated users permissions on the Front Page or assign a role of student either on the Front Page or in some other fashion.

In general, the roles & permissions are a bit confusing for most users that have not dealt with system permissions and policies in other fashion. I have not looked into what is changing in 2.0, but it seems that an explanation of how User Policies and the Front Page settings work together would be helpful. Along with what are best practices for keeping your Moodle secure.

I am willing to partner with someone to create this type of documentation if there is an interest.
In reply to Ron Meske

Re: site news v1.9

Dean Montgomery發表於
To summarize:
"Front Page"=>"Front page settings"=>"Default fontpage role"
  • = "Guest" causes the "Add new topic" button to disappear for logged in administrators.
  • = "None" allows admin users to see "Add new topic" button.

We needed to set the front page role to "Guest" in order to allow users to view the calendar without logging in.


In reply to Dean Montgomery

Re: site news v1.9

Helen Foster發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片
Hi Dean,

The calendar block and upcoming events block listing site events should be visible to non-logged in users, however to view the calendar or a particular event, users are required to login.
In reply to Helen Foster

Re: site news v1.9

Niels Walet發表於
Hi Helen,
I don't think that solves all my problems--I also would like the news to be visible to anyone (mainly for reasons linked with registration--we allow users to self register for moodle if they have the right email address, and some of the site news makes that statement!) The "solution" used came from somewhere on the forums; I don't remember where.
The FAQ is clear and useful; I should have read it before.
Niels