Unique node title is not working on editing the node :
Steps to reproduce :
1. Create a node with title "Node Title Validation" and save.
2. Now click on edit and then click on save, it will throw an error
"There is already a node exist with title -- "Node Title Validation".

Comments

aditya_anurag created an issue. See original summary.

aditya_anurag’s picture

Assigned: aditya_anurag » Unassigned
Status: Active » Needs review
StatusFileSize
new1.5 KB

During validation of the title, we will be passing the node id as parameter.
$found_node_with_title = _node_title_validation_find_title_exist($node->title, $node->nid);

So that, node id can be checked with current editing node id.

  $node_id = $result->fetchField();
  if($nid == $node_id){
    return FALSE;
  }else{
    return $result->rowCount();
  }

We can get out of this "There is already a node exist with title".

heykarthikwithu’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch, works fine.

  • krknth committed fe3ce13 on 7.x-1.x authored by aditya_anurag
    Issue #2614758 by aditya_anurag, heykarthikwithu: Unique node title is...
krknth’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @aditya_anurag, @heykarthikwithu

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.