• Resolved stefanreinprecht

    (@stefanreinprecht)


    Hey!

    We currently get PHP Notices upon logging in when using redirections, the page is stating “Login successful”, but there are no redirects happening:

    Trying to get property ‘User_ID’ of non-object
    wp-content/plugins/front-end-only-users/Functions/Determine_Redirect_Page.php:8

    Trying to get property ‘Field_Value’ of non-object
    wp-content/plugins/front-end-only-users/Functions/Determine_Redirect_Page.php:18

    Undefined index:
    wp-content/plugins/front-end-only-users/Functions/Determine_Redirect_Page.php:18

    Here’s the shortcode that has been working up until recently: (URLS have been changed for this post)

    [login redirect_field=”Typ” redirect_array_string=”referent = https://some-url.com/page1/, teamleitung = https://some-url.com/page2/, hpcph = https://some-url.com/page3/, vsd = https://some-url.com/page4/, seminar = https://some-url.com/page5/, wiederverleihung = https://some-url.com/page6/ “]

    If you need more info, let me know!

    BTW: Thanks for the awesome Plugin, it’s really helping us a lot!

    Kind regards
    Stefan

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support jaysupport

    (@jaysupport)

    Hi Stefan,

    That shortcode looks correct.

    The first notice is saying that it’s not retrieving the user ID from the login action, and the second is saying that it’s not retrieving the field value for that user, which is most likely just because it has no user to associate it with (since it isn’t retrieving the user ID).

    This functionality definitely works in the current version of the plugin. That makes me wonder, by any chance, do you have multiple login forms on the same page? For example, do you have the login or login toggle widget placed on your site, so that, when you are on the page with the login shortcode, there are two login forms on the page at the same time? This would most likely cause an error with the form submission, and it could be pulling the empty data from the second form.

    Thread Starter stefanreinprecht

    (@stefanreinprecht)

    Hi Jay,

    we don’t have multiple login forms on the same page. (I even removed the standard WP search form for testing purposes).

    What can I do to help you with debugging this problem?
    Do you need access to the page?

    Plugin Support jaysupport

    (@jaysupport)

    Hello Stefan,

    The issue seems like it’s not sending/seeing the user ID value when the form is submitted. If there is no other login form on the page that could be interfering, then the only other thing I can think of is that something is not input correctly for one or more of the values in the custom field that you are trying to use for the redirect. What kind of field is it? Try using a radio type field as a test (as this field can only have one value per user, meaning less likely that something gets messed up). Does that work? What happens if you create a brand new field with only two values, does that work?

    Thread Starter stefanreinprecht

    (@stefanreinprecht)

    Hi Jay,

    Its a Select Field actually.

    So by now what I’ve tried is creating a brand new radio field with two values. then i modified the login shortcode to redirect based on either of these two values.
    furthermore i deactivated all plugins except yours and switched to the default theme.

    still getting the same errors.

    i also checked the DB, the users are all in the DB with their respective Field IDs associated to them. also no JS errors in the console.

    by now I’m a bit lost.

    can I provide you with anymore info to help me out?

    Plugin Support jaysupport

    (@jaysupport)

    That feature definitely works, so, if it’s not an issue with the way you’re setting it up, then, at this point, I think the only thing that might help would be if there were any info in the error/debug logs that pointed to where the breakdown was happening.

    https://www.ads-software.com/support/article/debugging-in-wordpress/#wp_debug_log

    Do any notices, warnings or errors get added to the log at the time of the attempted redirect? If so, can you share them or the log?

    Thanks

    Thread Starter stefanreinprecht

    (@stefanreinprecht)

    so after a lot of debugging I discovered a problem where the plugin was checking if the login cookie has been set.

    in the CheckLoginCookie.php File on Line 7 I removed the urlencode() and all of a sudden everything was working again. so there must be some problem with the encoding/decoding of the cookie-name when the plugin is setting/checking the cookie.

    what could be the culprit here? server/DB encoding settings?
    any suggestions on a better solutions than just modifying your core-code (obviously did it just for testing purposes)

    Plugin Support jaysupport

    (@jaysupport)

    Hi Stefan,

    Thanks for looking into that. If that’s the case for you, it sounds to me like it’s related to the update we did indeed (need to) make to the encoding in version 3.2.13. A while back, we got a report from several users that their sites just stopped recognizing the cookies from the plugin. So, even if they logged in, restricted pages were not recognizing them as logged in. We found this to be related to the encoding and, after working with several users, found the solution to be what we modified in version 3.2.13.

    Our testing showed that the solution worked both on the affected servers as well as on existing sites that had not experienced any issues with the cookies. It sounds to me, however, like your site does not work with the new encoding. If, as a test, you roll back the plugin to version 3.2.12, are you then able to use the login/login redirect array without modifying the code and without encountering any issues?

    • This reply was modified 3 years, 9 months ago by jaysupport.
    • This reply was modified 3 years, 9 months ago by jaysupport.
    Thread Starter stefanreinprecht

    (@stefanreinprecht)

    Hi Jay,

    I rolled back to 3.2.12 and the redirection is working. But as you mentioned, when I’m on the page its showing me that i should log in to see the content. fyi the content is actually showing below the notice telling me to log in. (which is weird because it’s not happening with the newer version i modified)

    hope this is of some help. let me know if you need more info.

    Plugin Support jaysupport

    (@jaysupport)

    That actually just sounds like an issue with the way you have the restricted tags set up. Are you able to share – either by copy/pasting here or providing a screenshot – the content/structure of the restricted page? (You can change the restricted text/content or block it out from the screenshot if it’s sensitive information or something that only members are supposed to see.)

    Thread Starter stefanreinprecht

    (@stefanreinprecht)

    I have now downloaded version 3.2.12 and it seems to work. There is no message telling me to log in anymore. Can you tell me if and when I could upgrade the plugin to the current version? Or do you think there is a problem with our server?

    Plugin Support jaysupport

    (@jaysupport)

    Glad to hear it’s working correctly for you with version 3.2.12. We’re currently working with users from both groups to determine the best way to approach this. When an update for this specific cookie issue is released, it will definitely be noted in the changelog.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Login Redirect Error’ is closed to new replies.