If you don't want members having same name for favorite folders
in cp/favorite_create.php
in cp/favorite_edit.phpCode:function ProcessFormCreateFavorite() { // vars global configuration global $theme_path, $COOKIE_USERNAME; // vars url & form global $id, $title, $description; // vars messages global $msg; // vars template global $error_msg; // verify input $title = $_POST["title"]; if (empty($title)) $error_msg = $msg["20081"]; if (empty($error_msg)) { $links_obj = new clsLink; $links_obj->favorite_table_name = "idx_favorites"; $doesTitleExist = $links_obj->CheckFavorite($COOKIE_USERNAME, $title); if ( $doesTitleExist == 1) $error_msg = $msg["20082"]; else { $links_obj->CreateFavorite($COOKIE_USERNAME, $title, $description); DisplayTemplate($theme_path . "cp/favorite_create_ok.html", "\$novar"); } } if (!empty($error_msg)) ShowFormCreateFavorite(); }
in themes/kosmos/msg.phpCode:function ProcessFormEditFavorites() { // vars global configuration global $theme_path, $COOKIE_USERNAME; // vars url & form global $id, $title, $description, $Oldtitle; // vars messages global $msg; // vars template global $error_msg; // verify input $title = $_POST["title"]; if (empty($title)) $error_msg = $msg["20071"]; if (empty($error_msg)) { $links_obj = new clsLink; $links_obj->favorite_table_name = "idx_favorites"; $doesTitleExist = 0; if ($Oldtitle != $title ) $doesTitleExist = $links_obj->CheckFavorite($COOKIE_USERNAME, $title); if ( $doesTitleExist == 1) $error_msg = $msg["20082"]; else { $links_obj->template_file = $theme_path . "cp/favorite_edit_ok.html"; $links_obj->EditFavorite("process_form", $COOKIE_USERNAME, $id); if ($edit_result == 1) DisplayTemplate($theme_path . "cp/not_allowed.html", "\$novar"); } } if (!empty($error_msg)) ShowFormEditFavorites(); }
after :
$msg['20081'] = $lang['empty_favorite_title'];
add :
in themes/kosmos/cp/favorite_edit_form.htmlCode:$msg['20082'] = $lang['favorite_title_already_exist'];
after :
<input type=hidden name=id value=<%$id%>>
add :
in lib/link.classCode:<input type=hidden name=Oldtitle value=<%$title%>>
add after the last } of function RemoveDetailFavorite :
in lang/english.phpCode:// method to Check favorite // input : $username // $title // output : 0 : success // 1 : title for this favorite ALREADY exist // ------------------------------------------ function CheckFavorite($username, $title) { global $dbConn; $query = "select favorite_id from $this->favorite_table_name where title = '$title' and username = '$username' "; $result = $dbConn->Execute($query); $favorite_id = $result->Fields("favorite_id"); if(empty($favorite_id)) return 0; else return 1; }
after :
$lang['empty_favorite_title'] = 'Please enter the title';
add :
Code:$lang['favorite_title_already_exist']= 'This title for Favorite Listing already exist';![]()


