| @@ -169,16 +169,13 @@ | ||
| 169 | 169 | 'type', |
| 170 | 170 | 'trigger_type', |
| 171 | 171 | 'access', |
| 172 | 172 | 'user_id', |
| 173 | - 'date' | |
| 173 | + 'date', | |
| 174 | + 'points', | |
| 175 | + 'points_type', | |
| 174 | 176 | ); |
| 175 | 177 | |
| 176 | - if( is_gamipress_upgraded_to( '6.9.4' ) ) { | |
| 177 | - $log_fields[] = 'points'; | |
| 178 | - $log_fields[] = 'points_type'; | |
| 179 | - } | |
| 180 | - | |
| 181 | 178 | // Initialize query definitions |
| 182 | 179 | $select = array(); |
| 183 | 180 | $joins = array(); |
| 184 | 181 | $where = array(); |
| @@ -447,13 +444,8 @@ | ||
| 447 | 444 | * @return int |
| 448 | 445 | */ |
| 449 | 446 | function gamipress_get_user_log_count( $user_id = 0, $where = array(), $since = 0 ) { |
| 450 | 447 | |
| 451 | - // If not properly upgrade to required version fallback to compatibility function | |
| 452 | - if( ! is_gamipress_upgraded_to( '1.2.8' ) ) { | |
| 453 | - return gamipress_get_user_log_count_old( $user_id, $where ); | |
| 454 | - } | |
| 455 | - | |
| 456 | 448 | return gamipress_query_logs( array( |
| 457 | 449 | 'select' => 'COUNT(*)', |
| 458 | 450 | 'user_id' => $user_id, |
| 459 | 451 | 'where' => $where, |
| @@ -515,16 +507,8 @@ | ||
| 515 | 507 | $trigger_type = $log_meta['trigger_type']; |
| 516 | 508 | unset( $log_meta['trigger_type'] ); |
| 517 | 509 | } |
| 518 | 510 | |
| 519 | - // If not properly upgrade to required version fallback to compatibility function | |
| 520 | - if( ! is_gamipress_upgraded_to( '1.4.7' ) ) { | |
| 521 | - | |
| 522 | - $log_meta['trigger_type'] = $trigger_type; | |
| 523 | - | |
| 524 | - return gamipress_insert_log_old_147( $type, $user_id, $access, $log_meta ); | |
| 525 | - } | |
| 526 | - | |
| 527 | 511 | // Setup table |
| 528 | 512 | $ct_table = ct_setup_table( 'gamipress_logs' ); |
| 529 | 513 | |
| 530 | 514 | // Post data |
| @@ -536,12 +520,10 @@ | ||
| 536 | 520 | 'user_id' => $user_id === 0 ? get_current_user_id() : absint( $user_id ), |
| 537 | 521 | 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
| 538 | 522 | ); |
| 539 | 523 | |
| 540 | - if( is_gamipress_upgraded_to( '6.9.4' ) ) { | |
| 541 | - $log_data['points'] = ( isset( $log_meta['points'] ) ) ? $log_meta['points'] : 0; | |
| 542 | - $log_data['points_type'] = ( isset( $log_meta['points_type'] ) ) ? $log_meta['points_type'] : ''; | |
| 543 | - } | |
| 524 | + $log_data['points'] = ( isset( $log_meta['points'] ) ) ? $log_meta['points'] : 0; | |
| 525 | + $log_data['points_type'] = ( isset( $log_meta['points_type'] ) ) ? $log_meta['points_type'] : ''; | |
| 544 | 526 | |
| 545 | 527 | // Auto-generated post title |
| 546 | 528 | $log_data['title'] = gamipress_parse_log_pattern( $log_meta['pattern'], $log_data, $log_meta ); |
| 547 | 529 | |
| @@ -595,22 +577,8 @@ | ||
| 595 | 577 | * @return integer The post ID of the newly created log entry |
| 596 | 578 | */ |
| 597 | 579 | function gamipress_parse_log_pattern( $log_pattern = '', $log_data = array(), $log_meta = array()) { |
| 598 | 580 | |
| 599 | - // If not properly upgrade to required version fallback to compatibility function | |
| 600 | - if( ! is_gamipress_upgraded_to( '1.2.8' ) ) { | |
| 601 | - | |
| 602 | - if( isset( $log_data['user_id'] ) ) { | |
| 603 | - $log_data['post_author'] = $log_data['user_id']; | |
| 604 | - } | |
| 605 | - | |
| 606 | - if( isset( $log_data['type'] ) ) { | |
| 607 | - $log_meta['type'] = $log_data['type']; | |
| 608 | - } | |
| 609 | - | |
| 610 | - return gamipress_parse_log_pattern_old( $log_pattern, $log_data, $log_meta ); | |
| 611 | - } | |
| 612 | - | |
| 613 | 581 | global $gamipress_pattern_replacements; |
| 614 | 582 | |
| 615 | 583 | // Setup site pattern replacements |
| 616 | 584 | $gamipress_pattern_replacements['{site_title}'] = get_bloginfo( 'name' ); |
| @@ -655,23 +623,8 @@ | ||
| 655 | 623 | * @param array $log_meta Log meta data |
| 656 | 624 | */ |
| 657 | 625 | function gamipress_parse_achievement_log_pattern( $log_data, $log_meta ) { |
| 658 | 626 | |
| 659 | - // If not properly upgrade to required version fallback to compatibility function | |
| 660 | - if( ! is_gamipress_upgraded_to( '1.2.8' ) ) { | |
| 661 | - | |
| 662 | - if( isset( $log_data['user_id'] ) ) { | |
| 663 | - $log_data['post_author'] = $log_data['user_id']; | |
| 664 | - } | |
| 665 | - | |
| 666 | - if( isset( $log_data['type'] ) ) { | |
| 667 | - $log_meta['type'] = $log_data['type']; | |
| 668 | - } | |
| 669 | - | |
| 670 | - gamipress_parse_achievement_log_pattern_old( $log_data, $log_meta ); | |
| 671 | - return; | |
| 672 | - } | |
| 673 | - | |
| 674 | 627 | // If log has assigned an achievement, then add achievement pattern replacements |
| 675 | 628 | if( isset( $log_meta['achievement_id'] ) ) { |
| 676 | 629 | |
| 677 | 630 | global $gamipress_pattern_replacements; |
| @@ -709,36 +662,15 @@ | ||
| 709 | 662 | * @param array $log_meta Log meta data |
| 710 | 663 | */ |
| 711 | 664 | function gamipress_parse_points_log_pattern( $log_data, $log_meta ) { |
| 712 | 665 | |
| 713 | - // If not properly upgrade to required version fallback to compatibility function | |
| 714 | - if( ! is_gamipress_upgraded_to( '1.2.8' ) ) { | |
| 715 | - | |
| 716 | - if( isset( $log_data['user_id'] ) ) { | |
| 717 | - $log_data['post_author'] = $log_data['user_id']; | |
| 718 | - } | |
| 719 | - | |
| 720 | - if( isset( $log_data['type'] ) ) { | |
| 721 | - $log_meta['type'] = $log_data['type']; | |
| 722 | - } | |
| 723 | - | |
| 724 | - gamipress_parse_points_log_pattern_old( $log_data, $log_meta ); | |
| 725 | - return; | |
| 726 | - } | |
| 727 | - | |
| 728 | 666 | // If log is a points based entry, then add points pattern replacements |
| 729 | 667 | if( $log_data['type'] === 'points_award' || $log_data['type'] === 'points_revoke' || $log_data['type'] === 'points_earn' || $log_data['type'] === 'points_deduct' ) { |
| 730 | 668 | |
| 731 | 669 | global $gamipress_pattern_replacements; |
| 732 | 670 | |
| 733 | - // If not properly upgrade to required version fallback to compatibility function | |
| 734 | - if( is_gamipress_upgraded_to( '6.9.4' ) ) { | |
| 735 | - $points = absint( $log_data['points'] ); | |
| 736 | - $points_type = $log_data['points_type']; | |
| 737 | - } else { | |
| 738 | - $points = absint( $log_meta['points'] ); | |
| 739 | - $points_type = $log_meta['points_type']; | |
| 740 | - } | |
| 671 | + $points = absint( $log_data['points'] ); | |
| 672 | + $points_type = $log_data['points_type']; | |
| 741 | 673 | |
| 742 | 674 | $points_types = gamipress_get_points_types(); |
| 743 | 675 | |
| 744 | 676 | // Default points label |
| @@ -904,14 +836,8 @@ | ||
| 904 | 836 | $meta_keys = array(); |
| 905 | 837 | |
| 906 | 838 | if( $log_data['type'] === 'event_trigger' ) { |
| 907 | 839 | // Event trigger meta data |
| 908 | - | |
| 909 | - // If not upgraded to 1.4.7 yet, return trigger_type as a meta data | |
| 910 | - if( ! is_gamipress_upgraded_to( '1.4.7' ) ) { | |
| 911 | - $meta_keys[] = 'trigger_type'; | |
| 912 | - } | |
| 913 | - | |
| 914 | 840 | $meta_keys[] = 'count'; |
| 915 | 841 | } else if( $log_data['type'] === 'achievement_earn' || $log_data['type'] === 'achievement_award' ) { |
| 916 | 842 | // Achievement earn meta data |
| 917 | 843 | $meta_keys[] = 'achievement_id'; |