Jump to content
Spanner

[IP.Board 3.1.x] Odznaczenie użytkowników z ostrzeżeniem

Recommended Posts

Czasami chcielibyśmy, aby na stronie głównej forum użytkownicy, którzy dostali ostrzeżenie, byli jakoś specjalnie odznaczeni i aby to odznaczenie było widoczne dla wszystkich. Poniższy artykuł opisuje jak tego dokonać.

warnDesign.png

Otwórz: admin/applications/forums/modules_public/forums/boards.php

Znajdź:

				//-----------------------------------------
// Member?
//-----------------------------------------

else
{
if ( empty( $cached[ $result['member_id'] ] ) )
{
$cached[ $result['member_id'] ] = 1;

$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );

if ( $result['login_type'] )
{
if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
{
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
$active['ANON']++;
}
else
{
$active['ANON']++;
}
}
else
{
$active['MEMBERS']++;
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
}
}
}[/code] [b]Zamień na:[/b]
[code] //-----------------------------------------
// Member?
//-----------------------------------------

else
{
if ( empty( $cached[ $result['member_id'] ] ) )
{
$cached[ $result['member_id'] ] = 1;

$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );

$memberDetails = IPSMember::buildDisplayData( $result['member_id'] );

if(!is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
{
$result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
}

if ( $result['login_type'] )
{
if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
{
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
$active['ANON']++;
}
else
{
$active['ANON']++;
}
}
else
{
$active['MEMBERS']++;
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
}
}
}
Zapisz zmiany i wgraj plik Następnie zaloguj się do ACP i przejdź na zakładkę Skiny & Języki. Dla danego skina z menu rozwijanego wybierz opcję Zarządzaj zamiennikami. Następnie wybierz dodaj nowy zamiennik i uzupełnij następująco formularz: Klucz zamiennika warn_info Zawartość zamiennika
<img src="{style_image_url}/warn_info.gif" /> 

a na koniec wgraj dołączony obrazek do katalogu /public/style_images/x/ gdzie X to jest katalog skina

Polska wersja artykułu: Odznaczenie użytkowników z ostrzeżeniem

Angielska wersja artykułu: Mark members with warn

Ten post został wypromowany na artykuł

post-1-0-20830700-1289403565_thumb.gif

  • Like 1

Share this post


Link to post
Share on other sites

Działa elegancko jednak...

- Co zrobić aby wykrzyknik był za nickiem z lekką spacją

- "Zawartość zamiennika" może być dla niektórych nieczytelna i będą wklejać na pałe link do wszystkich skinów ;)

- Co zrobić aby wykrzyknik był również widoczny w "Użytkownicy on-line dzisiaj:" (Hook (IM) Members Online Today)

Share this post


Link to post
Share on other sites

Ad 1. zamień:

$result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
na:
$result['member_name'] .= ' '.$this->registry->getClass('output')->getReplacement('warn_info');
Ad 2. aaa już wiem o co Ci chodzi ... hmm zostało to sparsowane podczas pisania - już poprawiłem to Ad 3. Chcesz zmienić plik XML czy plik Hooka ? jeśli to pierwsze to otwórz XML, jeśli to drugie to otwórz plik /hooks/membersOnlineToday.... znajdź:
$this->DB->build( array( 'select'   => 'm.member_id, m.members_display_name, m.member_group_id, m.last_activity, m.members_seo_name',

'from' => array( 'members' => 'm' ),

'where' => "m.member_id <> 0 AND m.members_display_name <> '' AND m.last_activity > ".time()." - {$numcheck}{$exclude}",

'add_join' => array( 0 => array( 'from' => array( 'groups' => 'g' ),

'where' => 'm.member_group_id=g.g_id',

'type' => 'left' ) ),

'order' => "m.members_display_name ASC",

) );

$outer = $this->DB->execute();

