PDA

View Full Version : Username as search field for account page



rosegarden
September 20, 2012, 01:13 AM
I notice you cannot search user using their username.

You can search by nearly all the rest of the account_fields.

How can i add username as a search field?

I referring to the account page , not the listing page.

Vladimir
September 20, 2012, 04:48 AM
Hello,

You can try to fix it the following way:

1.
- open the file: templates/your_template/tpl/controllers/account_type.tpl
- find this code:



{include file='blocks'|cat:$smarty.const.RL_DS|cat:'fields_ search.tpl'}

<table class="search">
<tr>
<td class="field button"></td>
<td class="value button"><input type="submit" name="search" value="{$lang.search}" /></td>
</tr>
</table>


- and change it to following code:



{include file='blocks'|cat:$smarty.const.RL_DS|cat:'fields_ search.tpl'}

<table class="search">
<tr>
<td class="field">{$lang.username}</td>
<td class="value">
<input type="text" name="f[username]" value="{$smarty.post.username}" />
</td>
</tr>
<tr>
<td class="field button"></td>
<td class="value button"><input type="submit" name="search" value="{$lang.search}" /></td>
</tr>
</table>


2.
- open the file: includes/classes/rlAccount.class.php
- go to method searchDealers()
- find this line:



$sql .= "ORDER BY ";


- and add before it the following code:



if(!empty($data['username']))
{
$sql .= "AND `T1`.`username` LIKE '{$data['username']}%' ";
}

Petrache Nicolae
September 20, 2012, 07:02 AM
I notice you cannot search user using their username.

You can search by nearly all the rest of the account_fields.

How can i add username as a search field?

I referring to the account page , not the listing page.

hello. have you tried the fix from Vladimir? does it work ok? i am interesting in adding this as well if is working ok. Thanks

Petrache Nicolae
September 20, 2012, 09:13 PM
solution works fine. thanks Valdimir
can you take a look at http://www.flynax.com/forum/showthread.php?604-Personal-page-same-as-username
it is not working if user name is made of 2 or more splited words. with one word works fine.