If you want to remove Email field as a required field from K2 comments, follow below steps...
Go to components/com_k2/models and open item.php.
Go to Line 1204, and delete below code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | if ( empty ( $userName ) || $userName == JText::_( 'K2_ENTER_YOUR_NAME' ) || empty ( $commentText ) || $commentText == JText::_( 'K2_ENTER_YOUR_MESSAGE_HERE' ) || empty ( $commentEmail ) || $commentEmail == JText::_( 'K2_ENTER_YOUR_EMAIL_ADDRESS' )) { $response ->message = JText::_( 'K2_YOU_NEED_TO_FILL_IN_ALL_REQUIRED_FIELDS' ); $response ->cssClass = 'k2FormLogError' ; echo json_encode( $response ); $mainframe ->close(); } if (!JMailHelper::isEmailAddress( $commentEmail )) { $response ->message = JText::_( 'K2_INVALID_EMAIL_ADDRESS' ); $response ->cssClass = 'k2FormLogError' ; echo json_encode( $response ); $mainframe ->close(); } |
If you want to remove Email * sign from the comment form. Go to templates/TEMPLATE/html/com_k2/default and open item_comments_form.php.
Go to Line 38, and delete the * sign.
1 | <label class = "formEmail" for = "commentEmail" ><?php echo JText::_( 'K2_EMAIL' ); ?> *</label> |