The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

IP-Address in Profile

Page 1 of 3 1, 2, 3  Next

View previous topic View next topic Go down

Solved IP-Address in Profile

Post by Eugeo Igvalt on December 9th 2014, 5:41 am

Hello. I have been working as Administrator for a forum and They have asked me they want in the Profile area and only Administrators to see it. I need the IP to appear automatically in the text box without me having to fill each text box of each member manually. I have already created the field I just need the IP to be added automatically. is there any CSS, Javascript or Html code to make this a possibility?

Screenshot of text box:http://prntscr.com/5esvgg


Last edited by Eugeo Ayano on December 16th 2014, 3:56 pm; edited 1 time in total

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by SLGray on December 9th 2014, 6:20 am

So you want the IP address to automatically appear in a customized profile field?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36673
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 9th 2014, 6:46 am

Yes that's what they asked me for. Only the Admins can see it though

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 9th 2014, 3:32 pm

This can not be done as far as i know i think you will need server side data for that and we don't have access to that sort of thing.




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 9th 2014, 4:57 pm

Eugeo Ayano wrote:Yes that's what they asked me for. Only the Admins can see it though
This is indeed possible!

New code: http://help.forumotion.com/t137330p30-ip-address-in-profile#927986

JS


Last edited by JScript on December 10th 2014, 3:50 pm; edited 2 times in total (Reason for editing : New code!)

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 9th 2014, 5:42 pm

Wow i learn something every day lol

EDIT: i could not get it to work thou it messes up other codes Sad




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 1:33 am

@APE wrote:i could not get it to work thou it messes up other codes Sad
So it did not work in your tests???

Let us analyze the code:

