![]() |
Help with conditional
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.
Code:
<vb:if condition="$show['dso_slips_delete_own'] && $userinfo['userid'] == $bbuserinfo['userid']"> entire template: Code:
<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>"> Code:
if ($show['dso_slips_view']) { |
Try replacing $userinfo['userid'] with $vbulletin->userinfo['userid'] and see what happens.
|
tried that to no affect
--------------- Added [DATE]1444605891[/DATE] at [TIME]1444605891[/TIME] --------------- well not no affect, it actually makes the conditional always true. without the vbulletin-> the conditional is always false. |
Instead of adding the authorization check in the template, I would just move it to the script itself and redirect the user if they are not the owner. I always handle all my logic in scripts, not in the template/view.
That way it's also ten times easier to debug your code and variables. |
If your plugin hook is "member_complete" then try using $prepared['userid'] instead of $bbuserinfo['userid'].
--------------- Added [DATE]1444606104[/DATE] at [TIME]1444606104[/TIME] --------------- Quote:
|
I tried moving it to the php code, and I end up with the same result. It is either always true, or always false. I like ti better in the php, as you stated, so I will leave it this way, but still can't get it to work right.
I tried $prepared['userid'] and still the same. --------------- Added [DATE]1444607425[/DATE] at [TIME]1444607425[/TIME] --------------- here is the updated php code: Code:
if ($show['dso_slips_view']) { Code:
if ($show['dso_slips_delete_own'] && $userinfo['userid'] == $prepared['userid']) { $dso_slip_delete_own_link = 'true'; } else { $dso_slip_delete_own_link = 'false'; } If I change it to bbuserinfo (instead of prepared) then it is always false (but should be true when viewing my profile) EDIT: Finally got it, thank you for the help. When I added vbulletin-> to userinfo and used prepared instead of bbuserinfo it works. |
Sorry, I should have been more clear. I meant for you to try:
$vbulletin->userinfo['userid'] == $prepared['userid'] |
Quote:
Thanks again |
All times are GMT. The time now is 10:26 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|