PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
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
← All changes | includes/functions/ranks.php +8 -24 7.9.5 → 8.0.5 View file →
@@ -49,13 +49,8 @@
49 49 * @return array Array of ranks as WP_Post
50 50 */
51 51 function gamipress_get_ranks( $args = array() ) {
52 52
53 - // If not properly upgrade to required version fallback to compatibility function
54 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
55 - return gamipress_get_ranks_old( $args );
56 - }
57 -
58 53 // Setup our defaults
59 54 $defaults = array(
60 55 'post_type' => array_merge( gamipress_get_rank_types_slugs(), gamipress_get_requirement_types_slugs() ),
61 56 'numberposts' => -1,
@@ -782,13 +777,8 @@
782 777 * @return object|bool The post object of the rank, or false if none
783 778 */
784 779 function gamipress_get_rank_requirement_rank( $rank_requirement_id = 0 ) {
785 780
786 - // If not properly upgrade to required version fallback to compatibility function
787 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
788 - return gamipress_get_rank_requirement_rank_old( $rank_requirement_id );
789 - }
790 -
791 781 // Grab the current post ID if no rank requirement ID was specified
792 782 if ( ! $rank_requirement_id ) {
793 783 global $post;
794 784 $rank_requirement_id = $post->ID;
@@ -842,14 +832,8 @@
842 832 * @return array An array of post objects with the rank requirements
843 833 */
844 834 function gamipress_get_rank_requirements( $rank_id = 0, $post_status = 'publish' ) {
845 835
846 - // If not properly upgrade to required version fallback to compatibility function
847 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
848 - // gamipress_get_assigned_requirements() has backward compatibility and merge new and old results
849 - return gamipress_get_assigned_requirements( $rank_id, 'rank-requirement', $post_status );
850 - }
851 -
852 836 // Grab the current post ID if no rank_id was specified
853 837 if ( ! $rank_id ) {
854 838 global $post;
855 839 $rank_id = $post->ID;
@@ -1027,27 +1011,27 @@
1027 1011 $args = apply_filters( 'gamipress_get_rank_earners_args', $args, $rank_id );
1028 1012
1029 1013 $args = wp_parse_args( $args, $defaults );
1030 1014
1015 + // Sanitization
1016 + $args['limit'] = absint( $args['limit'] );
1017 + $args['order'] = gamipress_validate_from_array( strtoupper( $args['order'] ), array( 'ASC', 'DESC' ), 'DESC' );
1018 +
1031 1019 // Setup FROM
1032 - if( ! empty( $args['from'] ) ) {
1020 + if( ! empty( $args['from'] ) )
1033 1021 $from .= $args['from'];
1034 - }
1035 1022
1036 1023 // Setup WHERE
1037 - if( ! empty( $args['where'] ) ) {
1024 + if( ! empty( $args['where'] ) )
1038 1025 $where .= $args['where'];
1039 - }
1040 1026
1041 1027 // Setup LIMIT
1042 - if( $args['limit'] > 0 ) {
1028 + if( $args['limit'] > 0 )
1043 1029 $limit = '0, ' . $args['limit'];
1044 - }
1045 1030
1046 1031 // Setup ORDER BY
1047 - if( ! empty( $args['orderby'] ) ) {
1032 + if( ! empty( $args['orderby'] ) )
1048 1033 $order_by = $args['orderby'] . ' ' . $args['order'];
1049 - }
1050 1034
1051 1035 $earners = $wpdb->get_col(
1052 1036 "SELECT u.user_id
1053 1037 FROM {$from}