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

    (@antoineh)

    Your registration form outputs the league values as string values, whereas my code expects the league ID’s from the database. This means you’ll either need to output the ID’s in the option values (if this is supported by your registration plugin), or you’ll need to map the string values to the ID’s in code (like in the post that you linked). For the latter the only thing that should change are the cases in the switch statement. Something like the below. I made up the numbers, so you’ll need to adjust those to the actual values in your database (can be found on the leagues admin page).

    switch ( $league ) {
    	case 'AJ Timber France':
    		$league = 1;
    		break;
    	case 'Allure (NL)':
    		$league = 2;
    		break;
    	case 'Deli Home Gorinchem':
    		$league = 5;
    		break;
    	default:
    		$league = 5; // Gorinchem
    }

    p.s. If your coding skills are moderate, then I can recommend asking chatGPT for help by submitting some code to fix it. It then even explains what it did/how it works and when you get an error, you can post the error and chatGPT will try to resolve it for you.

    Thread Starter martinvd123

    (@martinvd123)

    Thank you Antoine,

    I’m sorry I can’t get it to work. One last thing and then I will leave it for what it is. I get an errormessage in the debug.log:

    [10-May-2024 10:53:16 UTC] PHP Warning: Attempt to read property “has_leagues” on null in /var/www/vhosts/pool-deli-home.nl/httpdocs/wp-content/plugins/football-pool/classes/class-football-pool.php on line 705

    Could that have to do with it?

    Plugin Author AntoineH

    (@antoineh)

    That error means that there is no instance of the Football_Pool_Pool object initiated. And with no instance of the class, you can’t call it’s method to update the user league. Why there is no object, I can’t tell.

    Thread Starter martinvd123

    (@martinvd123)

    Okay thank you.

    Just wondering if this has an influence at the rest of the site or just the registration? Then I don’t care to set the pool manually.

    Could it have to do with a value in the database?

    Thanks!

    Plugin Author AntoineH

    (@antoineh)

    Don’t think that it is related to a value in the database. But also don’t know what is happening. Only way to find out, is by debugging your file, but that requires a good understanding of PHP coding.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Choose Pool at registration page’ is closed to new replies.