:: Forums :: Discussions :: ShowMyIP
 
<< Previous thread | Next thread >>
How to show IP address in a menu
Moderators: nlstart
This thread is now closed
Author Post
nlstart

Registered Member #1
Joined:
Location: Amerongen
Posts: 1228
I received the following e-mail from -b0Ss:

I am interested in providing an ip address displayed to the user when they join my site. Right now I am using a free gadget provided by Google to do so. The thing is that certain pop-up blocker and/or ip blockers block it from displaying to some people. So I decided to give ShowMyIP v1.1 a try.

The only thing is that it makes a new sitelink. Is there any way that you can convert this into a menu block or at least explain to me how to do it if it is an easy process? I tried copy and pasting the code from the .php into a custom menu and that didn't work. Any info on how to accomplish this would be highly appreciated. :)

-b0Ss
Back to top
Website
nlstart

Registered Member #1
Joined:
Location: Amerongen
Posts: 1228
You can use this easy alternative:
1. Admin area > Preferences > Text Rendering > set "Activate use of [php] bbcode:" to e.g. 'Main Admin';
2. Admin area > Custom menus/pages > Create menu
menu name: simple_ip
Title/caption: Your IP address
Text:
[php]global $e107; return $e107->getip();[/php]

3. Admin area > Menus > Select from the list of inactive Menus 'simple_ip' and assign it to a menu area of your choice.

Leave the admin page and voila! :)
Back to top
Website
b0Ss
Registered Member #345
Joined:
Location: Chapel Hill, NC, USA
Posts: 2
Hello nlstart,

Thank for providing a perfect solution to my problem. I do appreciate you posting my email here in the forum so others may benefit from it as well. Perhaps I should have wrote it here in the first place. That being said, I did not realize the '$e107->getip' code existed yet, as on the e107 wiki it is being listed as a 0.8 feature. Anyways, I tried it and it worked out perfectly, I even centered it and increased font size for better visibility. Thanks again!

-b0Ss
Back to top
Website
nlstart

Registered Member #1
Joined:
Location: Amerongen
Posts: 1228
You are welcome; a while after I published the plugin, the getip function has been implemented also in 0.7 branch, and it this function even supports ipv6; I doubt my plugin can... In other words: that function is even better than my plugin.
Happy to hear my solution provided works and you don't mind sharing it!
Back to top
Website
b0Ss
Registered Member #345
Joined:
Location: Chapel Hill, NC, USA
Posts: 2
nlstart wrote ...

Text:
[php]global $e107; return $e107->getip();[/php]



Ever since I upgraded to e107 v0.7.26 rc1, the output of the code provided now says 'No Longer Supported', as opposed to showing the IP address as normal. I did a quick search through the e107 forums and Google with no immediate results. I was just curious if you, or anyone for that matter :), have any idea on how to fix this or explain why it doesn't show the IP anymore. Otherwise, I will be forced to use a plugin or a code snippet like from Google's IP address widget, but I would rather do everything locally. It was so simple and working perfect before, why did it have to change... :|
Back to top
Website
nlstart

Registered Member #1
Joined:
Location: Amerongen
Posts: 1228
The BBcode has been removed; see http://wiki.e107.org/index.php?title=Release_Notes_0.7.26#BBCode.
You have the possibility to re-load the php bb-code from the previous release; thus accepting the risk.
Or, alternatively, create your own shortcode for rendering the ip address anywhere on your e107 site, and in a menu specifically; read more about that here: http://wiki.e107.org/index.php?title=Shortcodes:Themes.
Back to top
Website
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System