View Full Version : Field Problem
dpeterson
01-16-2007, 01:45 AM
When I make a submission, sometimes there is no url to enter. I have made sure that the field for the url is ticked "required field no". However, it still gives me an error if no url is entered into the field. Can anyone help to fix this?
John Turner
01-16-2007, 11:22 AM
Hi dpeterson and welcome,
Its necessary to make some changes with your suggest-link.php.
open '../suggest-link.php' (for FRONT-END)
***find following code
if ((!$_POST['url'] || !valid_url($link['url'])) && ('url' == $field_name))
***replace with following code
if ( ( ( !$_POST['url'] || !valid_url($link['url']) ) && $value['required']) && ('url' == $field_name ) )
***find following code
elseif (('url' == $field_name) && valid_url($_POST['url']) && $_POST['url'])
***replace with following code
elseif (('url' == $field_name) && valid_url($_POST['url']) && $_POST['url'] && $value['required'])
***find following code
if (!in_array($link_header, array (200, 403, 405)))
{
$error = true;
$msg .= "<li>{$gDirLang['error_broken_link']}</li>";
}
}
$link['link_header'] = $link_header;
}
***replace with following code
if (!in_array($link_header, array (200, 403, 405)))
{
$error = true;
$msg .= "<li>{$gDirLang['error_broken_link']}</li>";
}
}
$link['link_header'] = $link_header;
}
elseif (('url' == $field_name) && !valid_url($_POST['url']) && !$_POST['url'] && !$value['required'])
{
$link['domain'] = '';
$link['link_header'] = '200';
}
***find following code
if ($gDirConfig['description_max_chars'] > 0)
{
if (strlen($link['description']) > $gDirConfig['description_max_chars'])
{
$error = true;
$msg .= "<li>{$gDirLang['error_max_description']}</li>";
}
}
}
***replace with following code
if ($gDirConfig['description_max_chars'] > 0)
{
if (strlen($link['description']) > $gDirConfig['description_max_chars'])
{
$error = true;
$msg .= "<li>{$gDirLang['error_max_description']}</li>";
}
}
}
if(!$link['url'])
{
$link['pagerank'] = -1;
$link['recip_valid'] = 0;
}
else
{
***find following code
else
{
$error =true;
$msg .= "<li>{$gDirLang['error_reciprocal_domain']}</li>";
}
}
***replace with following code
else
{
$error =true;
$msg .= "<li>{$gDirLang['error_reciprocal_domain']}</li>";
}
}
}
*** save and close it.
Hope it helps.
dpeterson
01-16-2007, 03:07 PM
I made the changes you suggested. It still tells me I have to enter a valid url.
John Turner
01-17-2007, 03:00 AM
Hi dpeterson,
Did you suggest over Front-End? or from AdminPanel?
dpeterson
01-17-2007, 03:05 AM
Thanks but I already got the fix from Dave Baker in the modifications forum.
John Turner
01-17-2007, 03:24 AM
Here this solution for Back-End
1. open '../admin/suggest-link.php'
***find following code
if (($value['type'] == 'text') || ($value['type'] == 'textarea'))
{
$link[$field_name] = sql(html($field_value,ENT_QUOTES));
}
***replace it with following code
if (($value['type'] == 'text') || ($value['type'] == 'textarea'))
{
$link[$field_name] = sql(html($field_value,ENT_QUOTES));
if($field_name =='url')
{
$url_required = $value['required'];
}
}
***find following code
if (!$_POST['url'] || ($_POST['url'] == 'http://'))
{
$error = true;
$msg = $gDirLang['error_url'];
}
***replace it with following code
if ( (!$_POST['url'] || ($_POST['url'] == 'http://')) && $url_required)
{
$error = true;
$msg = $gDirLang['error_url'];
}
elseif( (!$_POST['url'] || ($_POST['url'] == 'http://')) && !$url_required)
{
$link['domain'] = '';
$link['link_header'] = '200';
$link['pagerank'] = -1;
$link['recip_valid'] = 0;
}
***find following code
if ($gDirConfig['reciprocal_check'] && !$gDirConfig['reciprocal_visitors'] )
***replace it with following code
if ($gDirConfig['reciprocal_check'] && !$gDirConfig['reciprocal_visitors'] && ( ($_POST['url'] || ($_POST['url'] == 'http://')) && $url_required))
***find following code
if ($gDirConfig['duplicate_checking'] && !$gDirConfig['duplicate_visitors'])
***replace it with following code
if ($gDirConfig['duplicate_checking'] && !$gDirConfig['duplicate_visitors'] && ( ($_POST['url'] || ($_POST['url'] == 'http://')) && $url_required))
*** Save and close it.
Don't forget set 'Required Field:' option to 'No' for Listing URL field.
in Admin Panel » Manage Listing Fields
It might helps.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.