Required location

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
TheNameless
Posts: 6
Joined: Sat Mar 05, 2011 10:57 pm

Required location

Post 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 ?
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Required location

Post 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
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
TheNameless
Posts: 6
Joined: Sat Mar 05, 2011 10:57 pm

Re: Required location

Post by TheNameless »

Perfect ! thank you ! :D
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Required location

Post 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
Last edited by cAdams on Mon Oct 10, 2011 5:02 am, edited 1 time in total.
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Required location

Post 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.
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
cAdams
Posts: 40
Joined: Thu Sep 15, 2011 10:52 pm

Re: Required location

Post 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:
To All UALs (Unreliable Arrogant Liars), Go Play On The Motorway
Post Reply