This line: if (location["search"] == "?agreed=true\x26step=2") {
Awaits the registration page where the data should be filled;

This: var profileID = "PROFILE_FIELD_ID";
It is where is stored the new profile field ID;

This: var IPLocation = setInterval(function() { .... }, 10);
It is an infinite loop of 10 milliseconds;

This: if (document["getElementById"](profileID) !== null) {
Awaits the ID to be interpreted by DOM;

This: jQuery("#" + profileID)["closest"]("dl")["hide"]();
Hides the field so that the member not edit manually;

This: clearInterval(IPLocation);
Stop the loop;

This: jQuery["getJSON"]("http://api.ipify.org?format=jsonp\x26callback=?", function(IP) {
Returns the public IP;

This: jQuery("#" + profileID)["val"](IP["ip"]);
Adds the returned value (IP) in the predefined field;

And this: })["fail"](function() {alert("Warning!\x0A\x0 A An error occurred while requesting registration, wait 0 seconds and refresh the page to re-register!"); });
If there is any error, shows that message!

So after this analysis, I can not imagine how it could have some conflict with other code!

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 2:14 am

Not sure but i am happy to not have it lol It just kills my java codes so i don't know lol




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 2:43 am

@APE wrote:Not sure but i am happy to not have it lol It just kills my java codes so i don't know lol
Okay, but do not give up so easy!

Works on my forum and if you find it interesting, I have to do work in your too, of course!

Please try the code below:
Code:

jQuery(function() {
   if (location.search == "?agreed=true\x26step=2") {
      var profileID = "PROFILE_FIELD_ID";
      if (document.getElementById(profileID) !== null) {
         jQuery("#" + profileID).closest("dl").hide();
         jQuery.get("http://api.ipify.org?format=jsonp\x26callback=?", function(IP) {
            jQuery("#" + profileID).val(IP.ip);
         }).fail(function() {
            alert("Warning!\n\nA An error occurred while requesting registration, wait 10 seconds and refresh the page to re-register!");
         });
      };
   };
});

I will wait for your reply ok?

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 3:15 am

Nope still having the same problem lol i will send you an account in a pm to take a look your self Wink




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 3:17 am

Okay, I'm awaiting!

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 3:18 am

sent Wink




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 3:51 am

Didn't work for me tho

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 3:53 am

@Eugeo Ayano @JScript is on my forum trying to get it to work for me also scratch




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 3:57 am

here is how I put my code:http://prntscr.com/5f50bh

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:00 am

Yes thats how i did mine lol did you try and make a new account on your forum ?
if not send me your URL and i will try Wink

EDIT:you don't have it set so it has to be filled in when making a new account




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 4:03 am

@Eugeo Ayano
Hello friend, wait just me finish this one and therefore your will be ready ok?


@APE
I found this error in your forum:

But it's nothing to do with my code!

Replace my code with this code below (no need to modify it):
Code:

if (location.search == "?agreed=true\x26step=2") {
   var profileID = 'profile_field_13_14';
   var IPLocation = setInterval(function() {
      if (document.getElementById(profileID) !== null) {
         jQuery("#" + profileID).closest("dl").hide();
         clearInterval(IPLocation);
         jQuery.getJSON("http://api.ipify.org?format=jsonp\x26callback=?", function(json) {
            jQuery("#" + profileID).val(json.ip);
         }).fail(function() {
            alert("Warning!\n\nAn error occurred while requesting registration, wait 10 seconds and refresh the page to re-register!");
         });
      };
   }, 10);
};
I await your reply,

JS


Last edited by JScript on December 10th 2014, 4:08 am; edited 2 times in total

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 4:05 am

I created a dummy account and nothing happened.

link ishttp://angelsjewelacademy.forumotion.com/

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 4:08 am

let me know when you join so I can activate your account and promote you to admin on your temporary account

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:10 am

YES @Jsript that worked Wink Woop woop i did have to change the 13_13 To 13_14 thou lol




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:13 am

Yoou have to have it set as it is here
@JScript wrote:
Eugeo Ayano wrote:Yes that's what they asked me for. Only the Admins can see it though
This is indeed possible!
Create a new field in the profile as follows:


Then go on editing your profile and with the help of the browser console, locate the new field identifier that was created as illustrated below:


Use this code:
Code:

if (location["search"] == "?agreed=true\x26step=2") {
 var profileID = "PROFILE_FIELD_ID";
 var IPLocation = setInterval(function() {
 if (document["getElementById"](profileID) !== null) {
 jQuery("#" + profileID)["closest"]("dl")["hide"]();
 clearInterval(IPLocation);
 jQuery["getJSON"]("http://api.ipify.org?format=jsonp\x26callback=?", function(IP) {
 jQuery("#" + profileID)["val"](IP["ip"]);
 })["fail"](function() {
 alert("Warning!\x0A\x0 A An error occurred while requesting registration, wait 10 seconds and refresh the page to re-register!");
 });
 };
 }, 10);
};
Change this: PROFILE_FIELD_ID ] by the identifier that you found in step above!

Result:


JS
see it says you need to make it a Necessarily filled ? YES




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 4:16 am

but then doesn't that mean the user has to find his own IP and insert it on his own?

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 4:20 am

Yes, it should be as shown in the picture!!!

@APE wrote:YES @Jsript that worked Wink Woop woop i did have to change the 13_13 To 13_14 thou lol
Just missed you change this which we sealed in the image below:


I edited my post: http://help.forumotion.com/t137330-ip-address-in-profile#927897
Then use this other, if it works, will work for @Eugeo Ayano too.


Eugeo Ayano wrote:but then doesn't that mean the user has to find his own IP and insert it on his own?
No, the field will be hidden!

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:22 am

Note it will only add the ip address when a member makes an account it will not fill in the ip address of the members that are already on your forum as members Sad




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 4:27 am

@APE wrote:Note it will only add the ip address when a member makes an account it will not fill in the ip address of the members that are already on your forum as members Sad
No problem! So what you want is that the IP is recorded whenever the member login?
If it is, I will do the way you want ok?

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 4:28 am

Already worked with the test account I made. THANK YOU!!!!!!!!

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:30 am

it would be really good if it would find the ips of the members we already have aswell as find the new members ip address Wink but dont worry if its gonna take ya all night lol its good just the way it is Razz

Thank you J Wink




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: IP-Address in Profile

Post by Eugeo Igvalt on December 10th 2014, 4:35 am

Many thanks for everything

Eugeo Igvalt
Forumember

Male Posts : 287
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: IP-Address in Profile

Post by JScript on December 10th 2014, 4:36 am

@Eugeo Ayano
I'm very happy to have helped you!

@APE
Ok, keep this topic open that tomorrow I will do the code!

JS

JScript
Forumember

Male Posts : 741
Reputation : 168
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: IP-Address in Profile

Post by APE on December 10th 2014, 4:39 am

ok no problem

To staff please Leave this post open From Ape i will close it tomorrow

APE




APE
Manager
Manager

Male Posts : 8619
Reputation : 752
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

Page 1 of 3 1, 2, 3  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum