Dragonsys
10-11-2015, 07:33 PM
I cannot seem to get the below conditional to work to save my life. I believe everything is correct, but I don't know what else to check.
<vb:if condition="$show['dso_slips_delete_own'] && $userinfo['userid'] == $bbuserinfo['userid']">
if I remove the userid part, it works as expected, but I want to make sure that the user viewing the page is the one who owns the data, so that only they ca edit it.
entire template:
<div id="view-dso_slips" class="<vb:if condition="$selected_tab == 'dso_slips'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>">
<div class="blockbody">
<table id="dso_slips_table" width="100%">
<tr class="columnsort">
<th class="blocksubhead"> </th>
<th class="blocksubhead">Date - Time</th>
<th class="blocksubhead">Vehicle</th>
<th class="blocksubhead">Track</th>
<th class="blocksubhead">R/T</th>
<th class="blocksubhead">60'</th>
<th class="blocksubhead">330'</th>
<th class="blocksubhead">1/8 Mile</th>
<th class="blocksubhead">1000'</th>
<th class="blocksubhead">1/4 Mile</th>
</tr>
<vb:each from="queue" value="queuelist"><tr>
<td><a href="./slips.php?do=viewslip&id={vb:raw queuelist.id}" title="View Details"><i class="fa fa-search"></i></a><vb:if condition="$show['dso_slips_edit']"> <a href="./slips.php?do=editslip&id={vb:raw queuelist.id}" title="Edit Slip"><i class="fa fa-pencil-square-o"></i></a></vb:if><vb:if condition="$show['dso_slips_delete_own'] && $userinfo['userid'] == $bbuserinfo['userid']"> <a href="./slips.php?do=delslip&id={vb:raw queuelist.id}" title="Delete Slip"><i class="fa fa-eraser"></i></a></vb:if></td>
<td>{vb:raw queuelist.date}</td>
<td><a href="./vbrides.php?do=viewride&rideid={vb:raw queuelist.car_id}" title="View Vehicle Page">{vb:raw queuelist.car_name}</a></td>
<td><a href="{vb:raw queuelist.track_www}" title="Visit the {vb:raw queuelist.track} Website">{vb:raw queuelist.track}</a></td>
<td>{vb:raw queuelist.rt}</td>
<td>{vb:raw queuelist.60ft}</td>
<td>{vb:raw queuelist.330ft}</td>
<td>{vb:raw queuelist.8et}</td>
<td>{vb:raw queuelist.1000ft}</td>
<td>{vb:raw queuelist.4et}</td>
</tr></vb:each>
</table>
</div>
</div>
plugin:
if ($show['dso_slips_view']) {
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "Timeslips";
$blockid = "dso_slips";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=dso_slips#dso_slips";
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_last'] .= $templater->render();
require_once('./includes/functions_dso_slips.php');
$slipsqueue = $db->query_read("SELECT ID,Car_ID,Date,Track,RT,Sixty,ThreeThirty,Eighth_E T,Eighth_MPH,Thousand,Fourth_ET,Fourth_MPH FROM ".TABLE_PREFIX."dso_slips WHERE Owner = ".$userinfo['userid']." ORDER BY Date DESC");
while ($row = $db->fetch_array($slipsqueue)) {
if (isset($row['Eighth_ET']) AND isset($row['Eighth_MPH'])) { $row['Eighth_ET'] = number_format($row['Eighth_ET'],3,'.',',')." @ ".number_format($row['Eighth_MPH'],2,'.',',')." mph"; }
if (isset($row['Fourth_ET']) AND isset($row['Fourth_MPH'])) { $row['Fourth_ET'] = number_format($row['Fourth_ET'],3,'.',',')." @ ".number_format($row['Fourth_MPH'],2,'.',',')." mph"; }
$queue[] = array (
'id' => $row['ID'],
'car_id' => $row['Car_ID'],
'car_name' => getVehicleName($row['Car_ID']),
'date' => date("M d, Y - g:i a ",strtotime($row['Date'])),
'track' => getTrackName($row['Track']),
'track_www' => getTrackWeb($row['Track']),
'rt' => number_format($row['RT'],3,'.',','),
'60ft' => number_format($row['Sixty'],3,'.',','),
'330ft' => number_format($row['ThreeThirty'],3,'.',','),
'8et' => $row['Eighth_ET'],
'1000ft' => number_format($row['Thousand'],3,'.',','),
'4et' => $row['Fourth_ET']
);
}
$templater = vB_Template::create('dso_slips_profile_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('queue', $queue);
$template_hook['profile_tabs'] .= $templater->render();
}
<vb:if condition="$show['dso_slips_delete_own'] && $userinfo['userid'] == $bbuserinfo['userid']">
if I remove the userid part, it works as expected, but I want to make sure that the user viewing the page is the one who owns the data, so that only they ca edit it.
entire template:
<div id="view-dso_slips" class="<vb:if condition="$selected_tab == 'dso_slips'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>">
<div class="blockbody">
<table id="dso_slips_table" width="100%">
<tr class="columnsort">
<th class="blocksubhead"> </th>
<th class="blocksubhead">Date - Time</th>
<th class="blocksubhead">Vehicle</th>
<th class="blocksubhead">Track</th>
<th class="blocksubhead">R/T</th>
<th class="blocksubhead">60'</th>
<th class="blocksubhead">330'</th>
<th class="blocksubhead">1/8 Mile</th>
<th class="blocksubhead">1000'</th>
<th class="blocksubhead">1/4 Mile</th>
</tr>
<vb:each from="queue" value="queuelist"><tr>
<td><a href="./slips.php?do=viewslip&id={vb:raw queuelist.id}" title="View Details"><i class="fa fa-search"></i></a><vb:if condition="$show['dso_slips_edit']"> <a href="./slips.php?do=editslip&id={vb:raw queuelist.id}" title="Edit Slip"><i class="fa fa-pencil-square-o"></i></a></vb:if><vb:if condition="$show['dso_slips_delete_own'] && $userinfo['userid'] == $bbuserinfo['userid']"> <a href="./slips.php?do=delslip&id={vb:raw queuelist.id}" title="Delete Slip"><i class="fa fa-eraser"></i></a></vb:if></td>
<td>{vb:raw queuelist.date}</td>
<td><a href="./vbrides.php?do=viewride&rideid={vb:raw queuelist.car_id}" title="View Vehicle Page">{vb:raw queuelist.car_name}</a></td>
<td><a href="{vb:raw queuelist.track_www}" title="Visit the {vb:raw queuelist.track} Website">{vb:raw queuelist.track}</a></td>
<td>{vb:raw queuelist.rt}</td>
<td>{vb:raw queuelist.60ft}</td>
<td>{vb:raw queuelist.330ft}</td>
<td>{vb:raw queuelist.8et}</td>
<td>{vb:raw queuelist.1000ft}</td>
<td>{vb:raw queuelist.4et}</td>
</tr></vb:each>
</table>
</div>
</div>
plugin:
if ($show['dso_slips_view']) {
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "Timeslips";
$blockid = "dso_slips";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=dso_slips#dso_slips";
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_last'] .= $templater->render();
require_once('./includes/functions_dso_slips.php');
$slipsqueue = $db->query_read("SELECT ID,Car_ID,Date,Track,RT,Sixty,ThreeThirty,Eighth_E T,Eighth_MPH,Thousand,Fourth_ET,Fourth_MPH FROM ".TABLE_PREFIX."dso_slips WHERE Owner = ".$userinfo['userid']." ORDER BY Date DESC");
while ($row = $db->fetch_array($slipsqueue)) {
if (isset($row['Eighth_ET']) AND isset($row['Eighth_MPH'])) { $row['Eighth_ET'] = number_format($row['Eighth_ET'],3,'.',',')." @ ".number_format($row['Eighth_MPH'],2,'.',',')." mph"; }
if (isset($row['Fourth_ET']) AND isset($row['Fourth_MPH'])) { $row['Fourth_ET'] = number_format($row['Fourth_ET'],3,'.',',')." @ ".number_format($row['Fourth_MPH'],2,'.',',')." mph"; }
$queue[] = array (
'id' => $row['ID'],
'car_id' => $row['Car_ID'],
'car_name' => getVehicleName($row['Car_ID']),
'date' => date("M d, Y - g:i a ",strtotime($row['Date'])),
'track' => getTrackName($row['Track']),
'track_www' => getTrackWeb($row['Track']),
'rt' => number_format($row['RT'],3,'.',','),
'60ft' => number_format($row['Sixty'],3,'.',','),
'330ft' => number_format($row['ThreeThirty'],3,'.',','),
'8et' => $row['Eighth_ET'],
'1000ft' => number_format($row['Thousand'],3,'.',','),
'4et' => $row['Fourth_ET']
);
}
$templater = vB_Template::create('dso_slips_profile_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('queue', $queue);
$template_hook['profile_tabs'] .= $templater->render();
}