Alert is an API module that introduces the drupal_set_message_for_user() function. This function is identical in functionality to drupal_set_message(), except that it allows your module to set a message for a given user, even if the user is not the currently logged-in user. The message will be shown the next time the user logs in or sends a request to your site.
It also introduces a number of other optional parameters that modules can use as necessary. For example, modules can set a reference string to a particular message, so that they can modify the message at a later time before it is shown to the user.
Project page: http://drupal.org/sandbox/jessepinho/1331246
Git repo: git clone http://git.drupal.org/sandbox/jessepinho/1331246.git alert
NOTE: The guidelines suggest having a full commit history. However, I'm brand new to Git, and I had worked on this project quite a bit before familiarizing myself with Git.
Drupal version: 7 (I may backport it to Drupal 6 eventually, as I don't imagine that would take much work.)
Comments
Comment #1
asifnoor commentedAlert module Review
1. Run coder module and test it once.
alert.module
Line 21: There should be no trailing spaces
Line 24: There should be no trailing spaces
Line 28: in most cases, replace the string function with the drupal_ equivalent string functions
if (substr($key, -9) == '_operator') {
Line 32: There should be no trailing spaces
Line 39: There should be no trailing spaces
Line 96: There should be no trailing spaces
Line 114: else statements should begin on a new line
} else {
Line 117: There should be no trailing spaces
Line 120: There should be no trailing spaces
Line 126: There should be no trailing spaces
Line 130: else statements should begin on a new line
} else {
Line 134: There should be no trailing spaces
Line 143: There should be no trailing spaces
Line 156: There should be no trailing spaces
Line 190: in most cases, replace the string function with the drupal_ equivalent string functions
if (substr($key, 0, 2) != 'a_') {
Line 194: else statements should begin on a new line
} else if (is_array($alert)) {
Line 194: Use "elseif" in place of "else if"
} else if (is_array($alert)) {
alert.install
Line 87: There should be no trailing spaces
You are working on master branch. Please create a branch with name 7.x-1.x
please refer to this for release naming conventions http://drupal.org/node/1015226
alert.module
1. use drupal_substr function instead of substr
2. Line 100, use a variable which is more meaningful instead of a_id. I assume you are referring this to alert_id
3. Line 123, remove unwanted spaces for assignment.
alert.rules.inc
1. all functions should have doxygen comments
README file is missing.
Comment #2
doitDave commentedI like the idea of your module. I almost can't believe there is no other module for this? If not: Good work, once you fix the errors already stated.
Also I would encourage you to backport to D6.
Comment #3
jessepinho commentedThanks guys! I've made all the changes, but I have one quick question, asifnoor (or anyone who knows the answer): The release naming conventions you linked above mention that the master branch should not be used. I'm kind of a Git noob, so I'm not sure what best practice here is. Do I need to rename the master branch to 7.x (for dev releases), then create a new branch called 7.x-1.x (for full releases)? Or do I keep the master branch named master (for making future branches like 6.x and 8.x), then create a new branch off of it called 7.x, then a new branch off of that called 7.x-1.x?
Thanks!
Comment #4
jessepinho commentedIn the meantime, I've `git push`-ed the changes back up, but still in the master branch until I know what to do with branch naming.
Comment #5
elc commentedPlease see the following for branching
Release naming conventions
http://drupal.org/documentation/git
Comment #6
jessepinho commentedThat's what was confusing me a little... is it OK if there's no master branch, then?
So if I end up developing a 6.x branch, should I branch that off of the 7.x branch?
Comment #7
elc commentedYou can either use the master branch, or not use it.
If you use it, the code in there will be relevant and someone downloading the source code from git will run into the current working tree. If you don't use it, then the master branch needs to be empty and not have any code in there to confuse people. Just a readme telling people what's what.
The main reason not many projects use the master branch is that d.o will not allow you to create releases from the master branch, only something like the 6.x, 7.x or 8.x branch and even then, only from a tag on the branch.
A normal branch layout for a project would look something like this: (but not necessarily since you can do anything you want so long as the releases have the right branch)
master
- only the README.txt saying where things are
6.x
- full of files for the 6 release
- 7.x branch off the 6.x where you ported the module from 6.x to 7.x
Another might have all the branches starting at the master initial commit from developing the 6.x and 7.x at the same time, thus they have no common history. In your case having a 6.x branch off the 7.x just means that's the flow of the code. You could have started with an 8.x release if you really wanted to :P They're give version revision histories. You could branch them all off the "pigs in space" branch.
Don't forget you can also branch off for experiments, creating a patch for an issue, because you felt like it, and then merge things back to the parent branch when you're done, or just throw it away. You would normally not push these to the remote repository though. Only if you were working on a branch with another person and wanted to share code between yourselves easily.
Comment #8
jessepinho commentedGreat, thanks so much for the help. I created a new branch, 7.x-1.x, with the code. master now only contains a README.txt with instructions to check out a versioned branch.
Comment #9
elc commentedI didn't look at the code last time, just that you needed some direction on the git issues. Here's a look at the code and function.
or
That reduces it down to a single line of code instead of 10 with string manipulation.
Comment #10
jessepinho commentedELC: thanks for the feedback! I've been really busy of late so I'm only now able to get back to some of this. I have a few questions:
prefixing with a_
alert_save
saved forever
alert_load
function names
module name
Comment #11
elc commentedTo remove all the of strangeness in the alert_load, I would pass full conditions as rows. Anything to take out the special string handling. eg.
Which, one all the cruft is removed would be handled by (no string handling)
The isset($value['op']) instead of is_array() means that an array of things can be passed for an IN operation without specifying it.
Of course, this format and the previous one are both completely useless in the hook_load name since the auto loading can't build a query array like this, just provide a single term.
Your status_auto field could be combined into a flag field that held all the behaviours for the field. eg USERDSM_DELETE_AFTER_DISPLAY, USERDSM_DELETE_MANUALLY etc. rather than setting up an entire fields for delete_auto, status_auto, pickles_auto.
Comment #12
misc commented@jessepinho has been contacted to ask if the application is abandoned.
http://drupal.org/node/894256
Comment #13
jessepinho commentedHoping to finish this up soon! Just busy with other projects at the moment.
Comment #14
misc commentedCould we mark this as postponed until you got the time to work on it?
Comment #15
misc commentedNo answer, so I mark as postponed until you got the time to work on it.
Comment #16
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.
Comment #17
klausiDuplicate of #1799252: [D7] Admin Toggle.
Comment #18
avpaderno