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.
Options

How to set the Vanilla ID equal to the ForeignUserKey

Hey, first, the plugin works great! I'm using it to connect to a Drupal installation, and everything is seamless so far. However, I'm having one small issue. I am not allowing any registrations on the forums themselves, all accounts are handled strictly through the Drupal site. For ease of use, I'd like to always set the user ID of the forum account to that of their Drupal user ID. I can't seem to find anything in the way of documentation on it, and was curious if that was something that was handled by jsConnect, or if that was in the core Vanilla systems.

Thanks!

Comments

  • Options
    businessdadbusinessdad Stealth contributor MVP

    With "User ID", do you mean the internal User ID (i.e. the Integer value) or the User Name?

  • Options

    I want to match integer values between Drupal and Vanilla.

  • Options
    businessdadbusinessdad Stealth contributor MVP

    I think it could be technically doable, but I'm afraid that it would be difficult to make it work reliably, as User IDs are auto-increment numbers (that's why they are mapped against ForeignUserKey field). If I User were added by mistake, the whole chain would be messed up.

    Perhaps somebody could come out with an idea of how to do this, but, personally, I would not recommend it.

  • Options

    Well theoretically, a user will never be added besides through the Drupal site, since local forum registration will be disabled. I'm guessing the most reliable/safe way to do it is to just write a module for Drupal that clones the Vanilla account creating process, disable auto-increment, and set it to the newly created Drupal ID (which also auto-increments). Was hoping there would be an easier/cleaner method since I have roughly 60 user accounts already created, but I can port those over by hand if need be.

  • Options
    businessdadbusinessdad Stealth contributor MVP

    In my opinion, "theoretically" is not good enough in the majority of cases. An Admin can always create a User manually, and that would be enough to cause a mess. As per Murphy's law, whether someone would do that or not depends on the amount of mess it would cause.

    To be honest, I would not recommend hacking Vanilla's User registration logic either. Core could change and your modifications could break at any time.

    Probably it's because I don't know the context, but I don't see much of a use in synchronising internal User IDs between Drupal and Vanilla. If you really need it, I would suggest to try adding a DrupalUserID field to User table and populate it via a plugin (although that would not make much of a difference, since you could always retrieve it with a very simple query).

  • Options

    Mostly because the goal is to have a unified Drupal/Vanilla user page. Basically I am trying to integrate all of Vanilla's profile features (post count, badges, signatures, etc) into the Drupal page where I'm going to need to display other things (savable skill trees, a "hangar" for created Mechs that will be saved to the users, etc).

    I mean, overall it isn't hard to work around. I was just trying to be as elegant as possible for future use while working within Vanilla itself, rather than running an end around to grab or edit user data.

  • Options

    Yes your solution isn't the elegant one though. The elegant one is as businessdad stated, to use a separate reference.

    Don't mix up authentication, with user base. You are managing two different sessions, you are just making it look seamless.

    Also the simplest way you could share features like profile is to use api. Force loading a framework over another has its pitfalls.

    grep is your friend.

  • Options
    businessdadbusinessdad Stealth contributor MVP

    @Outreach_News said:
    Mostly because the goal is to have a unified Drupal/Vanilla user page. Basically I am trying to integrate all of Vanilla's profile features (post count, badges, signatures, etc) into the Drupal page where I'm going to need to display other things.

    In such case, you can just use the User Name, instead of an ID, as it's just as unique and matches on both platforms. Using the API plugin, create some endpoints that provide the data you need, and you are sorted.

  • Options
    x00x00 MVP
    edited May 2013

    email is also a common way. Personally I think storting the id is best therefore no issues.

    grep is your friend.

Sign In or Register to comment.