Hi,

We did not get actual client IP address of the nd user using exisitng function ip_address().
So we wrote a function to get the actual client IP of the user which is working fine in all version of Drupal.
We want to add this new function in bootstrap.inc file, how can we do that ? Please suggest us.

Comments

amarbijay’s picture

The actual purpose is to contribute this function to Drupal core. Please help us to add the new function to bootstrap.

function drupal_get_client_ip(){
//body here
}

longwave’s picture

Status: Needs review » Active

Why did you not get the true client IP address? If this is due to a reverse proxy, there is already support for this in core, but it needs to be configured in settings.php.

If you want to submit your patch to Drupal, see https://drupal.org/patch/submit. Note that bugs should be fixed in Drupal 8 first and then backported, if they also exist in Drupal 8.

amarbijay’s picture

Status: Needs review » Active
StatusFileSize
new1.41 KB

Please ignore this path

amarbijay’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

Thanks longwave for your quick suggestion. I tried with configuring settings.php but again it failed to get actual machine IP.
So I created a patch following the link you have given above https://drupal.org/patch/submit.
Please apply this path in bootstrap.inc file in all version of Drupal as it does not have any dependencies or issues.

Status: Active » Needs work

The last submitted patch, drupal-getactualclientip-2114123-1.patch, failed testing.

amarbijay’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Patch is formatted.

Status: Needs review » Needs work

The last submitted patch, drupal-getactualclientip-2114123-1.patch, failed testing.

amarbijay’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Updated patch

Status: Needs review » Needs work

The last submitted patch, drupal-getactualclientip-2114123-1.patch, failed testing.

amarbijay’s picture

Version: 7.23 » 7.x-dev
Status: Needs work » Active
StatusFileSize
new1.41 KB

Moving issue to drupal 7.x-dev first

amarbijay’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

Moving issue to drupal 7.x-dev first

Status: Needs review » Needs work

The last submitted patch, drupal-getactualclientip-2114123-1.patch, failed testing.

amarbijay’s picture

Status: Needs work » Needs review
amarbijay’s picture

Version: 7.x-dev » 7.23
StatusFileSize
new7.92 KB

Updated patch with actual format

amarbijay’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new1.41 KB

Please ignore this patch as patch in comment #14 is already commited.

Version: 7.23 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Patch (to be ported) » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.