Auth edit problems

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
juliekate
Registered User
Posts: 779
Joined: Sun May 05, 2002 5:32 pm
Location: Philadelphia
Contact:

Auth edit problems

Post by juliekate » Sat Mar 12, 2005 7:24 pm

This is driving me {{{{CRAAAZY}}}}

I am trying to add base level authorization to Bandster, in that, when you go to music_band.php and it displays all the registered bands, if you are a band member of one of those bands, you get edit access.

The access works in music_band.php?mode=editband, but I want the "edit" button to show up next to the names in the "all profiles" view here.

It DOES work when logged in with an admin account (global edit).

The code: (see 'EDIT' for the hoochie driving me nuts)

Code: Select all

// Get all Bandster Profiles
		$sql = "SELECT b.band_id, b.name, b.genre, b.location, g.*, m.mem_user_id, m.band_id
		FROM " . MUSIC_BAND_TABLE . " AS b
			LEFT JOIN " . MUSIC_GENRES_TABLE . " AS g on b.genre = g.genre_id
			LEFT JOIN " . MUSIC_MEMBERS_TABLE . " AS m on b.band_id = m.band_id
		GROUP BY b.band_id
		ORDER BY b.name ASC
		LIMIT $limit_sql";
		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not get Bandster Profiles', '', __LINE__, __FILE__, $sql);
		}

		$band_ary = array();
		
		while ( $row = $db->sql_fetchrow($result))
		{
			$band_ary[] = $row;
		}
		for ($i = 0; $i < count($band_ary); $i += $music_config['cols_per_page'])
		{
			$r++;
			$row_class = ( !($r % 2) ) ? $theme['td_class2'] : $theme['td_class1'];
			$band_name = '<a href="music_band.'.$phpEx.'?mode=default&band_id='.$band_ary[$i]['band_id'].'"  class="cattitle" style="text-decoration: none;">'.$band_ary[$i]['name'].'</a>';
			$loc = $band_ary[$i]['location'];
			$gen = $band_ary[$i]['genre_name'];
			$mem_user_id = $band_ary[$i]['mem_user_id'];
			$template->assign_block_vars('bandcol', array());
				
			$template->assign_block_vars('list',array(
				'ROW_CLASS' => $row_class,
				'BAND_NAME' => $band_name,
				'LOC' => $loc,
				'EDIT' => ( ($mem_user_id == $userdata['user_id'] ) || ($userdata['user_level'] == ADMIN) ) ? '[ <a href="'. append_sid("music_band.$phpEx?mode=editband&band_id=". $band_ary[$i]['band_id']) . '">' . $lang['Edit_song'] . '</a> ]' : '',
				'GENRE' => $gen)
				);

		}
the TPL

Code: Select all

<!-- BEGIN list -->
		   <tr> 
			<td  width="30%" class="{list.ROW_CLASS}" valign="top"><span class="gensmall">{list.EDIT}</span> <span class="cattitle">{list.BAND_NAME}</td>
			<td  width="30%" class="{list.ROW_CLASS}" valign="top"><span class="gen">{list.GENRE}</td>
			<td  width="30%" class="{list.ROW_CLASS}" valign="top" align="center"><span class="gen">{list.LOC}</td>
			</tr>
			<!-- END list -->

Post Reply

Return to “[2.0.x] MOD Writers Discussion”