PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.9.7
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.9.7
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.6.5.php

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

59 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GamiPress 1.6.5 compatibility functions
4 *
5 * @package GamiPress\1.6.5
6 * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]>
7 * @since 1.6.5
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Save extra user meta fields to the Edit Profile screen
14 *
15 * @deprecated User fields are saved through ajax
16 *
17 * @since 1.0.0
18 *
19 * @param int $user_id User ID being saved
20 *
21 * @return mixed false if current user can not edit users, void if can
22 */
23 function gamipress_save_user_profile_fields( $user_id = 0 ) {
24
25 if ( ! current_user_can( 'edit_user', $user_id ) ) {
26 return false;
27 }
28
29 // Update user's rank, but only if edited
30 if ( isset( $_POST['user_rank'] ) && absint( $_POST['user_rank'] ) !== gamipress_get_user_rank_id( $user_id ) ) {
31 gamipress_update_user_rank( $user_id, absint( $_POST['user_rank'] ), get_current_user_id() );
32 }
33
34 $rank_types = gamipress_get_rank_types();
35
36 foreach( $rank_types as $rank_type => $data ) {
37 // Update each user's rank type, but only if edited
38 if ( isset( $_POST['user_' . $rank_type . '_rank'] ) && absint( $_POST['user_' . $rank_type . '_rank'] ) !== gamipress_get_user_rank_id( $user_id, $rank_type ) ) {
39 gamipress_update_user_rank( $user_id, absint( $_POST['user_' . $rank_type . '_rank'] ), get_current_user_id() );
40 }
41 }
42
43 // Update our user's points total, but only if edited
44 if ( isset( $_POST['user_points'] ) && absint( $_POST['user_points'] ) !== gamipress_get_user_points( $user_id ) ) {
45 gamipress_update_user_points( $user_id, absint( $_POST['user_points'] ), get_current_user_id() );
46 }
47
48 $points_types = gamipress_get_points_types();
49
50 foreach( $points_types as $points_type => $data ) {
51 // Update each user's points type total, but only if edited
52 if ( isset( $_POST['user_' . $points_type . '_points'] ) && absint( $_POST['user_' . $points_type . '_points'] ) !== gamipress_get_user_points( $user_id, $points_type ) ) {
53 gamipress_update_user_points( $user_id, absint( $_POST['user_' . $points_type . '_points'] ), get_current_user_id(), null, $points_type );
54 }
55 }
56
57 }
58 //add_action( 'personal_options_update', 'gamipress_save_user_profile_fields' );
59 //add_action( 'edit_user_profile_update', 'gamipress_save_user_profile_fields' );