1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL Trigger Question

Discussion in 'MySQL' started by Webmist, Jan 18, 2015.

  1. #1
    I have a plugin that inserts new users into my Wordpress blog. I also have a MyBB forum community that I want them to be automatically registered in.

    Any plugins and bridges I see aim for syncing the 2 which is not what I want to do as I want the individual security and to keep the functions for each separate. So I was looking at the trigger function within MySQL.

    What I want to do is just insert the new user from Wordpress (user name and email only and password if possible but not necessary) along with any updates to that information into the MyBB table. Then if they desire to use the MyBB they don't have to register again just update their information within the Wordpress.
     
    Solved! View solution.
    Webmist, Jan 18, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Well, all you would need is to copy the new user information into the mybb table. However, expect to have to alter more than one table, as I'm assuming that mybb has a bit of security and diversified storage inside the db (access, roles etc). Pretty simple to do a trigger on the wp table and when a new user is registered the information is copied over.
    Password is a bit trickier, as the probably don't use the same hashing, hence you can't simply copy the hash.
     
    PoPSiCLe, Jan 18, 2015 IP
  3. Webmist

    Webmist Active Member

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #3
    Thanks that was what I am thinking looking at the trigger portion. They are in the same database with different prefixes so didn't know if triggers would work correctly. The password isn't no big deal. I'm using Wordpress as a learning tool/tutorials with a student user base. While MyBB is more for the know it alls lol as more a showcase/interactive forum. Which is why I am not really concerned with the password part at this time. Students can use a generic email assigned at this point, but if they post/reply on the forum portion they have to update to a real email to use it.
     
    Webmist, Jan 18, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Then the point becomes a little moot, doesn't it? If there is no real connection between the two (same email / password, login to both at the same time), then re-registering isn't really that big a deal. I would suggest, if you really want to do a joint login / avoid double registering, to use a joint login - ie, if you redo the code a bit, it should be possible to use the MyBB-forum logins to also login to WP, or vice versa. But that would involve a recoding of the session-management and logins.
    It's been a while, but I did something similar once for a hand-coded site, which wanted to implement a forum (we used phpBB) - what we did was we used the phpBB-forum database (it has access-levels, roles etc.) and then we coded a login based on that, and gave access to specific parts of the site based on the roles and access-levels given in the phpBB-forum. A bit more work, but it might be a better solution in the long run. Just a thought.
     
    PoPSiCLe, Jan 19, 2015 IP
  5. Webmist

    Webmist Active Member

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #5
    The problem I am encountering though is that I'm using a WP plugin to have users register. I had thought about modifying the plugin to just insert the email and username into MyBB. Then though I would have to update it every time the plugin was updated.
     
    Webmist, Jan 19, 2015 IP
  6. #6
    That you might, however, depending on how the plugin is coded, you might be able to override it with your own function-call in functions.php (read up on how to override existing functionality in WP). That might be an easier way to do it.
     
    PoPSiCLe, Jan 19, 2015 IP