RO Power Hosting Forum

Web Discutions => Forumuri => SMF => Topic started by: justkid on Mar 18, 2014, 08:23 PM

Title: Ajutor![Dati TC]
Post by: justkid on Mar 18, 2014, 08:23 PM
Salut,
Deci :)) O problema am rezolvat-o =] a mai ramas doua xD si gata, mai multe probleme grele de genu nu o sa mai fie ;D [sau poate da D:]

1)De ceva timp am inceput sa lucrez la editarea unei teme SMF XD, dar cand am ajuns la TAB-uri am intalnit cateva probleme xD
Deci, doresc ca intr-un tab sa fie mai multe sub-board-uri inclusiv : Profile, Admin[Daca are], Moderate, Login[Daca este Guest], Register[La fel] si Logout. Am incercat sa le combin ... dar toate merg inafara de Logout...
Link-ul care il da nu este bun ... adica daca nu-l pun in tab si las link-u merge ... dar asa nu... deci poftim codul sursa :

removed
Codurile astea is luate din /smf-forum/Sources/Subs.php

2)Deci tot la acea tema si tot in acea locatie [in acel tab cu mai multe categorii] doresc ca cand un user este logat sa-i arate numele acolo, iar cand nu este logat sa-i arate guest xD
Am cam incercat sa-i arate numele dar fara succes ...


LAST: Deci, am pus doua feluri de tab-uri ... o parte in partea stanga si unu [UNU] in partea dreapta ... acolo in dreapta imi arata Nickname-ul si cand duc cursorul pe el imi deschide niste sub-butoane cu Profile, Admin, Moderate, Logout... Pana aici toate bune si frumoase :)) [inafara de logout, de mai sus] Dar problema mea este ca imi arata doua taburi nu unu, adica In loc sa-mi apara tab-ul "ADMIN' [numele meu] Imi apar doua de ADMIN ... in una is cu mai multe sub-butoane si altu fara ... dar ma redirectioneaza la profil ... ma rog ... am editat niste coduri dar nush daca is corecte 100% ... sau macar unde este greseala mea ...
Codurile is luate din /smf-forum/Sources/Subs.php
Codu:
//////user-buttons//////////
if (($test_buttons = cache_get_data('test_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'profile' => array(
'title' => $txt['user'],
'show' => true,
'sub_buttons' => array(
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
),
    'admin' => array(
        'title' => $txt['admin'],
        'href' => $scripturl . '?action=admin',
        'show' => $context['allow_admin'],
                ),
        'moderate' => array(
            'title' => $txt['moderate'],
          'href' => $scripturl . '?action=moderate',
            'show' => $context['allow_moderation_center'],
                ),
'login' => array(
      'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'logout' => array(
    'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;%1$s=%2$s',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
),
),
);

// Allow editing menu buttons easily.
call_integration_hook('integrate_test_buttons', array(&$buttons));

// Now we put the buttons in the context so the theme can use them.
$test_buttons = array();
foreach ($buttons as $act => $button)
if (!empty($button['show']))
{
$button['active_button'] = false;

// Make sure the last button truely is the last button.
if (!empty($button['is_last']))
{
if (isset($last_button))
unset($test_buttons[$last_button]['is_last']);
$last_button = $act;
}

// Go through the sub buttons if there are any.
if (!empty($button['sub_buttons']))
foreach ($button['sub_buttons'] as $key => $subbutton)
{
if (empty($subbutton['show']))
unset($button['sub_buttons'][$key]);

// 2nd level sub buttons next...
if (!empty($subbutton['sub_buttons']))
{
foreach ($subbutton['sub_buttons'] as $key2 => $sub_button2)
{
if (empty($sub_button2['show']))
unset($button['sub_buttons'][$key]['sub_buttons'][$key2]);
}
}
}

$test_buttons[$act] = $button;
}

if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('test_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $test_buttons, $cacheTime);
}
$context['test_buttons'] = $test_buttons;

// Logging out requires the session id in the url.
if (isset($context['test_buttons']['logout']))
$context['test_buttons']['logout']['href'] = sprintf($context['test_buttons']['logout']['href'], $context['session_var'], $context['session_id']);

// Figure out which action we are doing so we can set the active tab.
// Default to home.
$current_action = 'home';

if (isset($context['test_buttons'][$context['current_action']]))
$current_action = $context['current_action'];
elseif ($context['current_action'] == 'search2')
$current_action = 'search';
elseif ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))
$current_action = 'login';
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';

$context['test_buttons'][$current_action]['active_button'] = true;

if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['test_buttons']['pm']))
{
$context['test_buttons']['pm']['alttitle'] = $context['test_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['test_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}




NO HAI CLAR :))) MERSI DE AJUTOR ... am rezolvat si singur :))
Deci daca vreti sa mai adaugati un tip de tab-uri mai bine lasati-o balta ... mai bine adaugati prin permisiuni gen:
if($context['user']['is_admin']
{
}
Am dat un exemplu scurt =] si prin asta explicam ca dupa acoladele date ce vom scrie vor vedea doar adminii asa putem adauga si tab-urile :D
Mersi din nou :D