Skocz do zawartości
Hosting webh.pl - 20%

Leaders

Rekomendowane odpowiedzi

Opublikowano

Witam,

Już mam dosyć, analizuje ten kod i.. i tak mi nic nie wychodzi. ;) Jakieś to zakręcone tam jest. [ http://forum.invisionize.pl/index.php?act=...mp;CODE=leaders ]

Próbuje ustawić tak, że będą wyświetlani userzy według grup a nie czy ma dostęp do panelu, czy ma zaznaczone funkcje że jest Super Moderatorem. Ogólnie rzecz biorąc, chce zrobić tak aby wyświetlało mi w:

  • Administratorzy - Wszystkich z grupy 4
  • Super moderatorzy - Wszystkich z grupy 22
  • (Zrobić nową ramkę)
    Moderatorzy - Wszystkich z grupy 9
  • Moderatorzy For - Zostaje

Tyle. ^^

Pozdrawiam,

KliczeK

In, and Out.

Opublikowano
  • Manager

Zatem po testach na GG - wykonane. Kod funkcji show_leaders() w pliku sources/action_public/misc/stats.php jest następujący: ( umieszczam w code by się wcięcia nie zgubiły - na nowej wersji IP.Board 3.x będzie to już ładnie wyglądać )

 	/*-------------------------------------------------------------------------*/
	// SHOW FORUM LEADERS
	/*-------------------------------------------------------------------------*/

	function show_leaders()
	{
	//-----------------------------------------
	// Work out where our super mods / admins/ mods
	// are.....
	//-----------------------------------------

	$group_ids  = array();
	$member_ids = array();
	$used_ids   = array();
	$members	= array();
	$moderators = array();

	foreach( $this->ipsclass->cache['group_cache'] as $i )
	{
		if ( $i['g_is_supmod'] )
		{
			$group_ids[ $i['g_id'] ] = $i['g_id'];
		}

		if ( $i['g_access_cp'] )
		{
			$group_ids[ $i['g_id'] ] = $i['g_id'];
		}
	}

	foreach( $this->ipsclass->cache['moderators'] as $i )
	{
		if ( $i['is_group'] )
		{
			$group_ids[ $i['group_id'] ] = $i['group_id'];
		}
		else
		{
			$member_ids[ $i['member_id'] ] = $i['member_id'];
		}
	}

	//-----------------------------------------
	// Get all members.. (two is more eff. than 1)
	//-----------------------------------------

	if ( count( $member_ids ) )
	{
		$this->ipsclass->DB->cache_add_query( 'stats_get_all_members', array( 'member_ids' => $member_ids ) );
		$this->ipsclass->DB->cache_exec_query();

		while( $r = $this->ipsclass->DB->fetch_row() )
		{
			$members[ strtolower($r['members_display_name']) ] = $r;
		}
	}

	//-----------------------------------------
	// Get all groups.. (two is more eff. than 1)
	//-----------------------------------------

	$this->ipsclass->DB->cache_add_query( 'stats_get_all_members_groups', array( 'group_ids' => $group_ids ) );
	$this->ipsclass->DB->cache_exec_query();

	while( $r = $this->ipsclass->DB->fetch_row() )
	{
		$members[ strtolower($r['members_display_name']) ] = $r;
	}

	ksort($members);

	//-----------------------------------------
	// PRINT: Admins from group nr 4
	//-----------------------------------------

	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( $this->ipsclass->lang['leader_admins'] );

	foreach( $members as $member )
	{
		if ( $member['mgroup'] == 4 )
		{
			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( $this->parse_member( $member ), $this->ipsclass->lang['leader_all_forums'] );

			//-----------------------------------------
			// Used...
			//-----------------------------------------

			$used_ids[] = $member['id'];
		}
	}

	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();

  //-----------------------------------------	
	// PRINT Super Moderators from group nr 22 - by DawPi ipslink.pl
	//-----------------------------------------

	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( 'Super moderatorzy' );

	foreach( $members as $member )
	{
		if ( $member['mgroup'] == 22 and ( ! in_array( $member['id'], $used_ids) ))
		{
			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( $this->parse_member( $member ), $this->ipsclass->lang['leader_all_forums'] );

			//-----------------------------------------
			// Used...
			//-----------------------------------------

			$used_ids[] = $member['id'];
		}
	}

	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();		

	//-----------------------------------------
	// PRINT: Moderators from group nr 9 - by DawPi ipslink.pl
	//-----------------------------------------

	$tmp_html = "";

	foreach( $members as $member )
	{
		if ( $member['mgroup'] == 9 and ( ! in_array( $member['id'], $used_ids) ))
		{
			$tmp_html .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( $this->parse_member( $member ), $this->ipsclass->lang['leader_all_forums'] );

			//-----------------------------------------
			// Used...
			//-----------------------------------------

			$used_ids[] = $member['id'];
		}
	}

	if ( $tmp_html )
	{
		$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( 'Moderatorzy' );
		$this->output .= $tmp_html;
		$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();
	}

	//-----------------------------------------
	// GET MODERATORS: Normal
	//-----------------------------------------

	$tmp_html = "";

	foreach( $members as $member )
	{
		if ( ! in_array( $member['id'], $used_ids) ) 
		{
			foreach( $this->ipsclass->cache['moderators'] as $data )
			{
				if ( $data['is_group'] and $data['group_id'] == $member['mgroup'] )
				{
					if ( $this->ipsclass->check_perms( $this->ipsclass->forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
					{
						$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
					}

					$used_ids[] = $member['id'];
				}
				else if ( $data['member_id'] == $member['id'] )
				{
					if ( $this->ipsclass->check_perms( $this->ipsclass->forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
					{
						$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
					}

					$used_ids[] = $member['id'];
				}
			}
		}
	}

	//-----------------------------------------
	// Parse moderators
	//-----------------------------------------

	if ( count($moderators) > 0 )
	{
		$mod_array = array();

		$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( $this->ipsclass->lang['leader_mods'] );

		foreach ( $moderators as $i )
		{
			if ( ! isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
			{
				//-----------------------------------------
				// Member is not already set, lets add the member...
				//-----------------------------------------

				$mod_array['member'][ $i['id'] ] = array( 'members_display_name' => $i['members_display_name'],
														  'email'	  => $i['email'],
														  'hide_email' => $i['hide_email'],
														  'location'   => $i['location'],
														  'aim_name'   => $i['aim_name'],
														  'icq_number' => $i['icq_number'],
														  'id'		 => $i['id']
														);

			}

			//-----------------------------------------
			// Add forum..	
			//-----------------------------------------

			$mod_array['forums'][ $i['id'] ][] = array( $i['forum_id'] , $this->ipsclass->forums->forum_by_id[ $i['forum_id'] ]['name'] );
		}

		foreach( $mod_array['member'] as $id => $data )
		{
			$fhtml = "";

			if ( count( $mod_array['forums'][ $id ] ) > 1 )
			{
				$cnt   = count( $mod_array['forums'][ $id ] );
				$fhtml = $this->ipsclass->compiled_templates['skin_stats']->leader_row_forum_start($id, sprintf( $this->ipsclass->lang['no_forums'],  $cnt ) );

				foreach( $mod_array['forums'][ $id ] as $data )
				{
					$fhtml .= $this->ipsclass->compiled_templates['skin_stats']->leader_row_forum_entry($data[0],$data[1]);
				}

				$fhtml .= $this->ipsclass->compiled_templates['skin_stats']->leader_row_forum_end();
			}
			else
			{
				$fhtml = "<a href='{$this->ipsclass->base_url}showforum=".$mod_array['forums'][ $id ][0][0]."'>".$mod_array['forums'][ $id ][0][1]."</a>";
			}


			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( 
													   $this->parse_member( $mod_array['member'][ $id ] ),
													   $fhtml
													);
		}

		$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();

	}

	$this->page_title = $this->ipsclass->lang['forum_leaders'];
	$this->nav		= array( $this->ipsclass->lang['forum_leaders'] );
	}

Pozdrawiam,

DawPi

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

Dzięki, wszystko działa. ;) Zaraz obadam kod co żeś tam naskrobał.

In, and Out.

Opublikowano
  • Manager

Normalnie na stronie z kadrą ( podział - admin, super mod, mod ) są wyświetlane owe trzy grupy. Tutaj KliczeK chciał to inaczej zorganizować - pokazać te grupy nie na podstawie praw ( ww. ), ale na podstawie ID grup..

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

Tiaa, bo dasz komuś dostęp do panelu i już widać go jako Administrator, a Administrator może mieć prawa jako Jr Admin i już d*pa... ;)

In, and Out.

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.