• Hello,
    Firstly, it’s a great plugin. Thx for that.
    I Added all Copa America Stuff, so if someone want to get it, drop a comment here.
    Antoine, i want to update the template of all content, i’m using Bricks Theme but it seems i can’t query CPT and meta. Maybe it’s not your implementation… Is there a way to get access to data to fulfil a template dynamically (not writing html files)
    Regards

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author AntoineH

    (@antoineh)

    hi,

    I’m not using CPT in my plugin. Everything but the users are in custom database tables. So there is not really a way to get the data other than querying the database yourself or using the methods in the plugin. I wouldn’t recommend this.

    There is a way to change the presentation of the data via filters, but this will require writing your own html and also php.

    Thread Starter popsantiago

    (@popsantiago)

    Thx Antoine for the reply.
    I will use filters.
    My client wants to get winners (users) with some criteria : Client Type ex. Agency (i can use League for that i guess) But he also want winners by country (Meta User). Do you have an idea to get this kind of flow ?
    Thx

    Plugin Author AntoineH

    (@antoineh)

    You may be able to create a filter on the ranking that uses fields in the user meta to filter for a country and then combine this with a custom shortcode.

    But that is just thinking out loud. Haven’t tried it myself.

    Thread Starter popsantiago

    (@popsantiago)

    Hello,
    Do you mean using this filter > footballpool_ranking_users
    Thx

    Plugin Author AntoineH

    (@antoineh)

    I think you’ll want to filter the ranking by filtering out the users that are not in a specific country -> footballpool_ranking_array, but that’s something to test. I didn’t give it a lot of thought.

    Thread Starter popsantiago

    (@popsantiago)

    Thx a lot, i will have a look on this.

    Thread Starter popsantiago

    (@popsantiago)

    Hello Antoine,
    I made some try. And it only working when i’m using the Shortcode [fp-ranking] but not on the ranking page.
    Any idea ?
    Here is my function >

    function custom_footballpool_ranking_array_filter($rows) {
    // Récupérer l'ID de l'utilisateur actuel
    $current_user_id = get_current_user_id();
    
    // Récupérer l'ACF user_agency de l'utilisateur actuel
    $current_user_agency = get_field('user_agency', 'user_' . $current_user_id);
    
    // Parcourir chaque tableau de $rows
    foreach ($rows as $key => $row) {
        // Récupérer l'ACF user_agency de l'utilisateur dans le tableau
        $user_agency = get_field('user_agency', 'user_' . $row['user_id']);
    
        // Si l'ACF user_agency de l'utilisateur dans le tableau ne correspond pas à celle de l'utilisateur actuel, supprimer cette ligne
        if ($user_agency !== $current_user_agency) {
            unset($rows[$key]);
        }
    }
    //var_dump($rows);
    return $rows;
    
    }
    
    // Ajouter le filtre au hook 'footballpool_ranking_users'
    add_filter('footballpool_ranking_array', 'custom_footballpool_ranking_array_filter');
    Plugin Author AntoineH

    (@antoineh)

    That’s weird, because both the ranking shortcode and the ranking page use the same filter. I did a quick test on my install with your code, and I can see that it is triggered on both the ranking page and on a page with the shortcode.

    But while looking at the code, I noticed that the filter will not work on the widget, though. For some reason the widget doesn’t have this filter. I can’t remember why, and maybe it was just a mistake, but this will mean that you also should try to change that ranking if you want to use the widget. But it might be as simple as attaching the function you wrote also to a different filter that is being used in the widget. Like so (untested):

    // Ajouter le filtre au hook 'footballpool_ranking_users'
    add_filter('footballpool_ranking_array', 'custom_footballpool_ranking_array_filter');
    // Et aussi au hook 'footballpool_get_ranking_limited'
    add_filter('footballpool_get_ranking_limited', 'custom_footballpool_ranking_array_filter');
    Thread Starter popsantiago

    (@popsantiago)

    Hello,
    Thx i will have a look on this.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Bricksbuilder & Contents [COPA America]’ is closed to new replies.