PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.9
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.9
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
gamipress / includes / compatibility / 1.8.0.php

1.8.0.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.9, at includes/compatibility/1.8.0.php

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GamiPress 1.8.0 compatibility functions
4 *
5 * @package GamiPress\1.8.0
6 * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]>
7 * @since 1.8.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Returns array of achievement types a user has earned across a multisite network
14 *
15 * @deprecated Deprecated since is an unused function
16 *
17 * @since 1.0.0
18 * @param integer $user_id The user's ID
19 * @return array An array of post types
20 */
21 function gamipress_get_network_achievement_types_for_user( $user_id ) {
22
23 $blog_id = get_current_blog_id();
24
25 // Assume we have no achievement types
26 $all_achievement_types = array();
27
28 // Loop through all active sites
29 $sites = gamipress_get_network_site_ids();
30
31 foreach( $sites as $site_blog_id ) {
32
33 // If we're polling a different blog, switch to it
34 if ( $blog_id != $site_blog_id ) {
35 switch_to_blog( $site_blog_id );
36 }
37
38 // Merge earned achievements to our achievement type array
39 $achievement_types = gamipress_get_user_earned_achievement_types( $user_id );
40
41 if ( is_array( $achievement_types ) ) {
42 $all_achievement_types = array_merge( $achievement_types, $all_achievement_types );
43 }
44
45 // If switched to blog, return back to que current blog
46 if ( $blog_id != $site_blog_id && is_multisite() ) {
47 restore_current_blog();
48 }
49 }
50
51 // Restore the original blog so the sky doesn't fall
52 if ( $blog_id != get_current_blog_id() && is_multisite() ) {
53 restore_current_blog();
54 }
55
56 // Pare down achievement type list so we return no duplicates
57 $achievement_types = array_unique( $all_achievement_types );
58
59 // Return all found achievements
60 return $achievement_types;
61
62 }