aMember and Simple Machines Forum (SMF) integration

Discussion in 'Integration' started by a2p_zixby, May 16, 2015.

  1. a2p_zixby

    a2p_zixby New Member

    Joined:
    Jan 4, 2015
    Messages:
    5
    My partner and I purchased aMember several months ago in order to update a very old installation of aMember Pro (version 3) and SMF.

    I've already had to contact the support staff a while back regarding issues with the SMF 'display' name not automatically populating with the 'Username". The support staff had to run a purpose built script to swap things around. I really didn't understand things back then, plus our forum and products were pretty dead so we weren't experiencing things 'live'. However, we've just launched our latest product and issues have arisen regarding the same problem. This resulted in me having to manually go through 400 usernames yesterday and correct around 30% of them which were showing their real names. This took me an entire day to complete!

    I've since had another new client signup and his username isn't appearing as the "Latest Member" in the Forum Stats at the bottom of the Home page. Prior to the upgrade, the way to correct this was to use the Rebuild database function in the old version 3. This always fixed the issue but I had to do it every time a new member signed up. I'm extremely reluctant to rebuild the SMF Db now as I believe it will swap every single username with their real name. People create usernames for anonymity purposes. Why on earth would they want to display their real name? Further, SMF users do not have access to the display 'Name' field in order to change it. This can only be done by Admin!

    So let me explain things further. Login to SMF as Admin, proceed to Profile=>Modify Profile=>Account Settings=> and you'll see something like the following:

    Username anonymity
    (change)

    Name James Anonymous
    This is the displayed name that people will see.

    I presume that the above "names" are pulled directly from aMember Pro's Db and populated by the SMF integration plugin.

    What I'm trying to achieve is to ensure that the above forum 'Name' field is always/automatically populated with the actual Username when a new client signs up.

    Can anyone please point me in the right direction?
  2. a2p_zixby

    a2p_zixby New Member

    Joined:
    Jan 4, 2015
    Messages:
    5
    Further research here -http://wiki.simplemachines.org/smf/Main_Page reveals that "After registering at a forum, the display name is usually set to be the same as the username, but you can change this in the sectionProfile > Account Settings." After digging around in the Admin "General Permissions", I found a section "Personalize their Profile" which has the option 'Edit their account settings'.

    So I enabled this and now any member has the ability to change/set their 'Display Name'. This may have been the "blockage" which prevented SMF plugin from setting the Display Name....but I'm not sure.

    Anyhow, I still need to know what will happen once I hit the Rebuild Smf Database button.

    Any ideas?
  3. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    In order to fix this in plugin file, edit /amember/application/default/plugins/protect/smf.php and change these two lines:
    PHP:
                array(Am_Protect_Table::FIELD_NAME'real_name'),
    to
    PHP:
                array(Am_Protect_Table::FIELD_LOGIN'real_name'),
    and
    PHP:
                array(Am_Protect_Table::FIELD_NAME'realName'),
    to
    PHP:
                array(Am_Protect_Table::FIELD_LOGIN'realName'),
    then you can use Rebuild DB. Before that modification if you will execute Rebuild DB, real_name in SMF database will be reset to user's first & last name.
  4. a2p_zixby

    a2p_zixby New Member

    Joined:
    Jan 4, 2015
    Messages:
    5
    Thanks for your response.

    A few things to note:

    A temporary fix was to run a query via phpMyAdmin - UPDATE `smf_members` SET `real_name` = `member_name`.

    My partner and I had already discovered the necessary code to change in those two arrays but were about to change it differently as per the following:

    PHP:
    array(Am_Protect_Table::FIELD_NAME'real_name'),
    to

    PHP:
    array(Am_Protect_Table::FIELD_NAME'member_name'),
    I'm confused about your "from" line of code as it is different to the actual code which includes 'member_name' ? Have you made a typo here?

    Also, the amember "Rebuild Users Database" section has the following three function selections to "rebuild"

    1.Rebuild Core Database - 2.Rebuild Invoice Database - 3.Rebuild Smf Database

    Should I be executing the 1st option or the 3rd one.......or both?

    Cheers
    Last edited: May 26, 2015
  5. a2p_zixby

    a2p_zixby New Member

    Joined:
    Jan 4, 2015
    Messages:
    5
    I was still editing my response when the allowed 30 minutes expired :-( Anyhow, what I was trying to point out in your response was that your suggested code changes would mean that the 'FIELD_LOGIN' code would appear twice ( for both Username and display Name). Wouldn't this create a conflict?
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    No this will not be a conflict. Instructions from my previous message are correct.
    In regards to rebuild use Rebuild DMF database, but please make above modifications first.
    a2p_zixby likes this.
  7. a2p_zixby

    a2p_zixby New Member

    Joined:
    Jan 4, 2015
    Messages:
    5
    Thanks. Changes made and uploaded. Used Rebuild SMF database function with no issues....so I think we're all happy now.

    Just a couple more questions if you don't mind:

    1. We're currently running SMF v2.0.5 and note that the current version is now up to 2.0.10. Are you guys checking periodically to see if your plugin script works with later versions?
    2. The aMember Pro v4.0 documentation refers to the installation folder name as being 'amember'. Our original installation folder for v3.0 was named 'member'. When you guys upgraded the software for us to v4.0, you kept the folder name as 'member'. Just wondering why this was done (preserve existing links) ? Will we encounter any issues down the track as far as automated updates go, due to the old folder name?
  8. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    1. Yes we do this, but not often. aMember has integration with many scripts, so we just unable to test every integration each time when thrid-party script upgrades. In most situations upgrades doesn't affect database structure, so existing plugin should work.
    2. This was done to keep old links working. There should not be any issues with upgrades. Installation folder name really doesn't matter.

Share This Page