Overview

Introduction

If you use MemberMouse for your WordPress membership website, wpForo can be a great solution if you want to have a forum for your members.

The integration of MemberMouse and wpForo is pretty straightforward.

These two plugins use some of WordPress database data and therefore the integration comes naturally.

But even so, some changes are needed in order to have a full integration.

Video Tutorial

php

  if(!isset($_GET["member_id"]) || empty($_GET["member_id"]))
  {
  exit;
  }

// wp core functionality
  $absPath = dirname(__FILE__);
  $realPath = realpath($absPath . '/./');
  $fPath = explode("wp-content",$realPath);
  define('WP_USE_THEMES', false);
  require(''.$fPath[0].'/wp-blog-header.php');

// get member ID
  $memberId = $_GET["member_id"];

global $wpdb;

// get user nicename
  $user_nicename = $wpdb->get_var("SELECT user_nicename FROM wp_users WHERE ID = '$memberId'");

// if first name and last name are updated from MM account, they are only updated in MM member data table; we need to update them in wp foro too
  $user_first_name = $wpdb->get_var("SELECT first_name FROM mm_user_data WHERE wp_user_id = '$memberId'");
  $user_last_name = $wpdb->get_var("SELECT last_name FROM mm_user_data WHERE wp_user_id = '$memberId'");

//prepare display name for wp foro
  $user_display_name = $user_first_name.' '.$user_last_name;

echo $user_display_name;

// get serialized data from wp_usermeta table where the nicename it's not updated
  $wpf_member_obj = $wpdb->get_var("SELECT meta_value FROM wp_usermeta WHERE user_id = '$memberId' AND meta_key = '_wpf_member_obj'");

$wpf_member_obj = unserialize($wpf_member_obj);

var_dump($wpf_member_obj);

// update all values in unserialized 
  $wpf_member_obj["user_nicename"] =$user_nicename;

// serialize data and update it in the database
  $wpf_member_obj = serialize($wpf_member_obj);

$wpdb->update( 
  'wp_usermeta', 
  array( 
  'meta_value' => $wpf_member_obj 
  ), 
  array( 'user_id' => $memberId,'meta_key' => '_wpf_member_obj' ), 
  array( 
  '%s'
  ), 
  array( '%d','%s'  ) 
  );

// change the display name in wp_users , if it was changed in MM

$wpdb->update( 
  'wp_users', 
  array( 
  'display_name' => $user_display_name 
  ), 
  array( 'ID' => $memberId ), 
  array( 
  '%s'
  ), 
  array( '%d'  ) 
  );

The above code updates wpForo profile display name and profile links for the member.

It will be triggered by a MemberMouse Push Notification as I will explain below.

b. Then add the file to your theme folder (https://yourdomain.com/wp-content/themes/your-child-theme-folder).

Obviously your child theme folder directory probably won’t be named “your-child-theme-folder”. 🙂

IMPORTANT: I highly recommend that you first create a child theme, or use the My Custom Functions WordPress plugin whenever you add custom code to your theme files. Otherwise, any time you update your theme your changes will get wiped out!

Step 2 – Create a MemberMouse Push Notification

After the PHP file is created and uploaded to FTP, we will need a way to TRIGGER the code right after the user account details are updated.

And for this we will create a MemberMouse Push Notification.

a. Log in your WordPress dashboard and go to MemberMouse > Developer Tools.

membermouse push notification - How to integrate MemberMouse with wpForo

b. Click on “Create Push Notification” green button and add the below settings:

mm push notification - How to integrate MemberMouse with wpForo

c. The URL to your custom script will be:

https://yourdomain.com/wp-content/themes/your-child-theme-folder/change-mm-username-update-nicename.php.

d. Click on “Save Push Notification” and… that is all! Now you have a full integration of MemberMouse with wpForo.

e. Want our team to do this integration for you?

No problem, just visit our MemberFix product information page and sign up or get in touch for a call!

 

What do you think of this article?

Article Title: How to integrate MemberMouse with wpForo

Short Description: Learn how to fully integrate MemberMouse with wpForo.

Publisher Logo: mermberfix logo x200 1 - How to integrate MemberMouse with wpForo

Sending

User Review

5 (1 vote)

 

Share This