Manaus Posted February 12, 2014 Posted February 12, 2014 Hello, I have a form submitting some values, but I get a strange behaviour. Just after submitting, I cannot see the delete button. It's visibile when loading the page normally though (GET, !POST). echo $user." ".$l->createdUser; // always matches if ($user->isSuperuser() or $user === $l->createdUser) { echo "<a href='{$_root}delete-item/?proj=$page->id&item=$l->id'>Delete</a>"; // sometimes visibile, sometimes not } These are my attempts echo (int) $user == $l->createdUser; // always true, even if values don't match echo (int) $user == (int) $l->createdUser; // always true, even if values don't match echo (int) $user === (int) $l->createdUser; // always true, even if values don't match echo (int) $user->id === (int) $l->createdUser; // never true echo $user == $l->createdUser; // usually works correctly, but not just after $user posted something echo $user === $l->createdUser; // same as previous Thanks for any suggestion
horst Posted February 12, 2014 Posted February 12, 2014 (edited) what's about: echo (int) $user->id === (int) $l->createdUser->id; ?? EDIT: deleted first content because have read the lowercase char "L" as a number one (1). Edited February 12, 2014 by horst 1
Manaus Posted February 12, 2014 Author Posted February 12, 2014 Thanks Horst, looks like one, but it's actually L.. 2
Soma Posted February 12, 2014 Posted February 12, 2014 Maybe turn on debug mode... ... (int) $user ... "Notice: Object of class User could not be converted to int" I'm not sure about the context where you say it doesn't work but these works always $user === $page->createdUser (if same object) $user->id == $page->createdUser->id (if same id) 1
Manaus Posted February 12, 2014 Author Posted February 12, 2014 Thanks Horst and Soma, now working!!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now