• Resolved killbert72

    (@killbert72)


    Hi Antoine,

    Is it possible to allow users to register for a certain league pool?

    What I would want, is the following scenario:

    1. New user registers on the site as a new player via Facebook connect or standard simple user registation (just email and password).
    2. After registration, player gets redirected to the page where he can fill out his predictions.
    3. On that same page (or a different page if that is easier) the user chooses if he wants to be participating in a particular league. An overview of available leagues is given on the site. (drop down box or tick boxes for instance). Default league is the overall league .
    4. Just like being able to change their predictions for matches, players can switch leagues up to cut off date for bonus questions for instance.
    5. I can create a page where users can select to see the standing is of a particular league.

    Hope this makes sense. what I want to avoid, is having to do all the league stuff as moderator myself. I don’t care what leagues people play in. but I do want to have different leagues for departments etc.

    https://www.ads-software.com/plugins/football-pool/

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

    (@antoineh)

    This will require some custom development as the plugin can’t handle this scenario. I’ll answer your mail.

    Hello Guys,

    I was just looking for the exact same answer. Basically what i want to do is to start a pre-poule on my site towards the WK2014 so new users can get used to playing. I would like to set up one for the Eredivisie and have one set-up already for the WK2014.

    Players would be able to play in both leagues, but they can easily and visually choose on the page. or a ‘choose your league’ page for instance.

    Can this be done?

    Dank je!
    groetjes

    @mikes0r: It is considered impolite to interrupt another poster’s ongoing thread unless you are posting a solution or suggestion. It causes significant problems for the forum’s volunteers and prevents us from being able to track issues by topic. Please post your own topic.

    Hello @esmi,

    When you read my post, it’s the exact same question.
    So why would I make cross topics that are even harder to track than posting the same question in the appropriate thread?

    I can edit my question to the thread starter if needed. But I don’t see any use in making a new thread about the same topic, when I will be redirected back to this original one in the end anyway.

    why would I make cross topics that are even harder to track than posting the same question in the appropriate thread?

    Because:
    1. That is how these forums work. Please see the section at the link I posted above.
    2. You have been asked to start a new topic by a forum moderator.

    Thread Starter killbert72

    (@killbert72)

    In addition Mike, your question is not the same: you are confusing what is referred to as ‘leagues’ in the context of this question.

    Here ‘leagues’ are different groups of players all competing in the same pool for the World Cup. Like the Marketing Department League or a group of friends. They form a subset of the overall group of people playing.

    What you are referring to is to have different sets of independent tournaments for which a player can submit his predictions. This is an interesting idea, but not what I am discussing with Antoine here ??

    Thread Starter killbert72

    (@killbert72)

    Someone suggested I do this:

    <?php
    
    if(!isset($_POST['submit'])){
    
      //if the form has not been submitted yet, display the form
      echo "<form name='myform' action='' method='POST'>";
      //Get array of leagues
      $leagues = $pool->get_leagues(true);
    
      //Make a drop down
      echo "<select name='league'>";
    
        foreach($leagues as $league){
            echo "<option>$league</option>";
        }
      echo "</select>";
    
      echo "<input type='submit' name='submit' value='Submit'>";
      echo "</form>";
    
    }else{
    
    //If the form has been submitted, run the PHP function to update database
      $pool = new Football_Pool_Pool;
      $pool->update_league_for_user(get_current_user_id(), $_POST['league']);
      echo "Database updated!";
    }
    
    ?>

    But now the question is: where to put this file and how to call it?

    Plugin Author AntoineH

    (@antoineh)

    The code is not completely correct. The function get_leagues() returns an array. This code will work better:

    <?php
    
    if(!isset($_POST['change_league'])){
    
      //if the form has not been submitted yet, display the form
      echo "<form name='myform' action='' method='POST'>";
      //Get array of leagues
      $pool = new Football_Pool_Pool;
      $leagues = $pool->get_leagues(true);
    
      //Make a drop down
      echo "<select name='league'>";
    
        foreach($leagues as $league){
            echo "<option value='{$league['league_id']}'>{$league['league_name']}</option>";
        }
      echo "</select>";
    
      echo "<input type='submit' name='change_league' value='Submit'>";
      echo "</form>";
    
    }else{
    
    //If the form has been submitted, run the PHP function to update database
      $pool = new Football_Pool_Pool;
      $pool->update_league_for_user(get_current_user_id(), $_POST['league']);
      echo "Database updated!";
    }
    
    ?>

    Where to put this depends on what you want. You can put it in a template file, e.g. the Page Template (see Appearance ? editor for the available templates in your theme) if you want to show the switcher on every page.

    If you want it on just one page, you can add a check for a certain page ID or page slug. Or create your own template file (copy one of the existing files) and create a Page in the admin and assign it to this new template.

    Plugin Author AntoineH

    (@antoineh)

    Oh, and you should enclose the code in a check if there is a logged in user.

    Thread Starter killbert72

    (@killbert72)

    Works perfectly. Thanks man!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Let users register for a league’ is closed to new replies.