$this->DB->build( array( 'select'   => 'm.member_id, m.members_display_name, m.member_group_id, m.last_activity, m.members_seo_name, m.warn_level',

'from' => array( 'members' => 'm' ),

'where' => "m.member_id <> 0 AND m.members_display_name <> '' AND m.last_activity > ".time()." - {$numcheck}{$exclude}",

'add_join' => array( 0 => array( 'from' => array( 'groups' => 'g' ),

'where' => 'm.member_group_id=g.g_id',

'type' => 'left' ) ),

'order' => "m.members_display_name ASC",

) );

$outer = $this->DB->execute();

Znajdź:
$link = IPSLib::makeProfileLink( IPSLib::makeNameFormatted( $user['members_display_name'], $user['member_group_id'] ), $user['member_id'], $user['members_seo_name'] );
Zamień na: (jeśli ma być ikonka przed nazwą użytkownika)
$link = IPSLib::makeProfileLink( ((!is_null($user['warn_level']) && $user['warn_level'] > 0) ? $this->registry->getClass('output')->getReplacement('warn_info') : ''). IPSLib::makeNameFormatted( $user['members_display_name'], $user['member_group_id'] ), $user['member_id'], $user['members_seo_name'] );
Jeśli ma być po nazwie użytkownika
$link = IPSLib::makeProfileLink( IPSLib::makeNameFormatted( $user['members_display_name'], $user['member_group_id'] ).((!is_null($user['warn_level']) && $user['warn_level'] > 0) ? ' '.$this->registry->getClass('output')->getReplacement('warn_info') : ''), $user['member_id'], $user['members_seo_name'] );

  • Like 1

Share this post


Link to post
Share on other sites

Witam.

Hooks mi sie wysypal po edycji,jak sie okazalo ten hooks nie za bardzo sie nadaje do mojej wersji forum.

Po wgraniu popranwj wersji moda wszystko ladnie smiga.

Pzd.

Edited by Vader

Sprzedam Licencje IPS LIFE aktywna oraz forum

Info na PW

Share this post


Link to post
Share on other sites

Boję się abym czegoś nie pochrzanił, ale spróbuję.

Edit: W 3.3.x to co należy znaleźć i zamienić, różni się, nie będę ryzykował.

Edited by Kombajn

Share this post


Link to post
Share on other sites
co trzeba by zrobic aby bylo widoczne tylko dla adminow i moderatorow ?
 

 

 

 

Musisz to objąć w :

if( $this->memberData['g_access_cp'] || $this->memberData[ 'g_is_supmod' ])
{
....
}
 

 

 

 

 

 

 

 

cos nie teges

 

forum sie wysypuje

 

dlatego pytanie, objac calosc i bedzie to wygladalo tak:

 

