Login     Sign up
Search bar
Thakim (@thakim83)
Join date: Oct 8th 2010
Community posts: 87
View Profile
Send Message

Is there a way we can make the search bar only visible to members who have logged in and hide it from the guests?

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

you have to edit page.tpl.php of your theme.

[code]
<?php if ($client['id']) {
echo '
<td valign="bottom">
<table cellpadding="0" cellspacing="0">
<form action="'.url('search/listing').'" method="post" name="search_form">
<tr>
<td valign="top">
<input type="text" id="search_box" name="title" value="" name="search_box" />
</td>
<td>
<input type="submit" value="find" id="search_button" style="display:none" />
</td>
</tr>
</form>
</table>
</td>';
} ?>
[/code]

174 months ago
Thakim (@thakim83)
Join date: Oct 8th 2010
Community posts: 87
View Profile
Send Message

Great but how do i edit that code?

174 months ago
AL (@switch48)
Join date: Sep 1st 2010
Community posts: 450
View Profile
Send Message

[quote=thakim83]Great but how do i edit that code? [/quote]

Yum nice fix Falcone ,Just open your theme page.tpl.php file in editor then find and replace the above code... done :)

174 months ago
Thakim (@thakim83)
Join date: Oct 8th 2010
Community posts: 87
View Profile
Send Message

Thanks mate but I will replace the above code with what other code?

174 months ago
AL (@switch48)
Join date: Sep 1st 2010
Community posts: 450
View Profile
Send Message

[quote=thakim83]Thanks mate but I will replace the above code with what other code? [/quote]

replace this code ..

<td valign="bottom">
<table cellpadding="0" cellspacing="0">
<form action="'.url('search/listing').'" method="post" name="search_form">
<tr>
<td valign="top">
<input type="text" id="search_box" name="title" value="" name="search_box" />
</td>
<td>
<input type="submit" value="find" id="search_button" style="display:none" />
</td>
</tr>
</form>
</table>
</td>';

with this code

<?php if ($client['id']) {
echo '
<td valign="bottom">
<table cellpadding="0" cellspacing="0">
<form action="'.url('search/listing').'" method="post" name="search_form">
<tr>
<td valign="top">
<input type="text" id="search_box" name="title" value="" name="search_box" />
</td>
<td>
<input type="submit" value="find" id="search_button" style="display:none" />
</td>
</tr>
</form>
</table>
</td>';
} ?>

174 months ago
AL (@switch48)
Join date: Sep 1st 2010
Community posts: 450
View Profile
Send Message

Bummer doesnt work with 4.1

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

in page.tpl.php blue theme

[code]
<td width="610px">
<? if (!$client['id']){ echo '
<table cellpadding="0" cellspacing="0">
<form action="'.url('search/listing').'" method="post" name="search_form">
<tr>
<td valign="top">
<input type="text" id="search_box" name="title" value="" name="search_box" />
</td>
<td>
<input type="submit" value="find" id="search_button" style="display:none" />
</td>
<td>
<input type="image" src="'.uhome().'/themes/blue/search_button.gif'.'" />
</td>
</tr>
</form>
</table>';} ?>
</td>
[/code]

see the width in the td-tag and the closing td-tag above </tr></form>

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

ok this fixed column width doesn't seem to be a good idea

174 months ago
AL (@switch48)
Join date: Sep 1st 2010
Community posts: 450
View Profile
Send Message

Hmmm yea that worked but has opposite effect..

searchbar there when not logged in and disappears when logged in

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

[code]
<? if ($client['id']){ echo '
<td>
<table cellpadding="0" cellspacing="0">
<form action="'.url('search/listing').'" method="post" name="search_form">
<tr>
<td valign="top">
<input type="text" id="search_box" name="title" value="" name="search_box" />
</td>
<td>
<input type="submit" value="find" id="search_button" style="display:none" />
</td>
<td>
<input type="image" src="'.uhome().'/themes/blue/search_button.gif'.'" />
</tr>
</form>
</table>
</td>';}
else {
echo '<td width="660px"></td>';
}
[/code]

174 months ago
AL (@switch48)
Join date: Sep 1st 2010
Community posts: 450
View Profile
Send Message

Hmmm that one just gives me blank page...

174 months ago
1 2 Next