Michael

Forum Replies Created

Viewing 20 posts - 141 through 160 (of 649 total)
  • Author
    Posts
  • Michael
    Member
    Post count: 649
    This reply has been marked as private.
    Michael
    Member
    Post count: 649

    Just a quick post saying that I’ll check things tomorrow morning. it’s nearing midnight for me at the moment.

    Michael
    Member
    Post count: 649

    You may not have your license key entered for the product then. As long as you still have a valid license, within a year of purchase if you haven’t renewed, you should also be able to acquire them by visiting https://badgeos.org/add-ons/my-downloads/

    Michael
    Member
    Post count: 649

    Can you please upgrade your copy to 1.0.2 and report back if it continues to happen?

    Michael
    Member
    Post count: 649

    Hmm. Interesting issue and one I am not sure I’d be able to recreate on my own testing install.

    Out of curiosity, is it still happening, now? Or was it just that one time. Curious if perhaps some specific part got cached.

    Looking over the plugin code, it should only be triggering on new ones, as we use a “time since” parameter to check for existing achievements to notify for. If none exist, it shouldn’t execute at all.

    Michael
    Member
    Post count: 649
    This reply has been marked as private.
    Michael
    Member
    Post count: 649

    To add to that, after some tinkering, as I wasn’t originally part of the development of this addon, is the following.

    In the get data filter, you’d receive an array of users and some data for all of the default columns, but also a user ID so you could query for other custom data as necessary. It is an indexed array, so you’d need to add data with that in mind. See example here.

    function filter_this_1 ($data) {
    	foreach( $data as $key => $value ) {
    		$data[ $key ]['foobar'] = 'abc'; //Example will set same for all. Customize as needed.
    	}
    
    	return $data;
    }
    add_filter( 'badgeos_reports_get_data', 'filter_this_1' );
    

    For the columns, you’re going to get an array of column keys, and each key is going to have a value of an array with some various parts regarding how to handle the column. This includes the title to use for the column, data type (string, integer, etc), whether or not to show in the tables, charts, or csv exports. You would want to match your column with the same type of data. See the user-report.php file for some examples, as well as where the defaults are all set in this case.

    function filter_this_2 ($data) {
    	$data['foobar'] = array(
    		'title' => 'Foobar',
    		'data-type' => 'string',
    		'show_in_table' => true,
    		'show_in_chart' => true,
    		'show_in_csv' => true
    	);
    
    	return $data;
    }
    add_filter( 'badgeos_reports_get_columns', 'filter_this_2' );
    
    Michael
    Member
    Post count: 649

    I’d recommend looking through the class-badgeos-report.php file which is essentially what’s used for the rendering of various reports, including active user report.

    Looking through it myself, I think these two filters are going to be your best bet: badgeos_reports_get_data and badgeos_reports_get_columns You’d need to inspect all that’s provided for both, and figure out the best way to A) Add the group data to the filtered data, and B) Add the column. Both look like they’re an array by default.

    Michael
    Member
    Post count: 649
    Michael
    Member
    Post count: 649

    Whoops, I have the in_array part reversed.

    Try with this instead:

    in_array( $leaderboard_id, $leaderboard_to_exclude_from )
    
    Michael
    Member
    Post count: 649

    Sounds like you have things worked out. Awesome.

    Michael
    Member
    Post count: 649

    Note that there is an add_filter() at the very end of my code snippet. So it’s not simply a function you invoke and magic happens. As is, it needs to be attached to the filter and whatever data the filter passes in, is what’s available to you at the given moment. It’s also going to all self-execute at the point of updating a leaderboard.

    Adding this right above the WP_User_Query should help with potentially excluding from the provided Leaderboards above.

    // Set leaderboards to exclude from.
    $leaderboard_to_exclude_from = array( 19661, 19662, 19663, 19664, 19665, 19666, 19667, 19668 );
    
    if ( ! in_array( $leaderboard_to_exclude_from, $leaderboard_id ) ) {
    	return $leaders;
    }
    

    Basically if the current leaderboard being updated, found in $leaderboard_id isn’t in the array of IDs, then it will return the filter values unmodified.

    Michael
    Member
    Post count: 649

    Sean, you should be able to add a second WP_User_Query to the mix with a different role, and then loop over those like the admins are, and add those user IDs into the $admin_ids variable. That would make a mix of admins and ___ role IDs to check against.

    For the specific leaderboard part, you’d need to use the available $leaderboard_id variable for conditional checking before acting on the inclusion.

    Note for anyone coming by, this isn’t a “set it and forget it” solution, you’re going to need to amend as necessary to fit your site’s specific needs at times.

    Michael
    Member
    Post count: 649

    Mark, what version of the plugin are you presently running? For my information sake. That error should be fixed in version 1.0.2.

    Michael
    Member
    Post count: 649

    Possible issue with the code that’s meant to change the indicator. I’d need to investigate and see what’s maybe going on there.

    Worst case scenario, never hesitate to ask us as we can confirm on our end as necessary.

    Michael
    Member
    Post count: 649
    This reply has been marked as private.
    Michael
    Member
    Post count: 649

    The achievements are posts in post types, so it should be possible to use get_permalink() with the provided post ID to make lovely links. Pretty much all other aspects of the achievements should open up now too with that information. You have the achievement/post ID, you can do anything you need at that point.

    Michael
    Member
    Post count: 649

    Assuming you’re using a foreach loop to display the results from the function I pointed out, you should be able to do an if statement check for the post type.

    if ( 'step' == $achievement->post_type ) {
        continue;
    }
    

    The quick snippet above would make it move on to the next achievement in the list, instead of continuing to render that one.

    If you’re displaying them some other way, I’d need to have a code snippet example of what you’re using to advise better.

    Michael
    Member
    Post count: 649

    Morning Amanda.

    You’ll want to use badgeos_get_user_achievements(); for that. It takes an array for its argument. At minimum, you’d want to pass in the user ID. You and your hired developer can see more for this function at http://badgeos.org/api/source-function-badgeos_get_user_achievements.html#12-66. Hopefully it makes sense to those who will be working on it, but you’re all always welcome to ask questions as necessary.

    Michael
    Member
    Post count: 649
Viewing 20 posts - 141 through 160 (of 649 total)