Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
c718dd57
Commit
c718dd57
authored
Mar 02, 2007
by
skodak
Browse files
MDL-8578 new capability for adding and replying to news in forum
parent
18b07efa
Changes
6
Hide whitespace changes
Inline
Side-by-side
lang/en_utf8/forum.php
View file @
c718dd57
...
...
@@ -69,6 +69,7 @@ $string['existingsubscribers'] = 'Existing subscribers';
$string
[
'forcesubscribe'
]
=
'Force everyone to be subscribed'
;
$string
[
'forcesubscribeq'
]
=
'Force everyone to be subscribed?'
;
$string
[
'forum'
]
=
'Forum'
;
$string
[
'forum:addnews'
]
=
'Add news'
;
$string
[
'forum:createattachment'
]
=
'Create attachments'
;
$string
[
'forum:deleteanypost'
]
=
'Delete any posts (anytime)'
;
$string
[
'forum:deleteownpost'
]
=
'Delete own posts (within deadline)'
;
...
...
@@ -78,6 +79,7 @@ $string['forum:movediscussions'] = 'Move discussions';
$string
[
'forum:throttlingapplies'
]
=
'Throttling applies'
;
$string
[
'forum:rate'
]
=
'Rate posts'
;
$string
[
'forum:replypost'
]
=
'Reply to posts'
;
$string
[
'forum:replynews'
]
=
'Reply to news'
;
$string
[
'forum:splitdiscussions'
]
=
'Split discussions'
;
$string
[
'forum:startdiscussion'
]
=
'Start new discussions'
;
$string
[
'forum:viewanyrating'
]
=
'View any ratings'
;
...
...
mod/forum/db/access.php
View file @
c718dd57
...
...
@@ -85,6 +85,32 @@ $mod_forum_capabilities = array(
)
),
'mod/forum:addnews'
=>
array
(
'riskbitmask'
=>
RISK_SPAM
,
'captype'
=>
'write'
,
'contextlevel'
=>
CONTEXT_MODULE
,
'legacy'
=>
array
(
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
,
'admin'
=>
CAP_ALLOW
)
),
'mod/forum:replynews'
=>
array
(
'riskbitmask'
=>
RISK_SPAM
,
'captype'
=>
'write'
,
'contextlevel'
=>
CONTEXT_MODULE
,
'legacy'
=>
array
(
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
,
'admin'
=>
CAP_ALLOW
)
),
'mod/forum:viewrating'
=>
array
(
'captype'
=>
'read'
,
...
...
mod/forum/discuss.php
View file @
c718dd57
...
...
@@ -190,7 +190,13 @@
(
ismember
(
$discussion
->
groupid
)
||
$mygroupid
==
$discussion
->
groupid
)
);
}
}
else
{
if
(
!
has_capability
(
'mod/forum:replypost'
,
$modcontext
))
{
if
(
$forum
->
type
==
'news'
)
{
$capname
=
'mod/forum:replynews'
;
}
else
{
$capname
=
'mod/forum:replypost'
;
}
if
(
!
has_capability
(
$capname
,
$modcontext
))
{
$coursecontext
=
get_context_instance
(
CONTEXT_COURSE
,
$course
->
id
);
if
(
!
has_capability
(
'moodle/legacy:guest'
,
$coursecontext
,
NULL
,
false
))
{
// User is a guest here!
$canreply
=
false
;
...
...
mod/forum/lib.php
View file @
c718dd57
...
...
@@ -2923,7 +2923,13 @@ function forum_user_can_post_discussion($forum, $currentgroup=false, $groupmode=
}
$context
=
get_context_instance
(
CONTEXT_MODULE
,
$cm
->
id
);
if
(
!
has_capability
(
'mod/forum:startdiscussion'
,
$context
))
{
if
(
$forum
->
type
==
'news'
)
{
$capname
=
'mod/forum:addnews'
;
}
else
{
$capname
=
'mod/forum:startdiscussion'
;
}
if
(
!
has_capability
(
$capname
,
$context
))
{
return
false
;
}
...
...
@@ -2957,11 +2963,17 @@ function forum_user_can_post($forum, $user=NULL) {
}
$context
=
get_context_instance
(
CONTEXT_MODULE
,
$cm
->
id
);
if
(
isset
(
$user
))
{
$canreply
=
has_capability
(
'mod/forum:replypost'
,
$context
,
$user
->
id
,
false
)
if
(
$forum
->
type
==
'news'
)
{
$capname
=
'mod/forum:replynews'
;
}
else
{
$capname
=
'mod/forum:replypost'
;
}
if
(
!
empty
(
$user
))
{
$canreply
=
has_capability
(
$capname
,
$context
,
$user
->
id
,
false
)
&&
!
has_capability
(
'moodle/legacy:guest'
,
$context
,
$user
->
id
,
false
);
}
else
{
$canreply
=
has_capability
(
'mod/forum:replypost'
,
$context
,
NULL
,
false
)
$canreply
=
has_capability
(
$capname
,
$context
,
NULL
,
false
)
&&
!
has_capability
(
'moodle/legacy:guest'
,
$context
,
NULL
,
false
);
}
...
...
mod/forum/post.php
View file @
c718dd57
...
...
@@ -527,7 +527,7 @@
$timemessage
=
4
;
}
if
(
$fromform
->
mailnow
)
{
if
(
!
empty
(
$fromform
->
mailnow
)
)
{
$message
.
=
get_string
(
"postmailnow"
,
"forum"
);
$timemessage
=
4
;
}
else
{
...
...
mod/forum/version.php
View file @
c718dd57
...
...
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module
->
version
=
200702020
0
;
$module
->
requires
=
200702020
0
;
// Requires this Moodle version
$module
->
version
=
200702020
1
;
$module
->
requires
=
200702020
1
;
// Requires this Moodle version
$module
->
cron
=
60
;
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment