Moodle

Admins should be notifed about Portfolio problems using new messaging events

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Incomplete
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Portfolio API
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Hi Penny

For notifying admins, you can do it something like this:

function portfolio_notify_admins($subject,$a) {

$admins = get_admins();

$body = get_string('something','portfolio',$a);

foreach ($admins as $admin) { $eventdata = new object(); $eventdata->modulename = 'portfolio'; $eventdata->name = 'notices'; $eventdata->userfrom = $admin; $eventdata->userto = $admin; $eventdata->subject = $subject; $eventdata->fullmessage = $body; // plain text message $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = 'complete version with HTML etc'; $eventdata->smallmessage = 'something suitable for IM'; events_trigger('message_send', $eventdata); }
}

Activity

Hide
Penny Leach added a comment -

I implemented this and it's sending me messages but they're coming up blank. I printed out the object I'm passing to event and it looks fine (will attach separately).

Had to add a 'component' parameter. Perhaps someone who knows messaging can help with this. Martin can you please add watchers?

Show
Penny Leach added a comment - I implemented this and it's sending me messages but they're coming up blank. I printed out the object I'm passing to event and it looks fine (will attach separately). Had to add a 'component' parameter. Perhaps someone who knows messaging can help with this. Martin can you please add watchers?
Hide
Penny Leach added a comment -

note there is a missing string here [[fail]] that's just a quick hack I put in the mahara plugin to report misconfigured for the purposes of testing and should be ignored. Normally it would say something like 'relies on this and that in mnet' or something more logical and helpful.

Show
Penny Leach added a comment - note there is a missing string here [[fail]] that's just a quick hack I put in the mahara plugin to report misconfigured for the purposes of testing and should be ignored. Normally it would say something like 'relies on this and that in mnet' or something more logical and helpful.
Hide
Martin Dougiamas added a comment -

It's entirely likely that Messaging in 2.0 is the part that's broken, your bit looks OK. So this can be resolved. Thanks!

Show
Martin Dougiamas added a comment - It's entirely likely that Messaging in 2.0 is the part that's broken, your bit looks OK. So this can be resolved. Thanks!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: