• Resolved boxcarpress

    (@boxcarpress)


    The code that handles the Member Request page looks up the IP address for each user’s IP address. Unfortuntely, this external website now requires an API key that isn’t part of the request. When we have more than 20 or so members to moderate, the external requests take too long (over 30 seconds) and the page just hangs. As a solution, we have commented out the request for the external IP lookup site. The offending line (in wp-content/plugins/bp-registration-options/includes/admin.php) is:

    
         $response = wp_remote_get( 'https://freegeoip.net/json/' . $userip );
    

    When we remove this, the page loads as expected.

    As you can see from an example page, the external will not return the expected data:
    https://freegeoip.net/json/81.178.231.32

    • This topic was modified 6 years, 5 months ago by boxcarpress.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    Looks like I get to replace this functionality again. I originally switched TO freegeoip in this issue at https://github.com/WebDevStudios/BuddyPress-Registration-Options/issues/101 for version 4.3.0

    However, they went premium as well it appears.

    If you prefer not commenting out code, and just want to not have this spot shown at all for the time being, you should be able to add this line to your functions.php file:

    remove_action( ‘bpro_hook_member_item_additional_data’, ‘bp_registration_options_ip_data’, 10, 1 );

    However, we don’t have any pending updates to release in the near future, so leaving commented out would work as well. Perhaps we should do a bug release to address this new one though.

    Thread Starter boxcarpress

    (@boxcarpress)

    Thanks for the response, and your solution is a more elegant fix in the meantime.

    On our server this problem doesn’t pop up unless there are >20 pending member requests. After that point, however, the member request page shows a 504 Gateway Timeout error. I guess the PHP script is still running but it takes too long for nginx. Unfortunately, at this point, the only solution is to do a manual update to the database, changing the metavalues of the items in the query:

    SELECT *
    FROM wp_usermeta um
    WHERE um.meta_key = '_bprwg_is_moderated'
    AND meta_value <> 'false'
    ;

    Thanks for your plugin and I hope this helps!

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Is adding that remove_action() line not working as expected in that the location data fetching it’s still causing timeouts for you?

    Thread Starter boxcarpress

    (@boxcarpress)

    Sorry if this was confusing. I just wanted to clarify how someone could access the database to fix this if they were stuck with a gateway timeout and couldn’t modify the code.

    I initially took the approach of removing the bpro_hook_member_item_additional_data action but if I recall other data (used for moderating users) was completetly missing afterwards. It worked, though, but in the end I preferred to fire the bpro_hook_member_item_additional_data action but specifically comment out the wp_remote_get() call in function bp_registration_options_ip_data().

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Gotcha. Makes sense to me for sure.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bug hangs site on Member Request page’ is closed to new replies.