Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null from craft.geomate.redirectInformation() #30

Closed
matthewbacon opened this issue Mar 31, 2020 · 2 comments
Closed

Null from craft.geomate.redirectInformation() #30

matthewbacon opened this issue Mar 31, 2020 · 2 comments

Comments

@matthewbacon
Copy link

Having installed Geomate via composer I can access all craft.geomate.country, craft.geomate.countryCode and craft.geomate.city within my templates. HOWEVER I have been unsuccessful in retrieving anything except NULL from redirect information.

geomete.php (in config folder) looks like...

<?php
return [
    'autoRedirectEnabled' => true,
    'redirectIgnoreAdmins' => false,
    'redirectMap' => [
        'eu' => [
            'continent' => 'eu',
            'isInEuropeanUnion' => true
        ],
        'europe' => [
            'continent' => 'eu',
        ],
        'us' => [
            'country' => 'us'
        ],    
        'global' => '*' 
    ]
];

While in my template files I am using...

{% set redirectInfo = craft.geomate.redirectInformation() %}
{{ dump(redirectInfo) }}

Sorry, what am I doing wrong?

@matthewbacon
Copy link
Author

I've tested via Incognito browsers as well in case it was because I was logged in as Admin. Same results.

@aelvan
Copy link
Contributor

aelvan commented Apr 1, 2020

I see that you have 'autoRedirectEnabled' => true,, maybe that's why. If you're already on the site that the user is meant to end up on, ie you've been redirected there, craft.geomate.redirectInformation() will always be null. That function is meant to be used in cases where you don't have autoRedirectEnabled enabled, and instead want to figure out if the user should be redirected, and either do it manually, or present the user with the option.

@aelvan aelvan closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants