Xenforo Integration
DAP integrates with Xenforo, vBulletin, and several other free WP plugins like BBPress, SimplePress, Buddypress, Mingle etc.
The integration with free WP forum plugins is not at product/member level but you can set up DAP to ONLY allow registered or paid members to POST to the forums.
But if you use paid plugins like Xenforo and VBulletin, you can control access at membership level. You can restrict forum access based on user’s membership level in DAP.
There was just 1 limitation with the DAP=>Xenforo integration and that was with Automatic Login’. But we have eliminated that limitation in DAP 4.7.
If you are on older version of DAP (DAP 4.6.2 or below), then DAP cannot auto-login the users to the forum when they login to DAP.
But if you upgrade to DAP 4.7 (or above), DAP can not only control forum access at membership level but DAP can also autologin users to the forum when they login to DAP.
Here’s the steps to setup the integration :
STEP 1:
Install Xenforo forum.
Say it is installed under http://YOURSITE.com/community
STEP 2:
Follow these instructions to integrate Xenforo ONLY if you are on DAP 4.7 or above.
1. FTP to your site. You will find a file called api.php under /dap/plugins/dap_xenapi folder.
Upload the api.php file to your forums folder. If you installed forum under /community, then upload api.php to that folder.
2. Generate a hash by using an online service, like http://www.miraclesalad.com/webtools/md5.php
3. Set an API key for XenAPI, this can be done by editing the `api.php` file and replacing the `API_KEY` string with the hash generated in step 2.
$options = array(‘api_key’ => ‘set this to the hash generated in step 2 above’);
Follow these instructions to integrate Xenforo ONLY if you are on DAP 4.6.2 or below (SKIP 1-6 below if you are on DAP 4.7 or above).
1. Download XenAPI for Xenforo from the GitHub repository:
https://github.com/Contex/XenAPI/archive/master.zip
2. Open the downloaded ZIP archive and extract the contents of the zip file to your desktop.
3. Upload `/XenAPI-master/net/xenapi/XenAPI/api.php` to the root directory of your XenForo installation. So if the installation is under /forum folder, upload api.php to the forum folder.
4. Generate a hash by using an online service, like http://www.miraclesalad.com/webtools/md5.php
5. Set an API key for XenAPI, this can be done by editing the `api.php` file and replacing the `API_KEY` string with
the hash generated in step 4.
$options = array(‘api_key’ => ‘set this to the hash generated in step 4 above’);
6. Upload `/XenAPI-master/net/xenapi/XenAPI/examples/dap/plugins/dap_xenapi/dap_xenapi.class.php` to
`/dap/plugins/dap_xenapi/` of your DAP installation.
STEP 3:
1. a. Login to your XenForo Admin panel and go to user groups, `Users -> User Groups -> List User Groups`.
1. b. Find the group you wish the user to be assigned to when they register.
21 c. Note the ID of the group, we’ll use it later, `admin.php?user-groups/example-group.6/edit`, 6 is the group ID.
2. We now need to create the string that is going to be sent to DAP XenForo Plugin.
Here’s the the string that is sent to DAP XenForo Plugin:
dap_xenapi:API_KEY:PROTOCOL:API_LOCATION:GROUP_ID
a. `API_KEY` should be replaced with the md5 hash you generated in STEP 2.
Example API_KEY: a5b2b1f2mc1mas2f3
b. `PROTOCOL` should be replaced with which protocol you wish to use, current options are only `http` and `https`.
Please note that if you use `http`, the password of the user will be sent over a unecrypted protocol.
Example PROTOCOL: https
c. `API_LOCATION` should be replaced with the location of XenAPI’s file, `api.php`, which you should now have in the
root directory of your XenForo installation. Make sure you do NOT include the `http` of the URL.
Example API_LOCATION: YOURSITE.com/forum/api.php
d. `GROUP_ID` should be replaced with the group ID you wish the user to be assigned to when they are added to a product in dap, this is the group ID you
found in step 7.
If you wish not to assign the user to a group, you can remove this parameter or set it to `0`.
Example GROUP_ID: 6
Example GRPOU_ID: 0
Example:
a. Register the user AND assign the user to a specific group: `dap_xenapi:a5b2b1f2mc1mas2f3:https:example.com/forum/api.php:6`.
b. Register the user AND assign the user to a specific group AND use a custom field identifier: `dap_xenapi:a5b2b1f2mc1mas2f3:https:example.com/forum/api.php:6:unique_user`.
3. Open your DAP admin dashboard and go to Products/Levels -> Manage page.
4. Find the product you wish to integrate XenForo with, click on the `Notifications` tab.
5. Add the string you created in step 8 to the `Plugin Notification upon User “Add”`
and `Plugin Notification upon User “Add”` fields.
PLEASE NOTE: The only part that will change from product to product is the ‘group id’ (the last field).
The group id is the id of the usergroup in the forum that the user should get access to when they signup for a dap product.
If you create your own usergroup in xenforo, you can set the usergroup id of that in the group id field.
Now when a user registers to a product in dap, they will automatically be added to the specified usergroup id and thus will have the same ‘permission’ to the forum that the specified usergroup id is set to have.
Each product in dap can be configured to add the user to a different usergroup in forum if you want each product/level to have different forum permission.
STEP 4:
FTP to your site, find dap-config.php file under the dap folder, edit it and add this to your /dap/dap-config.php file.
Add it towards the top after php start tag (<?php) :
define(‘XENFOROFORUMPATH’, ‘/home/crespond/yoursite.com/community’); // path to your Xenforo forum
VERY IMPORTANT: Remove all occurrences of backticks (`
) in the line above and replace it with single or double quote.
NOTE:
If you want to find the path to the Xenforo forum on your site, you can visit this page: http://yoursite.com/dap/getpath.php in a browser. It will give you the path to the “dap” folder on your site. Just remove the /dap from the end of the path and instead append /community (or whatever is the name of your forums folder) to it.
Now upload dap-config.php file back to the dap folder on your site.
STEP 5:
Testing:
1) Add a user to the product integrated with xenforo using the dap admin -> add users page.
2) Login to your xenforo admin dashboard on your site and you can search for this new user and find the user in xenforo
Please Note:
Current integration limitation with xenforo is that if a user logs in to dap, they will not be auto-logged in to xenforo.
You can send the users their xenforo login in the welcome email. They can login to xenforo using their dap email id and dap password.
But if they change their dap account password, it will not get sync’d to Xenforo.
Users can change the xenforo password directly in xenforo if they want it to match dap password Or they can continue to use their old password to login to xenforo.
This is a limitation for now but we will address it in a few months from now.