Sorularsidebar core grup

sorulan sorumarı ? bu bölüm en yerleştirin.
Cevapla
Kullanıcı avatarı
kaptangula
Admin
Admin
Reactions:
Mesajlar: 39
Kayıt: Cum Ara 28, 2018 10:15 pm
Turkey

sidebar core grup

Mesaj gönderen kaptangula » Pzr Kas 10, 2019 4:31 pm

How to show groups?
I did not understand where the error

Kod: Tümünü seç

	public function groups_side($event)
	{
		// Display a listing of board admins, moderators
		$this->user->add_lang('groups');
		$order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend';

			if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
			{
				$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
					FROM ' . GROUPS_TABLE . '
					WHERE group_legend >= 1
					ORDER BY ' . $order_legend . ' ASC';
			}
			else
			{
				$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
					FROM ' . GROUPS_TABLE . ' g
					LEFT JOIN ' . USER_GROUP_TABLE . ' ug
						ON (
							g.group_id = ug.group_id
							AND ug.user_id = ' . $this->user->data['user_id'] . '
							AND ug.user_pending = 0
						)
					WHERE g.group_legend >= 1
						AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $this->user->data['user_id'] . ')
					ORDER BY g.' . $order_legend . ' ASC';
			}
			$result = $this->db->sql_query($sql, 600);

			while ($row = $this->db->sql_fetchrow($result))
			{
				$groups[$row['group_id']] = array(
					'group_name'	=> $row['group_name'],
					'group_colour'	=> $row['group_colour'],
					'group_type'	=> $row['group_type'],
					'group_users'	=> array(),
				);
				$legends[] = $row['group_id'];
			}
			$this->db->sql_freeresult($result);

			if (sizeof($legends))
			{
				$sql = 'SELECT
							u.user_id AS user_id, u.username AS username, u.username_clean AS username_clean,
							u.user_colour AS user_colour, ug.group_id AS group_id
						FROM
							' . USERS_TABLE . ' AS u,
							' . USER_GROUP_TABLE . ' AS ug
						WHERE
							ug.user_id = u.user_id
							AND '. $this->db->sql_in_set('ug.group_id', $legends) . '
						ORDER BY u.username_clean ASC';
				$result = $this->db->sql_query($sql, 600);

				while ($row = $this->db->sql_fetchrow($result))
				{
					$groups[$row['group_id']]['group_users'][] = array(
						'user_id'		=> $row['user_id'],
						'username'		=> $row['username'],
						'user_colour'	=> $row['user_colour'],
					);
				}
				$this->db->sql_freeresult($result);
			}

			if (sizeof($groups))
			{
				foreach ($groups as $group_id => $group)
				{
					if (sizeof($group['group_users']))
					{
						$group_name = ($group['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $group['group_name']] : $group['group_name'];
						$u_group = append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&amp;g=' . $group_id);

						$this->template->assign_block_vars('group', array(
							'GROUP_NAME'	=> $group_name,
							'GROUP_COLOUR'	=> $group['group_colour'],
							'U_GROUP'		=> $u_group,
						));

						foreach ($group['group_users'] as $group_user)
						{
							$this->template->assign_block_vars('group.member', array(
								'USER_ID'			=> $group_user['user_id'],
								'USERNAME_FULL'		=> get_username_string('full', $group_user['user_id'], $group_user['username'], $group_user['user_colour']),
							));
						}
					}
				}
			}

			$sql = $this->db->sql_build_query('SELECT', array(
				'SELECT'	=> 'u.user_id, u.group_id as default_group, u.username, u.user_colour, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend, ug.user_id as ug_user_id',
				'FROM'		=> array(
					USERS_TABLE		=> 'u',
					GROUPS_TABLE	=> 'g'
				),
				'LEFT_JOIN'	=> array(
					array(
						'FROM'	=> array(USER_GROUP_TABLE => 'ug'),
						'ON'	=> 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $this->user->data['user_id']
					)),
				'WHERE'		=> 'u.group_id = g.group_id AND ' . $this->db->sql_in_set('g.group_name', array('ADMINISTRATORS', 'GLOBAL_MODERATORS')),
				'ORDER_BY'	=> 'g.' . $order_legend . ' ASC, u.username_clean ASC'
			));

			$result = $this->db->sql_query($sql, 600);

			while ($row = $this->db->sql_fetchrow($result))
			{
				if ($row['group_name'] == 'ADMINISTRATORS')
				{
					$which_row = 'admins';
				}
				 if ($row['group_name'] == 'GLOBAL_MODERATORS')
				{
					$which_row = 'moderators';
				}
				else
				{
					continue;
				}

				if ($row['group_type'] == GROUP_HIDDEN && !$this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $this->user->data['user_id'])
				{
					$group_name = $this->user->lang['GROUP_UNDISCLOSED'];
					$u_group = '';
				}
				else
				{
					$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name'];
					$u_group = append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&amp;g=' . $row['group_id']);
				}

				$this->template->assign_block_vars($which_row, array(
					'USER_ID'			=> $row['user_id'],
					'GROUP_NAME'		=> $group_name,
					'GROUP_COLOR'		=> $row['group_colour'],

					'U_GROUP'			=> $u_group,

					'USERNAME_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
					'USERNAME'			=> get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
					'USER_COLOR'		=> get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
					'U_VIEW_PROFILE'	=> get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
				));
			}
	         }



Cevapla