Closed
Bug 482331
Opened 17 years ago
Closed 2 years ago
Users can create multiple groups with the same name
Categories
(Websites Graveyard :: spreadfirefox.com, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
3.1
People
(Reporter: krupa.mozbugs, Unassigned)
References
()
Details
Attachments
(2 files)
Steps to reproduce:
1.Go to
2.Log in to your admin account
3.Create content->Project
4.Create a group called"victory is mine".Submit.
5.Repeat steps #4 and #5
6.Go to Mystuff->Groups->My projects.
7.Notices the projects listed there
expected results:
Group names need to be unique.
actual result:
Users can create multiple groups with the same name
| Reporter | ||
Comment 1•17 years ago
|
||
Step 1 is- Go to "https://spreadfirefox.authstage.mozilla.com"
Updated•17 years ago
|
Assignee: nobody → paul
Comment 2•17 years ago
|
||
I'll work on this in the morning
Comment 3•17 years ago
|
||
@Mary
This looks to be a core problem as it is true for all nodes.
It should be possible though to write a module (that
uses hook_alter_form to change node_form) to prevent nodes have multiple titles.
I did find a contibuted module on D.O but its has not been written ..
http://drupal.org/project/uniquetitle
I'll have a go at writing this module later this evening
Another thought is that the spam module should be configurable to address this issue? I'll check that out later.
Also not sure if this bug should be a blocker on launch.
Best, Paul
http://drupal.org/project/uniquetitle
using hook_alter_form to change node_form
Comment 4•17 years ago
|
||
Attachment #367570 -
Flags: review?(buchanae)
Comment 5•17 years ago
|
||
Comment 6•17 years ago
|
||
I'll pass this back you Mary for now to manage as Alex needs to review this module.
Best, Paul
Assignee: paul → mary
Comment 7•17 years ago
|
||
resetting severity for 3.1 milestone.
Assignee: mary → nobody
Severity: blocker → normal
Comment 8•17 years ago
|
||
Comment on attachment 367570 [details]
Simple module to prevent duplicate titles for any node type
I like the nodeapi() solution here. Could you put this code into sfx.module?
> function sfx_unique_title_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
> switch ($op) {
> case 'validate':
> _sfx_unique_title($node);
> break;
I don't think you need a separate function for _sfx_unique_title, it's pretty small. Or, if you want to make it a generic function (in the name of code reuse) you could make...
function sfx_node_title_is_unique($title) {
check if $title exists;
return true or false depending on check;
}
...and move form_set_error() to sfx_nodeapi();
> function _sfx_unique_title(&$node) {
> $sql = "SELECT COUNT(*) FROM {node} WHERE title = '%s'";
> if (db_result(db_query($sql, $node->title))) {
What if you are editing a node? This query will return 1. Can you tell if you're in create vs. edit mode?
> form_set_error('title', t('This title has already been used.'));
Can we improve the error message? Maybe, "The project <a href='existing_project'>$title</a> already exists. Try choosing a different title."
Last, but not least, I <3 4 spaces per indent :)
Thanks!
Attachment #367570 -
Flags: review?(buchanae) → review-
Comment 9•17 years ago
|
||
(In reply to comment #8)
> (From update of attachment 367570 [details])
> I like the nodeapi() solution here. Could you put this code into sfx.module?
Will do
>
> > function sfx_unique_title_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
> > switch ($op) {
> > case 'validate':
> > _sfx_unique_title($node);
> > break;
>
> I don't think you need a separate function for _sfx_unique_title, it's pretty
> small. Or, if you want to make it a generic function (in the name of code
> reuse) you could make...
>
> function sfx_node_title_is_unique($title) {
> check if $title exists;
> return true or false depending on check;
> }
>
> ...and move form_set_error() to sfx_nodeapi();
>
>
>
> > function _sfx_unique_title(&$node) {
> > $sql = "SELECT COUNT(*) FROM {node} WHERE title = '%s'";
> > if (db_result(db_query($sql, $node->title))) {
>
> What if you are editing a node? This query will return 1. Can you tell if
> you're in create vs. edit mode?
:-) Yes this was overlooked, i'll correct this
>
>
>
> > form_set_error('title', t('This title has already been used.'));
>
> Can we improve the error message? Maybe, "The project <a
> href='existing_project'>$title</a> already exists. Try choosing a different
> title."
>
>
>
> Last, but not least, I <3 4 spaces per indent :)
I'll make sure the formatting is right.
>
> Thanks!
Comment 10•17 years ago
|
||
We can address this "problem" during the migration to D6
http://drupal.org/project/uniquetitle
My thoughts are that it is better to allow the possibility of nodes to have duplicate titles than to introduce a performance hit with each node title add /edit page submission.
Best, Paul
| Assignee | ||
Updated•15 years ago
|
Product: Websites → Websites Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•