Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

User Filters add-on produces error

MavMav
edited July 2006 in Vanilla 1.0 Help
On the account page, I get this error on top: Notice: Undefined variable: AccountUserID in /var/www/html/vanilla/extensions/userfilters/default.php on line 24 Also, it does create the links, but it's labeled "'s Activity" instead of "Username's Activity". I don't think the links are good either, it's searching with: "vanilla/search/?PostBackAction=Search&Type=Discussions&Advanced=1&Keywords=&Categories=&AuthUsername=&btnSubmit=Search" for discussions, and: "vanilla/search/?PostBackAction=Search&Keywords=:&Type=Comments&btnSubmit=Search" for comments. Anyone else had this problem or knows how to fix this?

Comments

  • edited July 2006
    you can try adding before line 23$AccountUserID = ForceIncomingString('u', '');or
    $AccountUserID = ForceIncomingString('u', $Context->Session->UserID);
  • That didn't quite work but it pointed me to the right direction. I found something similar in another add-on, IpHistory:

    // Don't reload objects if you don't need to (ie. If another extension has already loaded it) if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID);

    I just put that in there instead, and it worked. :) Thanks.
  • So given I'm not getting this error please confirm before I make this edit to 1.0.1. You added the string above before line 23 (below). It doesn't replace it, right?

    //Define the account that is being viewed $UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager'); $AccountUser = $UserManager->GetUserById($AccountUserID);
  • edited July 2006
    I think you have to replace //Define the account that is being viewed $UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager'); $AccountUser = $UserManager->GetUserById($AccountUserID);
    by//Define the account that is being viewed // Don't reload objects if you don't need to (ie. If another extension has already loaded it) if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID); $AccountUser = $UserManager->GetUserById($AccountUserID);
  • I just added the lines of code suggested by Mav before your //Define the account code and it worked (for me). I didn't replace anything.
  • Dinoboff - makes sense, I've uploaded 1.0.2 with your suggestion.
  • I only added it above line 23, I didn't replace anything. But what Dinoboff said is correct. I just forgot to remove the original "$UserManager =..." line.
This discussion has been closed.