• Resolved dennis8976

    (@dennis8976)


    Hi I have ran across some problems with importing user points. I have ranks set in place and users will rank up according to their user points. However when I’m importing points, ranks of some users do not update even if they get the requirement for the next rank.

    Also to add, how can I make the logs for points award public when using the importer? I have observed that the points awarded using the importer have private visibility, thus it does not show up in my [gamipress_earnings] shortcode which is displayed on a page.

    Thanks in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Hi @dennis8976

    GamiPress works with events. When your users gain more points after you manual assignation, they will receive the achievement (if they have not earned it after the bulk process).

    Those they had the achievement because you create the bulk point gain process, you should create another bulk process to give them the achievement.

    It is not a bug, it is a security behaviour.

    To save the user earning bulk points process on logs, you have to activate the switcher before you create the import:

    View post on imgur.com

    Hope it helps!

    Thread Starter dennis8976

    (@dennis8976)

    Hi @flabernardez

    Thanks for getting back to me. I am pertaining to the import tool, not the bulk awards. I already set the rank to be awarded one the points balance is reached. As I mentioned, ranks of some users do not update even if they meet the required points balance if I use the import tool. Manual input through bulk awards is working fine, but import tool sometimes occur this issue.

    Regarding the logs, it is perfectly working for me except for the fact that the logs for imported user points are in private thus it does not display in my [gamipress_earnings] shortcode. Here are screenshots to support my explanation: https://imgur.com/a/JAaMyPc

    Thanks so much for your help!

    Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Hi @dennis8976!

    Our import tool does not save the information on user earnings. However, we have a snippet to include them there ??

    function my_prefix_insert_user_earning_on_import_points_tool( $user_id, $points, $points_type, $args ) {

    if( ! defined( ‘DOING_AJAX’ ) ) return;
    if( ! DOING_AJAX ) return;
    if( ! isset( $_REQUEST[‘action’] ) ) return;
    if( $_REQUEST[‘action’] !== ‘gamipress_import_export_points_tool_import’ ) return;

    $points_type_obj = gamipress_get_points_type( $points_type );
    $award = ( current_filter() === ‘gamipress_award_points_to_user’ );

    if( ! $award ) {
    $points *= -1;
    }

    gamipress_insert_user_earning( $user_id, array(
    ‘title’ => ( isset( $args[‘reason’] ) ? $args[‘reason’] : ” ),
    ‘post_id’ => $points_type_obj[‘ID’],
    ‘post_type’ => ‘points-type’,
    ‘points’ => $points,
    ‘points_type’ => $points_type,
    ‘date’ => date( ‘Y-m-d H:i:s’, current_time( ‘timestamp’ ) ),
    ) );

    }
    add_action( ‘gamipress_award_points_to_user’, ‘my_prefix_insert_user_earning_on_import_points_tool’, 10, 4 );
    add_action( ‘gamipress_deduct_points_to_user’, ‘my_prefix_insert_user_earning_on_import_points_tool’, 10, 4 );

    To easily add the code on your site, simply install the plugin “Code Snippets” that lets you add custom code without touch a single file.

    Have a great day!

    Thread Starter dennis8976

    (@dennis8976)

    Hi @flabernardez

    I tried using this code but it does not seem to work. Is there any error?

    Thanks,
    Dennis

    Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Hi @dennis8976

    So sorry! I completely forgot to add code formatting when I put the code. Here you have:

    
    
    function my_prefix_insert_user_earning_on_import_points_tool( $user_id, $points, $points_type, $args ) {
    
        if( ! defined( 'DOING_AJAX' ) ) return;
        if( ! DOING_AJAX ) return;
        if( ! isset( $_REQUEST['action'] ) ) return;
        if( $_REQUEST['action'] !== 'gamipress_import_export_points_tool_import' ) return;
    
        $points_type_obj = gamipress_get_points_type( $points_type );
        $award = ( current_filter() === 'gamipress_award_points_to_user' );
    
        if( ! $award ) {
            $points *= -1;
        }
    
        gamipress_insert_user_earning( $user_id, array(
            'title'	        => ( isset( $args['reason'] ) ? $args['reason'] : '' ),
            'post_id'	    => $points_type_obj['ID'],
            'post_type' 	=> 'points-type',
            'points'	    => $points,
            'points_type'	=> $points_type,
            'date'	        => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
        ) );
    
    }
    add_action( 'gamipress_award_points_to_user', 'my_prefix_insert_user_earning_on_import_points_tool', 10, 4 );
    add_action( 'gamipress_deduct_points_to_user', 'my_prefix_insert_user_earning_on_import_points_tool', 10, 4 );
    
    

    Hope it helps now!

    Thread Starter dennis8976

    (@dennis8976)

    Hi @flabernardez

    Thank you so much it is reflecting now! However I would just like to ask one last thing, the points displayed is the cumulative sum, is it possible to only display the amount of points that is awarded at that instance, just like how it displays when I award points through Bulk Awards?

    Thanks,
    Dennis

    Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Hi again @dennis8976!

    I am so sorry but that is not possible. The import system takes by CSV entry.

    Have a great day!

    Thread Starter dennis8976

    (@dennis8976)

    Hi @flabernardez

    Sorry I may have not explained it well, currently it displays the total points of the user instead of what is indicated in the CSV entry. Attached is an example, I uploaded two CSVs differently, one for the Test 1 and another for the Test 2.

    View post on imgur.com

    Both imports are worth 3,000 diamonds but on the second one, it reflects 6,000 which is the total from the two CSV imports. Is there a way to only show the points gained from the CSV entry?

    Thank you so much!

    Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Hi @dennis8976

    Yes, we understood you hehe. That is not currently possible instead of making a custom code. Our plugin and that code we provide you add an entry to the user earnings based on every import you do.

    If you would like to ask someone who can help you with the custom code, try to consult our trusted experts: https://gamipress.com/development-consultants/

    Hope it is clearer ??

    Thread Starter dennis8976

    (@dennis8976)

    @flabernardez no worries, thank you so much! Your help has been very great ??

    Plugin Contributor Flavia Bernárdez Rodríguez

    (@flabernardez)

    Thanks, @dennis8976! Do not hesitate to contact us if you need help ??

    Have a great day!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Issues with importing user points’ is closed to new replies.