Page 1 of 1

Required location

Posted: Sun Mar 13, 2011 2:14 pm
by TheNameless
Version of script:1.7
Hosting company: Hostupon
What terms did you try when SEARCHING for a solution: required, fields, required fields,

Write your message below:

Hello,

I've seen the thread about the required email which is super idea, and i would like to do the same with the location, i wanna "force" person to enter a location ( i dont mind if its a fake one like "sin city" or "in my bed" :D ).

I guess that i must modify gbook.php, settings.php, and language.inc.php.... any idea ?

Re: Required location

Posted: Mon Mar 14, 2011 6:38 pm
by Henrie
Hello TheNameless,

You guessed right in what you have to edit.
Here what you ahve to do

Required 'from' field for GBook version 1.7

Edit file settings.php
Add

Code: Select all

/* The 'from' field is required? 1 = YES, 0 = NO */ 
$settings['req_from']=1;
Put it before /* DO NOT EDIT BELOW */


Edit file gbook.php
Search for (lines 774-777)

Code: Select all

    if (empty($name))
    {
        $error_buffer .= $lang['e03'].'<br class="clear" />';
    }
and directly below add

Code: Select all

    if (empty($from))
    {
        $error_buffer .= $lang['hl_e02'].'<br class="clear" />';
    }
Edit file language.inc.php
Change

Code: Select all

$lang['t51']='Where are you from?';
to

Code: Select all

$lang['t51']='<b>Where are you from?</b>';
and add

Code: Select all

$lang['hl_e02']='Please enter where are you from.';
Put it before ?>

Greetings,
Henrie

Re: Required location

Posted: Mon Mar 14, 2011 7:15 pm
by TheNameless
Perfect ! thank you ! :D

Re: Required location

Posted: Mon Oct 10, 2011 4:41 am
by cAdams
both of you forgot to mention

<span class="gbook_location"><?php echo $lang['t51']; ?></span><br class="clear" />


needs to be added to comments.php around line 11 under the name line :wink:

nb: 'location' used in my gbook only

Re: Required location

Posted: Mon Oct 10, 2011 4:59 am
by Henrie
<span class="gbook_location"><?php echo $lang['t51']; ?></span><br class="clear" />
I think you have removed it yourself, in comments.php file is normally the code:

Code: Select all

	if ($from)
	{
		echo '<span class="gbook_submitted_by">'.$lang['t18'].' '.$from.'</span><br class="clear" />';
	}
So please look in the original comments.php file not in a modified file.

Re: Required location

Posted: Mon Oct 10, 2011 5:28 am
by cAdams
sorry Henrie, you're right :oops:

when i was adjusting the code, at first it didn't work which is why i made the post but then i may well have confused my server with all the changes i've made

i've since taken out my own comment.php suggestion and it obviously still works however with both codes included i'm sure it worked too but i'm not recommending it!!!

one more question thou'











just kdding because as you said yourself, you ARE expecting them :mrgreen: