Good question, I’m hoping to find a answer on this to… I’m using multisite subdomain setup voor a 1500+ blogs setup and would love to enable cubepoints on it.
I am using version 3.1 of Cubepoints. By investigating the code and the database I can see there is only one wp_cp database. It is true, the options are different for each site but it seems that the points system is unique, meaning that if one user earns point into a site, he will have the points into any site.
Of course, this leaves a way for cheating, some site owners could trick the system to make points to use elswhere.
A simple solution I think of is to hardcode the points options by editing the code, then to make configuration and managememnt panels read-only.
@rvencu
Cubepoints will be unique for each site in multisite installation. If a user earn 120 points site1.example.com then its applicable only for site1.example.com.
If you want network wide points, then my suggestion will be use main site to store points instead of using individual sites database.
So for short, I did this:
in cp_admin_manage.php
I changed the code like this:
function cp_admin_manage() {
global $blog_id; //add this line here
…
then:
<form method="post" name="cp_manage_form_<?php echo $result->ID; ?>" id="cp_manage_form_<?php echo $result->ID; ?>">
<input type="hidden" name="cp_manage_form_id" value="<?php echo $result->ID; ?>" />
<input
<?php if (is_multisite() && $blog_id > 1) echo " disabled='disabled'"; ?>
type="text" name="cp_manage_form_points" value="<?php echo cp_getPoints($result->ID); ?>" />
<input
<?php if (is_multisite() && $blog_id > 1) echo " disabled='disabled'"; ?>
type="submit" value="<?php _e('Update', 'cp'); ?>" />
<img src="<?php echo WP_PLUGIN_URL.'/'.str_replace(basename(__FILE__),"",plugin_basename(__FILE__)). 'assets/load.gif'; ?>" style="display: none;" />
</form>
And in cp_admin_config.php I did similar changes:
if (get_option('cp_mypoints')) {
$cp_mypoints_checked = " checked='checked'";
} else {
$cp_mypoints_checked = "";
}
global $blog_id; //add this line here
and
[Code moderated as per the Forum Rules. Please use the pastebin]
Actually if I give points to users the points are updated to all sites. This behavior is by default.
Now I changed my hack above and I did this instead: with a clean Cubepoints plugin installation, I added this code to my theme’s functions.php
:
http://pastebin.com/aEEYF3zS
I am still testing to see if a site administrator that is not superadmin can see the Cubepoints menu in dashboard
I still can see the menus as local admin only. Will find better code to remove the menus.
Well, my solution now is this one:
Use this code in functions.php from theme’s folder in order to copy all the options to all existing blogs (such as the changes can be made in any site dashboard by super-admins)
http://pastebin.com/KrxTHyXk
Then use this plugin http://wordpress.org/extend/plugins/admin-menu-editor/ to control who has access to the Cubepoints menu. In fact the Required capability should be set to manage_network for the top menu and all submenus alike, only in that case the Cubepoint menu will dissapear.
As a note, the logs submenu can be let alone, so site admins can see them with no harm.
Thanks, good to know. I didnțt got so far yet…
Code is messy in this page.
http://cubepoints.com/forums/topic/cubepoints-wordpress-mu-buddypress/
It took half an hour to format the code.
You can find the pastebin version here.
cp_hooks.php
http://pastebin.com/kwigk59Z
cp_core.php
http://pastebin.com/iyXL4MU2
cp_install.php
http://pastebin.com/3q9dS9b2
Please note:
I’m not sure what this line is (cp_hooks.php)
echo __(‘Post on’, ‘cp’) . ‘ “guid.’”>’ . $post->post_title . ‘“‘;
So my cp_hooks.php contains different code for the above line i mentioned.
Hope it will help someone.
One more thing.
I activated “My points” module. Cubepoints -> My points I see errors in permalinks. (subdomain multisite installation).
Also i see duplicate logs in the same page. Can someone fix it?
Exactly what i was looking for!!!
Thanks Yani for actual edit and Viruthagiri!!!
I’m also wondering how to add group id and store forum id, comment id as meta (if thats possible i dont know) or just store group id in which the forum, topic or reply is created!!!
I just need this so i can filter group based top users!!! I know this is not for Cubepoints bp but just wondering if i can get some help!!!
Thanks in advance!