//-----------------------------------------
				// Member?
				//-----------------------------------------
				
                           if( $this->memberData['g_access_cp'] || $this->memberData[ 'g_is_supmod' ])
                            {
				else
				{
					if ( empty( $cached[ $result['member_id'] ] ) )
					{
						$cached[ $result['member_id'] ] = 1;

						$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
						
						$memberDetails = IPSMember::buildDisplayData( $result['member_id'] );
						
						if(!is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
						{
						    $result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
						}
						
						if ( $result['login_type'] )
						{
							if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
							{
								$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
								$active['ANON']++;
							}
							else
							{
								$active['ANON']++;
							}
						}
						else
						{
							$active['MEMBERS']++;
							$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
						}
					}
				}
                         }

wtedy wywala blad z "else"

Parse error: syntax error, unexpected T_ELSE in /virtual/pl/h2/vkp/forum/adminpanel/applications/forums/modules_public/forums/boards.php on line 387

 

czy w ten sposob:

 

 

//-----------------------------------------
				// Member?
				//-----------------------------------------
				
                           
				else
				{
					if ( empty( $cached[ $result['member_id'] ] ) )
					{
						$cached[ $result['member_id'] ] = 1;

						$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
					if( $this->memberData['g_access_cp'] || $this->memberData[ 'g_is_supmod' ])
                            {	
						$memberDetails = IPSMember::buildDisplayData( $result['member_id'] );
						
						if(!is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
						{
						    $result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
						}
					}	
						if ( $result['login_type'] )
						{
							if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
							{
								$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
								$active['ANON']++;
							}
							else
							{
								$active['ANON']++;
							}
						}
						else
						{
							$active['MEMBERS']++;
							$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
						}
					}
				}
                         

wtedy jest:

Fatal error: Call to undefined method IPSLib::makeNameFormatted() in /virtual/pl/h2/vkp/forum/adminpanel/applications/forums/modules_public/forums/boards.php on line 395

Share this post


Link to post
Share on other sites

Ogólnie wystarczy zamienić:

						if(!is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
						{
						    $result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
						}

na:

if( ( $this->memberData['g_access_cp'] || $this->memberData[ 'g_is_supmod' ]) && !is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
						{
						    $result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
						}

W nowej wersji nie ma już IPSLib::makeNameFormatted() tylko IPSMember::makeNameFormatted()

Share this post


Link to post
Share on other sites

ok, teraz dziala

 

prawidlowa zawartosc w tym wypadku jest taka:

 

//-----------------------------------------
				// Member?
				//-----------------------------------------
				
				else
				{
					if ( empty( $cached[ $result['member_id'] ] ) )
					{
						$cached[ $result['member_id'] ] = 1;

						$result['member_name'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
						
						    $memberDetails = IPSMember::buildDisplayData( $result['member_id'] );
								if( ( $this->memberData['g_access_cp'] || $this->memberData[ 'g_is_supmod' ]) && !is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
    {
    $result['member_name'] = $this->registry->getClass('output')->getReplacement('warn_info').$result['member_name'];
    }
						
						if ( $result['login_type'] )
						{
							if ( $this->memberData['g_access_cp'] )
							{
								$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
								$active['ANON']++;
							}
							else
							{
								$active['ANON']++;
							}
						}
						else
						{
							$active['MEMBERS']++;
							$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
						}
					}
				}
			}

Share this post


Link to post
Share on other sites

A wykrzyknik za nickiem i warn widoczny dla wszystkich:

 

 

 

//-----------------------------------------
				// Member?
				//-----------------------------------------
				
				else
				{
					if ( empty( $cached[ $result['member_id'] ] ) )
					{
						$cached[ $result['member_id'] ] = 1;

						$result['member_name'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
						
						    $memberDetails = IPSMember::buildDisplayData( $result['member_id'] );
								if( !is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
    {
    $result['member_name'] .= ' '.$this->registry->getClass('output')->getReplacement('warn_info');
    }
						
						if ( $result['login_type'] )
						{
							if ( $this->memberData['g_access_cp'] )
							{
								$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
								$active['ANON']++;
							}
							else
							{
								$active['ANON']++;
							}
						}
						else
						{
							$active['MEMBERS']++;
							$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
						}
					}
				}
			}

 

Dzięki Duke za robotę.

Share this post


Link to post
Share on other sites

To się nie nadaje pod 3.3.x Panowie bo usuwa oryginalny kod. Np wywaliło podgląd profilów, dodatkowo u mnie system gwiazdek.

 

 Wprowadziłem do oryginalnego kodu 3.3.x fragmenty z powyższego tutka i kod ma wyglądać tak:

 

 

 

				//-----------------------------------------
				// Member?
				//-----------------------------------------
				
				else
				{
					if ( empty( $cached[ $result['member_id'] ] ) )
					{
						$cached[ $result['member_id'] ] = 1;

						$result['member_name'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
												    $memberDetails = IPSMember::buildDisplayData( $result['member_id'] );
								if( !is_null($memberDetails['warn_level']) && $memberDetails['warn_level'] > 0)
    {
    $result['member_name'] .= ' '.$this->registry->getClass('output')->getReplacement('warn_info');
    }
						
						/* Reset login type in case the board/group setting got changed */
						$result['login_type']  = IPSMember::isLoggedInAnon( array( 'login_anonymous' => $result['login_type'] ), $result['member_group'] );
						
						if ( $result['login_type'] )
						{
							if ( $this->memberData['g_access_cp'] || ( $this->memberData['member_id'] == $result['member_id'] ) )
							{
								$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date ) . "*";
								$active['ANON']++;
							}
							else
							{
								$active['ANON']++;
							}
						}
						else
						{
							$active['MEMBERS']++;
							$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date );
						}
					}
				}
			}

Share this post


Link to post
Share on other sites

no bo w nowym ipb nie używa makeNameFormated tylko makeProfileLink więc tutaj jest różnica :)

Share this post


Link to post
Share on other sites

Po instalacji hooka (TB) Display Members Browser v3.0.0

 

Wywala wykrzykniki, po wyłączeniu wracają. Może ktoś wie co nie gra?

 

Wprawdzie nie wiem czy nie wywalę tych wykrzykników bo obciążają zbytnio. 1 zalogowany user = 1 zapytanie do bazy. Siądzie 200 osób i mam niezły lol.

Share this post


Link to post
Share on other sites

Nie mam Duke, ale to nieważne. Każdego i tak z osobna sprawdza czy on ma warna czy nie.

 

Obecnie jedna osoba z warnem on-line

 

 

Edit: Teraz jest już późno, po "godzinach szczytu"

 

2qKYNA1.png

 

Tylko ok 80 userów na forum. Zarejestrowanych userów bo wszystkich jest ponad 400.

 

Malutkie forum. Ciekawe jakby serwer kwiczał gdyby było z 1k on-line? :D

 

 

Ale to mnie nie martwi bo mamy mocny serwer, martwi mnie tylko to, że po włączeniu tamtego hooka znikają wykrzykniki.

Edited by Kombajn

Share this post


Link to post
Share on other sites

Masz włączone?

 

Ustawienia systemowe > System > General Configuration

 

BaLF6vO.png

 

Share this post


Link to post
Share on other sites

No to musiałeś wywalić ze skina, globalTemplate

 



<if test="showdebuglevel:|:$this->memberData['member_id'] and $this->settings['debug_level']">
				<div id='ipsDebug_footer'>
					<strong>{$this->lang->words['time_now']}</strong> {$footer_items['time']}
					<if test="lastvisit:|:$this->memberData['member_id'] AND $this->memberData['last_visit']"><strong>{$this->lang->words['you_last_visit']}</strong> {parse date="$this->memberData['last_visit']" format="short"}</if>
					<strong>{$this->lang->words['stat_exec']}</strong> {$stats['ex_time']} <if test="isfloat:|:is_float($stats['ex_time'])">{$this->lang->words['stats_sec']}</if>
					<strong>{$this->lang->words['stat_load']}</strong> {$stats['server_load']}
					<strong>{$this->lang->words['stat_queries']}</strong> {$stats['queries']} <if test="sqldebuglink:|:IPS_SQL_DEBUG_MODE"><a href='{parse url="{$this->settings['query_string_safe']}&amp;debug=1" base="public"}'></if>{$this->lang->words['stats_queries']}<if test="closesqldebuglink:|:IPS_SQL_DEBUG_MODE"></a></if>
					<strong>{$this->lang->words['stat_gzip']}</strong> {$stats['gzip_status']}
				</div>
			</if>
Edited by Kombajn

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

W celu świadczenie usług przez nasz Serwis na najwyższym poziomie, w ramach Serwisu wykorzystujemy pliki Cookies (tzw. ciasteczka). Korzystając ze stron Serwisu IPSBEYOND.PL bez zmiany ustawień przeglądarki będą one zapisane w pamięci urządzenia. Jeżeli nie dokonacie Państwo zmiany ustawień przeglądarki internetowej to wyrażacie zgodę na zapisywanie plików Cookies.