Skip to main content
Topic: VB-Style-Login and Search displayed in Infocenter? (Read 7287 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

VB-Style-Login and Search displayed in Infocenter?

Hello!

i don't know if this is possible and how to do it - but I would like to change the places of the vB-Style-Login and the search.

In my opinion, they don't look nice placed in the forums header and they are not this nessesary on the top, because there is a button to log in and a search as well, if you are using the dropdown. But I also think, the vB-Style-Login and this search are useful and should be somewhere.

Could they be displayed as a part of the infocenter? On the bottom there? So they can collapsed together with the infocenter, if you don't want to use or to see them?
Last Edit: August 29, 2014, 04:37:53 am by Ruth

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #1

I thought I answered to that one... oh no, I wanted to get to my (main) computer first and then it slipped out of sight.

Due to a change I made recently[1] is slightly less easy to obtain the change, but is somehow "logical"... and actually is not that difficult either.

Let me see...
The log in and search bars are in two functions:
template_th_login_bar
and
template_th_search_bar
that you can find in index.template.php.

The name is quite important, because just changing it they will stop to appear at the top.
So, if you for example change it to:
template_login_bar
and
template_search_bar
the two boxes will disappear.

Now you have to make them show in the IC.
The IC is shown only on the BoardIndex, so the code is in BoardIndex.template.php.

The exact result depends on how "exactly" you want to show them, let's say you want to create a single block for both, then add to the end of the page:
Code: [Select]
function template_ic_show_tools()
{
global $context, $txt, $settings;

echo '
<li class="board_row">
<h3 class="ic_section_header">
<img class="icon" src="', $settings['images_url'], '/icons/online.png', '" alt="" />Users tools</a>
</h3>';

if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
}

and, just before the line:
Code: [Select]
call_template_callbacks('ic', $context['info_center_callbacks']);
add this:
Code: [Select]
	if ($context['user']['is_guest'] || $context['allow_search'])
$context['info_center_callbacks'][] = 'show_tools';

It should work... I think. O:-)
There may be issues with the css of course...
I knew I should not do "big" changes in RC! Darn!
Bugs creator.
Features destroyer.
Template killer.

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #2

Thank you very much, emanuele... it don't looks very difficult... ;)

But I am not sure that  I understood it all...

In index.template.php I couldn't find this functions to change their names as you said:

Quote from: emanuele –
The log in and search bars are in two functions:
template_th_login_bar
and
template_th_search_bar
that you can find in index.template.php.


Are they somewhere else? I didn't found them...  :(

In index.template.php I just see  those:

Code: [Select]
// Show log in form to guests.
if (!empty($context['show_login_bar']))
{
echo '
<div id="top_section_notice" class="user"> etc.

Code: [Select]
if ($context['allow_search'])
{
echo '
<form id="search_form" action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8">
<label for="quicksearch">
<input type="text" name="search" id="quicksearch" value="" class="input_text" placeholder="', $txt['search'], '" />
</label>';


Re: VB-Style-Login and Search displayed in Infocenter?

Reply #3

hmm... okay, then probably the changes I'm referring to are "post-RC2"... I'm never really sure when I add things... :-\
And that's yet another reason why I should refrain from let "big" changes slip through... lol
Bugs creator.
Features destroyer.
Template killer.

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #4

So I have to wait until the next version of ElkArte? ;)

Thank you for your help, emanuele and never mind...it's not this necessary to have those two functions displayed.

I have tried several other things, but none of them worked.

So I disabled the VB-Style-Login and added display: none in the CSS for the searchform. It is okay this way for the moment.

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #5

Well, you can download the latest files from the repo ( https://github.com/elkarte/Elkarte/ "download" button on the right), extract and upload. Of course remember that uploading them will overwrite changes you have done to the files up to now (if any).
Bugs creator.
Features destroyer.
Template killer.

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #6

Now I have tried this, emanuele - and it worked! Well, not excatly as I hoped.... ;)

The VB-Style-Login and the Search disapeared from the Header, they are now displayed in Infocenter and are both working. :)

But they are "a line to deep" there and this Icon and the "Users tools" should not be shown there?

I don't know, maybe I did something wrong?

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #7

I cannot figure it out how to get the login and the the search into the infocenter :(

So I did this:

Code: [Select]
function template_ic_show_tools()
{
global $context, $txt, $settings;

//echo '
//<li class="board_row">
//<h3 class="ic_section_header">
//<img class="icon" src="', $settings['images_url'], '/icons/online.png', '" alt="" />Users tools</a>
//</h3>';

if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
}


It looks like this now...

It is not as I would like it, but it is not too bad... ;)

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #8

Find in index.template.php function template_login_bar, copy it and paste (at the end of this file), change name of this 'new' function to template_login_bar2, change function name in your code.

Next step would be changing in in 'new' function top_section_notice to top_section_notice2.

Last step is adding some HTML to your code:
After globals add:
Code: [Select]
	echo '
<li class="board_row">';

and before } add
Code: [Select]
	echo'
</li>';

My version looks like this:
Code: [Select]
function template_ic_show_tools()
{
global $context, $txt, $settings;

echo '
<li class="board_row">';

if ($context['user']['is_guest'])
template_th_login_bar2();
if ($context['allow_search'])
template_th_search_bar();

echo'
</li>';
}

I'm not sure why login and search template functions are different in your files, but I think you will know what to do now :)

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #9

Thank you, phantom...but I don't know what to do at all... ;)
I have tried this now in boardindex.template:

Code: [Select]
function template_ic_show_tools()
{
global $context, $txt, $settings;

echo '
<li class="board_row">';

if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
echo'
</li>';
}

It looks like this:


Re: VB-Style-Login and Search displayed in Infocenter?

Reply #10

Quote from: phantom – I'm not sure why login and search template functions are different in your files

Because emanuele told me to change the names in index.template.php, otherwise the search and the login will not disappear from the header...not sure if I understood him properly...


Quote from: phantom – Find in index.template.php function template_login_bar, copy it and paste (at the end of this file), change name of this 'new' function to template_login_bar2, change function name in your code.

Next step would be changing in in 'new' function top_section_notice to top_section_notice2.

I am not sure, if I had understood... O:-) Where do I have to paste it and to change the name? In which file? In index.template.php? Not in boardindex.php?
Last Edit: September 19, 2014, 04:33:36 pm by Ruth

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #11

attach your index.template and BoardIndex.template files

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #12

Those with the changes of the moment or the original files?

At the moment they look like this:


Re: VB-Style-Login and Search displayed in Infocenter?

Reply #13

Try files from attachment

Re: VB-Style-Login and Search displayed in Infocenter?

Reply #14

Thank you very much, phantom.

It worked for the log in.  :) Looks quite nice...
But the search is still beyond the infocenter.