The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Hide links to users - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10) +--- Thread: Hide links to users (/showthread.php?tid=688) |
Hide links to users - dormido - 08-25-2017 I'm using <pre> Code: <? Php if (checkMenu (2, $ user-> data () -> id)) {?> But that breaks some things on my site with Code: Notice: Undefined property: stdClass:: Hide links to users - karsen - 08-25-2017 The stdClass error often occurs when you try to use a class property that doesn't exist. Change your code to the following and see if you still get errors: Code: <?php if (isset($user->data()->id) && checkMenu(2, $user->data()->id)) { ?> <! - <a href="#"> Link </a> -> <?php } ?> Hide links to users - dormido - 08-25-2017 I'm having the same problem. When I remove this fragment it is solved but if I add it it breaks. Thank you anyway. Hide links to users - mudmin - 08-25-2017 Try this... Code: if($user->isLoggedIn() && hasPerm([2],$user->data()->id)){ checkMenu only allows you to put one permission level. hasPerm allows you to put a bunch [2,3,4]. Hide links to users - dormido - 08-26-2017 I tried to try the blog of this link https://userspice.com/forums/topic/sistem-news/ that brandin wrote but I found that problem, anyway thank you. Hide links to users - mudmin - 08-26-2017 So is everything working? Hide links to users - dormido - 08-26-2017 Everything is broken with this line Code: if (clickMenu (2, $ user-> data () -> id)) { Code: Notice: Undefined property: stdClass :: Code: if (clickMenu (2, $ user-> data () -> id)) { Hide links to users - dormido - 08-26-2017 If you enter usersc/blog.php as a visitor works great. But if logged in as admin to usersc/blog.php I get a Code: Notice: Undefined property: stdClass :: Hide links to users - mudmin - 08-26-2017 It shouldn't be clickmenu, it should be this hasPerm Code: if($user->isLoggedIn() && hasPerm([2],$user->data()->id)){ Also, since you're in usersc, your link to the init file needs to be Code: <?php require_once '../users/init.php'; ?> Don't get frustrated...we will fix this! If that doesn't work, can you paste your entire usersc/blog.php file on pastebin.com and share the link in this forum post? Hide links to users - dormido - 08-26-2017 This https://hastebin.com/iyesacoweb.xml is blog.php and this https://hastebin.com/vayazuzuwu.sql is the taba. |