Messaging: Message Hack Attached - Black list + Time restrictions

Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Number of replies: 120
Please find attached files to improve the functionality of messaging, made by Mike Churchward and paid for by Egglescliffe School.

The code puts people into 1 of three lists for messaging purposes. White, grey (default) and black. The code also provides provision for setting the time during a day when messaging is available.

White list - Full access

  • Can send and receive message when ever they want to whoever the want 

Grey list - partial access by time

  • Everyone a is member by default
  • Available from and to times as configuration variables
    • If (available from = available to) then messaging IS enabled completely all of the time
  • Messages cannot be sent by these members during the 'offline' time

Black list - banned / prevented completly (naughty boys and girls)

  • Completely blocked from sending mail
  • Completely blocked from receiving mail UNLESS it is from a white list member

We have been using this for a little while now so I've had some more ideas but further feedback is welcome smile
Average of ratings: -
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
.. and this is what the admin interface looks like .....


Attachment interface.jpg
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Darren,

A big THANK YOU to you, Mike and Egglescliffe School for these messaging enhancements - fantastic! approve

(Here's a page for your messaging enhancements documentation: http://docs.moodle.org/en/Messaging_enhancements! wink)
In reply to Helen Foster

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by mo amin -
Hi Darren
I recon I must be really thick because I have been trying for sometime to get this messaging block working but have had no luck. You might be able to help me here!

I have downloaded the messageenhancements.zip file and unzipped it. I have then tried uploading the folders blocks, messgae, and  lang into either Theme or Moodledata folders in turn. I can upload successfully but then when I go to admin --> block I cannot see a new block to configure it. The readme file actually asks that the zipped files are uploaded into the root directory but I don't seem to be able to upload anything into the root directory (I get the "Virtual write access denied" error message) but I can put stuff into both Theme and moodledata folders. Should I be able to upload into the root directory? If so then there must be something wrong with my access rights. Am I being really silly here? Please help if you can!

Mo Amin
Bognor Regis Community College




In reply to Helen Foster

Message Hack (Black list etc) - Does not work in 1.8

by Stephen Digby -

Tried a few times and it doesn't sem to be able to get the whol list of site users anymore.  Only gets a few admins in the white list.

plus it just shows [[]] around the feilds of the block control rather than the proper field contents.

fantastic hack.

Why doesn't it get built into core messaging system ???

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi Darren,

Great, however I did delete the block but when I've gone to re-install it is giving me an error 'can't create the tables'. The tables are not in the database. Any ideas?

In reply to Deleted user

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Strange.

Did you try running the mysql script from mysql.sql straight in the database to create the tables as an alternative method?
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi,

Yes I did that the tables were created ok but I still get an error when I go to Configuration Administration to view the block. So it's not the tables because they are both sitting there in the database. Maybe I will have to look at every file created from the zip and delete them to eliminate the conflict?

In reply to Deleted user

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
perhaps delete the mysql.php file inside of the db folder if it is trying to recreate them everytime admin is visited.
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Patrick Malley -
I was having the same problems.  If you first install, then delete, and then try to reinstall this block, you will get an error because two tables are left in your Moodle database:

prefix_message_access
&
prefix_message_access_user

Delete them and then return to your admin page.  Everything should work fine after that.
In reply to Patrick Malley

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi,
did that, from a fresh start still got the error message

error
error

Block admin_enhmess tables could NOT be set up successfully!

I will prob have to download the latest 1.5.3+ and start again

Thanks.

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Mark Schumann -
Great script Darren! I haven't tested it on our system just yet, but could I request a couple of extra features?

- Ability to allow access all day for grey list during weekends (I set up something like this using cron a while ago in the backend)
- Ability to toggle full access on and off (for special circumstances such as holiday periods) for grey list

Other than that, it has everything we'd need.
In reply to Mark Schumann

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Thanks for the feedback. I'm only the ideas man smile Mike Churchward bring these things to life for us.

These are certainly the two main additions we spotted also so I will start a list smile
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by N Hansen -
Darren-Any possibility this functionality could be applied to chat as well, in terms of time restrictions?
In reply to N Hansen

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
I would imagine so but I would also imagine that the code is completely different and would require a complete rewrite.

It's not something we are looking at as we don't use chat at all - we tend to stick to messaging now that we have this code and forums.

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Richard Ackland -

Fantastic! Now we can start using messeging with staff and sixthformers and specific groups for certain activities. This has made messeging more flexible for us all !!

THANK YOU everyone involved !!!

I am assuming this will be 1.6 ready also?

In reply to Richard Ackland

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Julian Ridden has tested this and is running 1.6 if i remember correctly. I haven't had much of a play with it on our test site yet but will do before we upgrade to the beta.

I think it would please a lot of people if this functionality became standard at some point in the future smile but I understand Martin's point of view of keeping the core as bug free as possible and allowing the community to bolt on. The only thing missing as far as we can tell is allowing the overriding grey list time restrictions for, say, weekends and possibly holiday periods. We will look at this if I can find a few quid smile

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Paul Andrews -
Fabby Add on - finally we can use IM in Gloscat without the students abusing it!

tongueout




Please find attached a small script that puts all users on course X onto the white list.

Here X = 15 where 15 is the ID of the course.

This allows me to have a moodle admin team automatically drafted onto the whitelist just by being part of a "Moodle Admin" course on Moodle.

I intend to modify this so that it moves all users onto the black list 1st - and then moves the select few onto the white list - it's on ym to do list (unless anyone fancies doing that bit and reposting??!)

Feel free to use as you wish.


In reply to Paul Andrews

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Simon Bryan -
Have added the original block, wonderful and added this php page to the message folder does this only run from the command line or is it in Moodle somewhere?
In reply to Simon Bryan

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Paul Andrews -
You run it via the web browser - so if you popped it in your webroot folder you'd access it by going to the following url:

http://yourmoodlesite.com/add_messenger.php

Make sure you have edited the script so it connects to your MySQL database otherwise it won't work.

smile
In reply to Paul Andrews

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Simon Bryan -
OK, missed that! :-( But now I get this in my http_error log.

PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/www/moodle/add_messenger.php on line 26


Assume that is from this code:
$query = 'SELECT mdl_user_students.userid FROM `mdl_user_students` WHERE course = "158"';
$res = mysql_query($query);
echo "Got Users<br>";
echo $res;
while(list($userid) = mysql_fetch_row($res))

and that there is no user selected?

also should these lines be commented out?

// $query = "INSERT INTO mdl_forum_subscriptions (userid, forum) VALUES($uid, 1)";
// mysql_query($query);
// echo $query . '<br>';

Thanks for your help
In reply to Paul Andrews

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Greg Jeffrey -
Hi Paul - I don't suppose you've managed to get any further with the Black listing (or default Blacking) have you.  I want to get messaging in use and my head of ICT won't budge while there's no strightforward (preferably default) way of locking it down like this.  It's so nearly there smile
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Julian Ridden -
I have this working in 1.6 just fine smile

Altho, changes to messaging have recently happened in the 1.6 dev and I would like to do a proper update to throw back into the orum. Any chance of a patch file so I can put your changes back into the 1.6 code?

Many thanks
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

When I want to add pupils to the black list I have to scroll through a list of all of the pupils. Is there any way to put this list into alphabetical order. Otherwise some sort of search facility is needed to find the correct pupils. Currently we only have 300 users but it is taking a long time to find ones that need blocking.

Rick.

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
It's not in alphabetical order? My version here is so watch this space ....

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Josh Coombs -

Darren... It may seem a daft question, as moodle is an open source project... but would you mind if I alter the script for my moodle site, I managed to get mine working, like change the name of the block and delete the copied Admin block with messaging and merge it into the main admin block. You know, little things like this.

Cheers

Josh

In reply to Josh Coombs

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
To be honest I wish more people would change the blocks / hacks we produce smile

If you (or anybody else) make improvements / fixes that improve the funcionality of the blocks and hacks it would be nice (but obviously not required) if these were fed back to the community but things like tweaking them for your own site is the advantage of having something open source.

Have fun!

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Josh Coombs -

Thats excellent. Thanks for your reply darren smile I will for sure post back some improvements I have made. Ime not hot on PHP, so went down to waterstones and bought some PHP Books - soon sorted that 1 out! but... It would make the module integrate much better! :D

Cheers Again,

Josh

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Tim Kamps -
Darren,

Does you php guy have any plans to continue to refine this module to work in 1.7 and newer?

We have it running in 1.6.3, but with other great additions to 1.7 and newer, we'd sure like to see the messaging controls part of it.

Also, does anyone have the choice of days (M Tu W Th F Sa Su) to do time of day restrictions like the screen shot shows? We do not have the choice of days so that we could turn off grey listing on the weekends.

thanks,
Tim
In reply to Tim Kamps

Re: Message Hack Attached- 1.7version

by Ed McLafferty -
Hi all,

I did a bit of work on this ages ago for 1.6. I have just installed 1.7.2 and the message enhancements seem to work okay (although don't hold me to that!).

To get it to work at a course level, check the 1.7.2 settings in admin > modules > blocks > Admin (enhanced block) > settings > select
Allow Teachers to Change Messaging Levels?
Allow Course Specific Lists?

This should allow teachers / admin to set message restrictions on a per course basis.

Test it out to see what happens, as I say it seems to work for me. Unfortunately I cannot remember what tweaks I made to the files (as I didn't back my notes up tongueout). Sorry.

Hope this helps for 1.7 at least.
In reply to Ed McLafferty

Re: Message Hack Attached- 1.7version

by Graeme Forrester -
I installed this is in 1.8. Time restrictions are OK but cannot select global users on the front page.
In reply to Graeme Forrester

Re: Message Hack Attached- 1.7version

by Ed McLafferty -
Hi Graeme,

Yes, you are quite right. It still appears to work in the other courses though.

Back to the drawing board.

Ed
In reply to Ed McLafferty

Re: Message Hack Attached- 1.7version

by Art Lader -
Any luck, Eddie?

-- Art
In reply to Art Lader

Re: Message Hack Attached- 1.7version

by Ed McLafferty -
Hi Art,

I have just got back to this as I have been very busy. I have tested the block as it stands and it works to a certain extent.

This is using v1.7.2:

Do not activate:
Allow Teachers to Change Messaging Levels?
Allow Course Specific Lists?

Even though you cannot see any users on the global list for the main moodle course, the time restrictions set there still work for every course.

Course teachers will not be able to set their own course based time restrictions.

This is not ideal, but is the best we can do at the moment.

Eddie
In reply to Ed McLafferty

Re: Message Hack Attached- 1.7version

by Jason Best -

Hi,

hack works fine upto the point where you want to test it by sending a message to a user. The "search tab" under messages seems to throw up an error. please see attached.

Does anyone else get this error?

I am using moodle 1.8.2 in a test environment.

In reply to Ed McLafferty

Re: Message Hack Attached- 1.7version

by Lynne McCulloch -

Hi Ed,

We've installed this on 1.8.2 and have got as far as being able to see a blank table and being able to set the times at site level.  However, no names appear in any of the table columns.

Also, at course level we just get a basic admin block (headed adminenhmess) with the caption above 'That forum type doesn't exist' and cannot, therefore, access any table or timing settings.

Any ideas would be greatly appreciated, please.

Thanks.  Lynne

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

All of the other groups get sorted when I re-open them eg. group lists. If there is anything you need me to check at this end let me know.

Would message to a group be possible, the only way I have to contact all pupils is quick mail, a forum or chat but the pop up messages seem to get a faster response.

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
I remember an earlier version had not sorted the list so I guess I just didn't realise the sorted version. I am currently testing the new version with days and alphabetical sorting so just keep an eye on this thread smile

As for messaging groups - I just use the news forum. If it's for an assignment reminder then the marking block has a button at the botton to notify all unsubmitted students. I guess a programmer could get that code and modify it.

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

Just an idea, could you use the code for searching for a student, from the students section in course admin to add a pupil search to the message controls.

Rick.

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Bee Bell -
Has anybody else have this problem?

I cannot understand why I cannot obtain lists in alphabetic order anywhere???

We are having the same problem of not being able to sort or search the list of students already enrolled in a courses.

Why they are not in alphabetic order either by first or last name?
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by mo amin -
Hi

We have only been using moodle in my school for just over a month and have already come to the conclusion that the messaging system is bad news. I was very interested when I accidentally found out about your message restriction tool. Unfortunately, I am a novice to this game but am fairy familiar with the administrator features. Could you please tell me if It is possible for me to use this in my school (Bognor Regis Community College). If so, how difficult is it? would I need a degree in programming or is it reasonably straightforward. 
In reply to mo amin

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Hello.

It's very straightforward to use and pretty straight forward to install - just drop the files inside your moodle folder. If you are using postgres it will not work (we are nearly there!) but is fine on MySQL.

Let us know if you need more help.
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by mo amin -
Hi Darren
Thanks for getting back to me. I get " Virtual write access denied " error when I try to upload the unzipped file (three folders) into the root directory. I can however upload it to either of the Theme or moodledata folders. In both cases when i go to admin I cannot see any signs of the new messaging block.  I am not sure about the postgres / MySQL bit either. How do I find out which we are using?
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Art Lader -
Thank you so much for sharing this IM enhancement, Darren. Very generous of you to do so.

-- Art
In reply to Art Lader

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Mark Little -
Hi,

I have added this block to our site, but I get a Strange letter at the top of the block, any ideas....

Thanks
Attachment help.JPG
In reply to Mark Little

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

Can you help, I only get the advanced messaging options in the site admin block.

This screen shot looks like you have it available in the course admin block.

Have I done something wrong when i installed the block?

Has this affected the functionality within the course?

Any help will be greatly appreciated

Rick Barnes

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Dean Janzen -
I also have the same problem.  Everything seemed to install fine, but I can't find the Black-grey and white lists anywhere.
In reply to Dean Janzen

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Simon Bryan -
Did you add the new Enhanced Admin block to your front page? It contains the link to the Messaging controls - I then hacked my original Admin block and put the link in there.
In reply to Simon Bryan

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Michael Winter -

Looks like a great hack well done everyone that worked on it.

Jon I tried your version of this hack and all installed fine and I added the block to the front page and configured a user went to test and nobody can message anyone. The error that comes up when you click on a name to message is :

 

Notice: Undefined property: stdClass::$enhmess_courses in C:\moodle\message\discussion.php on line 39

The line in the code says

if ($CFG->enhmess_courses) {

I am not a programmer so I have no idea. Can anyone help as I would love to get this to work.

 

Michael

In reply to Michael Winter

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Donal McMullan -
Hi Michael

It looks like 'debug' might be set to 'on' in your site variables. Can you check in
admin/config.php
to see if it is? Turning it off should fix the problem.

You could also edit that line of code to read:
if (isset($CFG->enhmess_courses) && $CFG->enhmess_courses) {

Best wishes

Donal
In reply to Mark Little

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Chris West -
line 147 of block_admin_enhmess.php ("echo 'A';") needs removing. Most likely used to test something and got left behind.

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by John Patten -

In the installation for this block...Daren writes, "To install and use, unzip this file into your Moodle root directory making sure that you 'use folder names'." ...

What does "use folder names" mean?

After unzipping I see the folder and the files within each of the unzipped folder. Normally I would just drag the new files into the existing Moodle folders, and assume that when logging in as an administrator I would be able to configure the new block.

Is "use folder names" some sort of unzip command that identifies existing like named folders and places the new contents into the exisiting folders?

I'm a little unlcear on the installation, and don't want to mess anything up smile

Thanks!

In reply to John Patten

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Hello.

I think those words were from the readme file which Mike Churchward wrote. It depends upon which operating system and unzip program you are using to get the exact terminology.

When a zip is made and you add files you can also add folders. The zip can be set to remember the folder names / contents / stucture so when you unzip you get the all of the files in the exact folder structure. This is important because the files have to go in the right place inside moodle so using this feature means you don't have to move anything about yourself - you just unzip the file and it knows where to put everything. If a folder or file doesn't exist (but does in the zip) it is created. If a file already exists it is overwritten. If a folder already exists then nothing happens. Hope that makes more sense!

It sounds like that it not the option you are using as you seem to be saying when you unzip them on your dekstop machine that all of the files appear in only 1 folder? Which unzip app / operating system are you using.

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by David Fountain -

Great block - just installed it, yet to play with beyond assigning white lists - have got the following errors when I look at the settings in the admin (I've probably done something dumb):

Warning: config_print(/homepages/10/d101672901/htdocs/moodle/blocks/admin_enhmess/config_global.html): failed to open stream: No such file or directory in /homepages/10/d101672901/htdocs/moodle/blocks/moodleblock.class.php on line 386

Warning: config_print(): Failed opening '/homepages/10/d101672901/htdocs/moodle/blocks/admin_enhmess/config_global.html' for inclusion (include_path='.:/usr/local/lib/php') in /homepages/10/d101672901/htdocs/moodle/blocks/moodleblock.class.php on line 386

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Matt Gibson -
This sounds like a fantastic block - well done to all involved, but I am having difficulties with installing it. After unzipping and then accessing the admin page, I get this error:

admin_enhmess

Error

Error

Error

Error


Block admin_enhmess tables could NOT be set up successfully!


I am running 1.5.3+ on postgresql 7.4.7. Any idea s on what could be going wrong?

Matt
In reply to Matt Gibson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Matt Gibson -
update: I also just got the same problem with 1.6 dev on postgres as well.
In reply to Matt Gibson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by J B -
The module looks great, but it won't install for me either, I get much the same errors on 1.5 and 1.6 using postgres. I would strongly suggest that postgres users make sure thay have a backup all their /lang and /message directories before attempting an install of this enhancement. It works fine on a mysql-based moodle, but I only use that to develop the JPG slideshow module so it works with both databases.
In reply to J B

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
Hmmmm. I never thought of postgres as my only need is mysql and that was all it was tested on.

I will find out how easy it would be to get it working with other databases.
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

This is an excellent addition thanks for all of your work.

The first extra I have managed to get our administrator to add to moodle.

For further ideas, would it be possible to have more than one set of tme limits so that we could enable specific lessons, or before and after school and lunch time.

Rick Barnes

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
I'll put that on the things to do list as a consideration but it's not a feature we would use.

The next release will have selectable days so you can, for example, restrict messaging during the week but allow access throughout the weekend. Also looking at including postgres but we have no way to test it.

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Matt Gibson -
I'll be happy to test any development builds on my postgres install if you like. Just post them on here and I'll try them out to see if they break it or not smile
In reply to Matt Gibson

Message Hack - Postgres Version Available

by Darren Smith -
The hack should now work with postgres and is available in CVS.

Big thanks to Matt for helping us troubleshoot this and to Mike Churchward for developing the code approve

Darren
In reply to Darren Smith

Re: Message Hack - Postgres Version Available

by Donal McMullan -
Hey guys

I've been trying to add this enhancement (from contrib in Moodle CVS) to Moodle 1.6.1 running on PostreSQL 8.1, but I've been having a problem with moving users between lists. It looks like this line in lib.php fails:
insert_record('message_access_users', $thisuser)
...because $thisuser has a user property:
$thisuser->user   = $user;
...and 'user' is a reserved word in Postgres.

Since you guys already got this working on Postgres, I'm wondering if I'm using the up-to-date/canonical version? I'll tool around with it and see if changing 'user' to 'userid' fixes things.

Thanks for sharing the hack

Donal
In reply to Donal McMullan

Re: Message Hack - Postgres Version Available

by Michael Winter -

Thanks Donal it was the debugging ...I have that turned on as its a test site. Turned it off and all is good.

Also when I ran into problems I uninstalled it and deleted the files ...then when I went to reinstall it errors kept comes up saying could not set up tables....the tables were not deleted from the Database when it was uninstalled so i had to manually delete them. I am not sure if this is ment to happen automatically or a slight bug.

Also I had an idea of a feature and that is for the grey list to be able to set more than 1 session. You could then set it so messaging was disabled during individual classes and available at lunch.

I don't use CVS (mainly as I don't know how to) so could someone post the latest version either here or on the modules database on the moodle homepage.

Thanks

Michael

In reply to Donal McMullan

Re: Message Hack - Postgres Version Available

by Donal McMullan -
And...

Does the function:
message_access_update($course)
...serve any purpose now, or is that just cruft?

It seems to never get executed, and the following routine:
        // Add the extra users to the message system
        foreach ($diff as $id) {
            $newuser = new stdClass;
            $newuser->user    = $id;
            $newueser->course = $course;

            if (!insert_record($newuser)) {
                return false;
            }
        }
...has some bugs that would prevent the function from being effective (especially under Postgres).

So - can this be safely removed???

Thanks

Donal
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -

That sounds great, at times I am getting close to closing down messaging during the school day, but using it gets the pupils to log on more regularly.

In one of the screen shots from another user there apeared to be control of messaging in a course but I don't have this available is it in the plans as this could allow some groups access to messaging during restricted times?

Is there any way that atachments could be enabled in messaging there are times that i need to get a file to one pupil so I can't use a forum and many of our pupils are not very fluent with their e-mail accounts. Could this also be controlled by lists to enable it for pupils if required.

Keeping work all in one system is easier for them and saves a huge amount of time. (our previous VLE had internal e-mail so pupils had little school use for personal e-mail)

I had hoped to use the my files for this sort of exchange but the administrator is reluctant to add extra blocks to the moodle and yours is the first as it has features he wanted too.

Thanks again

Rick

In reply to Rick Barnes

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Josh Coombs -

Thats excellent. The Administrator of the VLE of Thanet College in kent also would like to have such a feature and so do I smile

The reason being is that students abuse the Instant Messaging, and therefore we have to disable it for sitewide access. It is a shame for the students who do not abuse the instant messaging, and we could restrict some students of this privilidge. Sadly Ime on postgre SQL here sad

Regards

Josh

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Tim Kamps -
Did the next release go out that had the selectable days? I don't see that option in the module we downloaded and installed under 1.6.3. Thanks, Tim
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by faraz omar -

Hi....

I've been searching for somethin like this.. is ther a possibility that this messaging... can restrict all users to send messages except to admins and teachers... i mean i luv the black listing ... but adding exception that they can message only to the teachers ... plz  reply.

faraz

In reply to faraz omar

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by M Y -
GREAT, just what I was looking for
In reply to M Y

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by mo amin -
How did you get yours working then?
I get "Virtual write access denied" error message when I try to upload the unzipped files into the root directory. So instead, I tried uploading it into each of the other folders (Theme and then moodledata) in turn. The upload was successful but I cannot see any signs of the messaging block in admin. Please can you help?
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Mark Schumann -
Just to let you know, for some reason the system now blocks users on the grey list from messaging users on the white list during restricted hours.  I don't believe I've changed anything but it did work before.  Messaging from the white list works fine.
In reply to Mark Schumann

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
It's always worked like that hasn't it?

"Messages cannot be sent by these members during the 'offline' time"

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Mark Schumann -
I was under the impression that users on the grey list could message anyone on the white list at any time.  Grey to grey is different of course.
In reply to Mark Schumann

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
That was in the back of my mind when I was putting the idea together but I think it was just easier to block them completely during the banned time which suited us anyway.

You could always grab an older copy of the code and prove me wrong blush but there should not have been any changes in functionality - only bug fixing.


In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Mark Schumann -
Ah ok, I must have been imagining that smile
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by mo amin -
Hi Darren

I recon I must be really thick because I have been trying for sometime to get this messaging block working but have had no luck. You might be able to help me here!

I have downloaded the messageenhancements.zip file and unzipped it. This then creates the three folders Blocks, Lang and message and a readme file. I have then tried uploading the lot into either Theme or Moodledata folders. I can upload successfully but then when I go to admin --> block I cannot see a new block to configure it.  The readme file actually asks that the zipped files are uploaded into the root directory but I don't seem to be able to upload anything into the root directory but I can put stuff into both Theme and moodledata folders. Should I be able to upload into the root directory? If so then there must be something wrong with my access rights. Am I being really silly here?  Please help if you can!

Mo Amin
Head of ICT
Bognor Regis Community College
In reply to mo amin

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Darren Smith -
I don't think you're thick at all smile as it sounds like it is a permissions problem.

In the root folder you should see a blocks folder. The contents of the blocks folder from the zip should go in the blocks folder on your moodle server. The contents of lang should go in the moodle lang folder and message from the zip should go into message on your server (you obviously don't need to upload the readme file).

If you are unable to see these folders on the server or are getting error message when you try to upload them then contect your web host / site admin and they shoulod be able to fix the permissions.

HTH

Darren
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by ian lake -

I have installed this block after a few attempts, the failures being incorrect actions on my part, and it's a life-saver, IT services are happier about the band-width issues, tutors are happier that students can spend more time ignoring them and the students.....well, they're peeved.

I have only two problems which someone with a little knowledge of php (i am not that person) would be able to sort out in nothing flat. when i click on the logs icon i get sent to a 404 page and when i tried to alter the relevant php page i was sent to courses, and the reports button is missing. Which means i have two admin blocks cluttering up me screen, which is confusing when rushing.

ian

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Patrick Malley -
Darren -

I tried to install this on my 1.6 installation without luck (I'm not too shocked).  Any chance that you (or someone else in the community) could find the time to update this indespensible solution to cranky high school administrators who hate the idea that students might communicate with one another. big grin
 
I'm installing my school's first instance of this summer and I would hate to see one scary instance of student A messaging student B something dirty and having the whole messaging system be turned off!  If I have some sort of stick to go along with this carrot, I can fend off the easily scared.
In reply to Patrick Malley

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Julian Ridden -

What error are you getting?

 

I have mine working in 1.6 but have had to turn globals on to do so.

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi there,

I hope you do not mind bit I have made a couple of small changes to your files, so that it works with the new languages method in moodle 1.6... Please find the new files attached, you now need to upload some file to the moodle root directory, and the language files to your moodle data root directory.. Hope fully the amendded readme explanis it all...
In reply to Jon Witts

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Chad Outten -
Great hack guys! There's no doubt many administrators, teachers out there who would find this a valuable tool. Works fine on 1.6.1+ but i've noticed a few features [new to 1.6 admin block] missing from the Admin-enhmess block > Reset, Reports, Questions. Could you please confirm if these features are[not] included as part of the hack for use with 1.6? Thanks, Chad big grin
In reply to Jon Witts

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Alastair Hole -
Just to say that we're using your 1.6 compatible version in 1.6.1 with no problems, thank you.

Only thing is, we have around 3,600 users at the moment, and browsing them in an unordered combo box list is somewhat painful!

I think someone else mentioned this, no doubt i'll be able to tweak the query to order by last name rather than moodle uid.
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Greg Jeffrey -

"Completely blocked from sending mail
Completely blocked from receiving mail UNLESS it is from a white list member"


Hi - We do seem to spend a disproportionate amount of time and resources stopping students finding new ways to send messages across the system sad.  However the ability to message students when looking at their assignments (or lack thereof) looks terriffic.  What I really want it for Teachers (white list) to be able to contact Students (black list?) and for those students to be able to respond to their teachers or contact them with queries.
Any thoughts on modifying the black list to allow 2 way communication with the whites?

Greg

In reply to Greg Jeffrey

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Greg Jeffrey -
I've been looking at "Dialogues" and this gives the Student/Teacher communication but without the immediacy of being able to click on a student's details and "Send Message".  I'm inclined to agree that forums are the right place for more extended discussion and that in general more open discussion is better so that others can contribute (and that the teacher doesn't get bogged down in answering the same query again and again from a group of students.)  However the immediacy of sending a "Well done" to a student without opening the floodgates would be very welcome smile
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Tony Parke -

I uploaded the message enhancement block but everything seems to be appearing with double square brackets before and after everything. Have I missed placing a certain file somewhere?

In reply to Tony Parke

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by ian lake -
this i believe is a problem with the language files. make sure that the files in the lang folder have been placed in the correct location in the moodle directory and those brackets should disappear
In reply to ian lake

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Richard Ackland -

I have a development server running 1.7 and whilst the messaging hack above installs fine, and appears to work it doesn't populate with users and so restrictions can't be assigned.

With the new roles in moodle 1.7 it should surely be easier to restrict the messaging.

This hack above has really been a god send to us, allowing certain students to message and other to not. It also serves as a deterrrent to those who do abuse the system.

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Richard Ackland -
Is there anyone wishing to develop this so that it works with moodle 1.7 within the roles and capabilties. My department would be willing to fund development as this is the only thing standing in the way of our upgrade !
In reply to Richard Ackland

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Matt Gibson -
I think Mike Churchward developed this originally, who is a moodle partner. I imagine he would be happy to discuss this with you if you message him. I would love to see this working in 1.7 (especially with the students can always message teachers mod) as I've had to abandon it since the upgrade, but sadly don't have access to funds sad
In reply to Matt Gibson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by a hutton -
Hi,

I just update our middle school to 1.7 and was excited to add the messaging controls. Not realizing that it didn't work with 1.7 --I added it. I messed around with the original moodle message folder and the hack folder (Message System Restrictions Settings) combining the two until I could add the new admin block to my home moodle page. I now have that block showing up. The lib.php in the two folders obviously do different things, if I use the one from the hack I get the ability to restrict messaging through out the school during a set time for each day of the week. The 3 list windows show but only the guest user is there. (I think that has something to do with the way users are called now with the roles option.) BUT I lose the search feature found on the tab of the messaging window. If I remove that lib.php and replace it with the original one in messaging from moodle 1.7 I no longer have access to controlling when the messaging happens, as that window is no longer accessible, but I have the search tab back in business on the messaging window (and it's a nice search tab smile).

Okay, I'm no programer but I love messing around with stuff and this is a perfect hack for a middle school where kids notoriously make bad decisions. I'm tired of punishing everyone for the action of one or two. I'm thinking there must be a way to combine the two lib.php files and get this thing to work. And as far as getting the users to show in the lists couldn't someone (with a better idea of how this all works than I) copy the php from the groups info and add it to the lib.php or whichever php file in the messaging folder would need it, so users would appear?

I don't know if any of this makes sense but from my experience with the moodle the code to do these things seems to be all there, I just need to figure out how to call it to do what I want. Sorry if this is way off. I'm just hoping it makes a little sense to one of you smart people out there. Thanks

In reply to a hutton

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Matt Gibson -
I would also not describe myself as a programmer, but I think that the roles architecture means that now the idea of 'student' is now pretty much defunct at this level as it all depends on the has_capability() function. All the places in the old file where it says is_student() need to be altered and I'm not smart enough to know if its as simple as just pasting chunks of code across from other places or whether there are more significant changes.

There is documentation somewhere in moodledocs on how to make a new capability, so maybe it will all start to make sense when you investigate.

I'd give it a go if I had the time, but I don't.

Good luck smile
In reply to Matt Gibson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Richard Ackland -

If anyone is willing to help with this hack, I am willing to help pay for it, as I do not have the experience myself !!

I got round it by installing the hack.... temporarily making everyone a student on the main site - they then appear in the hack windows.

Then apply the hack restrictions...

Then "unmake" them a student from the main site.

A hassle, I know - but not as much hassle as the messaging system being allowed for everyone....

In reply to Richard Ackland

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Gary Anderson -

If all you want to do is prevent students from messenging each, but allow teachers and students to communicate, you can try my hack at:

http://moodle.org/mod/forum/discuss.php?d=55934

--Gary

In reply to Gary Anderson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rick Barnes -
It looks like thsi could be split in to 2 parts.
Include message in the roles capabilities
with options for
message all
message within a course

message allowed to specified role
block message to specific role. I'm not sure which one would work best

Set up a aditional control in messaging to control access times and select which roles they apply to.

I'm not any sort of a programmer, but roles was where I looked first to set up a restricted pupil role that prevents students from publishing where other students can read, so no Chat, no forum posts and no blogging. I hope to keep the number of restricted users to a minimum and I can always allow teachers to post comments for these pupils once they have been vetted. The easiest way would be for the pupil to be able to message staff with their comments.

Does any one have the time to look at this as I also work with younger pupils who are likely to abuse the system.

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Steve Dowdall -
Hi all

Is this hack ready and tested for 1.7?
cheers
steve
In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Does this work with 1.7?

This is desperately needed for K12 moodle users. Does anyone have an update for this?

-Chris
In reply to Chris Kenniburg

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Graeme Forrester -

I had been using this in 1.6 but now get this in 1.7 as an error

Fatal error: Call to undefined function message_access_time_get() in E:\web\apache2.2\htdocs\moodle\message\levels.php on line 133

Anyone have any idea on how to fix it?

In reply to Graeme Forrester

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi,
I need extra information to be displayed from the user like Moodle username and or email to identify one Smith or Jones from another. Can you tell me how to do this please?

Thanks

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Carlos Morales Socorro -
I have installed your module but I only get this dialog in the admin page...

Admin (with Enhanced Messaging)

Be careful modifying these settings - strange values could cause problems.

Allow Teachers to Change Messaging Levels?
Allow Course Specific Lists?

What's wrong?
Carlos


In reply to Carlos Morales Socorro

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jim Peterson -
Did you figure out your problem, because I have the same problem. I see two check boxes but no lists to move users between.
In reply to Jim Peterson

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Rob Monk -

We're just about to install 1.8 and would love to have this functionallity. In a 7 to 12 school this is a must.

I just want to set it up to allow messaging from 4.00pm to 9.00pm every day.

Will this hack work?

Where do I get the lastest - 1.8 compatable version!!

In reply to Rob Monk

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Graeme Forrester -

This was such a useful module in 1.6 - Does anyone have a fix for 1.7 and 1.8?

Really like to limit meassages to say recess, lunch and after school only.

The blackisting was great but there are some enhancements such as:

  • Multiple periods through the day 
  • Better reporting of blacked out boxes and breaches of rules.
  • RSS
  • Levels of reducing messages within courses by teachers.
  • Links to chat
  • Elgg integration

Some ideas but I am sure others have more.

In reply to Graeme Forrester

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jason Best -

Hi,

I have recently installed Moodle 1.8.2 on a test environment on my pc.Installed the messaging hack which works fine until you get to the point where you want to send a message in the search tab. I get this error message. see attachment.

Has anyone else experienced this error message and is their a fix?

Regards

Jason

In reply to Jason Best

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Miguel Santos -

Jason and I have hit the same wall. 

Anyone have thoughts about this?

I am on moodle 1.8.+

A further question is does the frontpage inherit down to the course level?  In other words if Student A is blackListed on the Front Page, will Student A be able to message at all? 

In reply to Miguel Santos

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jason Best -

Hi,

Thanks for your reply. Apparently I found out from my colleague who is the administrator for moodle at our college. That the person who developed the hack has only created it for an earlier version of moodle i.e 1.5.1 and has not updated it for the later versions. Thats why i get the error as stated in my previous post.

Regards

Jason

In reply to Miguel Santos

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jason Best -

I created a test server for moodle on my pc. The only portion that works on the hack is the black list. Whereby that student\person cannot send any messages to anyone . It actually comes up with this message for people that are listed in the black list column "You cannot send messages because you are blacklisted". The portion that doesnt work on the hack is the grey list, where you restrict the times that people can only send messages. This doesn't work at all.

Regards

Jason

In reply to Jason Best

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Lynne McCulloch -

When running 1.8.2, we couldn't ever actually set black/white/grey users, but we could set time restrictions, which was the next best thing.

We have just upgraded to 1.8.3 and can't even get this. Instead, the 'blocks' section of the site administration shows this as an incompatible block (see attached).

Any suggestions, please?

Lynne

In reply to Lynne McCulloch

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Jason Best -

Hi,

you got further than us then because we could only get the black list to work with time restrictions. Still waiting for a solution for when the sql error message comes up when you try to search for a user to send a message to.

See attached zip file

Jason

In reply to Jason Best

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I would be happy with just being able to set time restrictions to just turn on and off the messaging automatically. We have too many students to try and group them anyways.

Can anyone produce this for version 1.8.3 or 1.9 when released???

Is there any function where we could disable IM for a role in 1.8.3 or 1.9?

I wish I knew more about coding and php to help!

-Chris
In reply to Chris Kenniburg

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Chris - That is an interesting approach. If you set up a cron job for a SQL script that simply changed the value in mdl_config (I'm assuming that is where it is) that turned the messaging on and off you could accomplish this. Honestly I would be tempted to put it in the /admin/cron.php and check the current time. If it is in one range then set messaging on. If it is in the other then turn it off. I don't have time right now to hack it but it should be fairly simple. The PHP documentation at php.net is pretty good and if I remember the code for /admin/cron.php is not too difficult to read. Would you consider opening up that file and having a peek. Let me know what questions emerge and perhaps together we can figure something out. Peace - Anthony
In reply to Anthony Borrow

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Anthony,
I am not a programmer in the least. I do not think I am up to the task. I might be able to get someone who works with me to help. I'll see what happens.

It seems like you have a good plan, maybe someone who knows what they are doing can come up with something.

-Chris
In reply to Chris Kenniburg

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by John Sanga -

I'm new to Moodle, and thought this would work great for our companies training site. I am currently using the 1.9.3 version. Has anyone else been able to successfully use this module with this version?

I figured I'd better ask before trying to install. Thanks.

In reply to Chris Kenniburg

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Karen Taylor -
I would be VERY interested in know if you got this to work! We are having many issues of students messaging and not working during class and it would be a shame to loose messaging all together.

Did you have any luck? I am using 1.9..

Thanks
Karen
Average of ratings: Useful (1)
In reply to Karen Taylor

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi Just upgraded to 1.9.5 on our dev server, Windows 2003, IIS6, PHP 5.2.8. and have been using this program since Moodle 1.6.6.

Over wrote existing 1.9.3 Moodle files copied from the production server and then deleted the message folder and added the saved working copy of message from 1.9.3.

I've also cut down the block admin_enhmess not to show any administration menus.

I'm attaching a zip file that contains my working, all three panels and timer files message and admin_enhmess using the frontpage role and adding everybody as a student.

This works for me and I'm happy with it, maybe this will help somebody else.

regards

Gerald

In reply to Darren Smith

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Professora . -
Hi,
I'm from Brazil. I did install at files, but I don't know how to view the new configuration screens of resources to block messages. I checked the options but not admin block appears no different.

Help!!
In reply to Professora .

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hello,

The zip file I added in June contains two folders, Message and the block admin_enhmess if you are using these.

1. Add some students into Frontpage Roles from the Administrator Menu.

2. Rename the existing Message folder so that it is no longer called Message.

3. Unzip Message.zip into the root folder of your Moodle.

4. Unzip block_admin_enhmess into the blocks folder of your Moodle

5. From the Administrator Menu click on Notifications and this will install the block tables in the database.

6. Turn Editing On on your Moodle Frontpage and click on Add Blocks

7. Select Restricted Messages or Enhanced Messages (the name of the block anyway) to add the block to your Frontpage.

8. Click on the Block Title name to enter the restrictions menu.

Hope this is of some help. I'm using Moodle 1.9.5+

Regards

Gerald

block namerestrictions.gif

In reply to Deleted user

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by David MacDermott -
Hi Gerard
when using this do you have any problems when deleting users. I get a fatal error and can't delete users unless I put the original messaging file back.

more detail: http://moodle.org/mod/forum/discuss.php?d=134516#p588222

In reply to David MacDermott

Re: Messaging: Message Hack Attached - Black list + Time restrictions

by Deleted user -

Hi David,

No, I'm not getting fatal errors when deleting a user. If my memory serves there was an issue in deleting a user who had un-opened messages or something like that, but I believe that was fixed.

What do the debug error messages say or the error.txt files?

This Hack is working very well for me, I've also added text to the message send button like "This message text is monitored" this seems to put the brakes on for quite a few.

I'm using Windows 2003 on IIS 6.

Gerald

p.s. you could always delete a user on the database, or write a html/php script that allows you to put in a user ID that updates the user delete field to 1 and add that to the User admin menu. I have on that resets passwords on the fly. Take a look.