Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Fatal Error when using Social Share

I clicked Share on my discussion in order to share it on Facebook. I am using the Social Share plugin. My forum is Private. When I clicked on the shared discussion link on Facebook using a new Facebook account, I was expecting it to take me to the sign in page and then redirect me to the discussion link, but what actually happened was that it took me to the sign in page and I clicked Login with Facebook (my new account was created at this point) and then instead of directing me to the discussion link, it threw this Fatal error below. When I signed out on my site with the newly created account, and clicked the link again on Facebook, it asked for Sign in and this time it took me to the discussion successfully.

So it appears to me that there is something wrong when you have a Private forum, share a discussion, new user clicks link and registers/login with Facebook.

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Try to disable KarmaBank and see if you get the same error.

  • R_JR_J Ex-Fanboy Munich Admin
    edited June 2016

    Look at "Variables in local scope" in your error message: there is a KarmaBank related SQL and one of the parameters reads "UserID = NULL" which is most likely the reason why it fails.

    You would have to dig down why there is an entry made in table KarmaBankTrans. The type mentioned above is "FacebookShare".
    Without taking a look at the code I see two reasons why it might fail:
    if the discussion author should be rewarded because his link has been clicked, it might fail because UserID is eventually taken from discussionController. When you get redirected to entryController, there is no $discussion to get the user from.

    Or the user is rewarded because he followed a facebook link to your page. And the reward should be inserted before the user id for the new user is available (maybe it is taken from session before it is updated)

    Go and try to find out how the "FacebookShare" KarmaBank reward is expected to work and you will see why it fails. Describe the reason and we try to find a solution.

  • "if the discussion author should be rewarded because his link has been clicked, it might fail because UserID is eventually taken from discussionController. When you get redirected to entryController, there is no $discussion to get the user from."

    It's that. When a discusson author shares a link and someone clicks it, and it's a new user, then they register and the discussion author gets karma points for referral.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    UserID is eventually taken from discussionController.

    No, a controller is only a page with the view that renders the html that one sees.

    When a discusson author shares a link and someone clicks it, and it's a new user, then they register and the discussion author gets karma points for referral.

    But if it is a private community then this sort of thing would generate an error because how can you have a private community and also allow registration and rewards to people that are public using a public type add-on .

    I am not sure the karma add-on supports a private community .

    Sharing between sites is not something conducive to privacy, sharing means no privacy as far as I'm concerned. Controlling who you share with and and what you share can only be done in a closed environment. Because other sites may have their own restrictions and also users may have their own privacy settings. Having single sign on and sharing capabilities is practical if you don't care about privacy.

  • I think this is weird......I just went to my site and used a new Facebook account to try account creation using Facebook Login, but I ran into that exact same error, so I think that error is caused on new account creation through Facebook login, but when I went back then it registered anyway...

  • R_JR_J Ex-Fanboy Munich Admin

    Looking a second time at your error message, and this time more closer, I guess you have fucked it up yourself.

    plugins/Facebook/class.facebook.plugin.php:858 Gdn_SQLDriver->insert()
    plugins/Facebook/class.facebook.plugin.php:834 FaceBookPlugin->trans()
    plugins/Facebook/class.facebook.plugin.php:834 FaceBookPlugin->_AddKarmaPointsOnRegister()
    

    Given that the last relevant line with code in the original facebook plugin is numbered 762, I bet you have added your own code to the plugin. Bad, bad, bad and most probably unneeded.

    Please test again with a clean copy of the plugin. After you have found out that your changes were the reason for the problem, you might ask the real question: "How can I extend KarmaBank so that this&that gets rewarded"


    In the next Vanilla version there are changes in the Facebook plugin. So the next upgrade would have destroyed all your changes anyway.

    If you still feel changing core files is a valid approach to extend Vanilla, please at least warn us before you post error messages.

    Even better: if your problem can not be recreated on a clean Vanilla installation, simply ask for the right approach to achieve what you have implemented in a lazy and obviously wrong way.

    And a last note: posting errors that appear when using a plugin brings miscredit to the plugin author, which is unfair when the reason because it failed is your code.

  • RiverRiver MVP
    edited June 2016

    @R_J said:

    @okhawaja If you still feel changing core files is a valid approach to extend Vanilla, please at least warn us before you post error messages.

    Even better: if your problem can not be recreated on a clean Vanilla installation, simply ask for the right approach to achieve what you have implemented in a lazy and obviously wrong way.

    And a last note: posting errors that appear when using a plugin brings miscredit to the plugin author, which is unfair when the reason because it failed is your code.

    3 Good Suggestions.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.