PDA

View Full Version : EDIT button on public site - Easy Edits by IP Address


richm
11-11-2005, 08:21 PM
I am following up from a request in General Discussion for an Easy way to edit links while viewing the public site. Rather than put a login-in on the public site, my approach is to place an EDIT button on each link as long as the user is accessing the site from an "Editor" IP address.

The mod below creates a field for setting up this approved IP address, and adds an EDIT button to each link. This would still require a one-time login once the EDIT button is pressed, but you could continue to edit once you are logged in.

I am new to PHP and to this directory, and I have not tested this. This is being offered for discussion and feedback. Also, I have some questions below, but this is a start.

Content visible to registered users only.

Known problems:

1. IP Lookup
I imagine that the get_client_id() function is slow, and that it should be run once and stored in a variable, rather than run for every link that is displayed. However, I am not really certain where this should be done.

2. Returning to Directory after FIRST Edit
When I tested this earlier, I recall that there was some sort of problem returning to the directory after the FIRST edit (after having to login). I recall having to press the back key to get back. After login, however, it returned to the directory just fine.

Any ideas or feedback?

Ap0s7le
11-12-2005, 05:33 PM
I've done this already, but it's at home at the moment and I'm 11 hours away.

After a Admin logs in, he can then surf the directory and use all the pages anywhere links are shown with Edit / Delete / Remove (Remove simply hides it, but keeps the data) next to them. Even when Searching.

later

-Casey

richm
11-12-2005, 06:43 PM
Thanks! I look forward to seeing how you did it. I agree that it would be superior, but I couldn't really see how to do it. Ideally, when looking at the directory, it would be nice to login in a different window, and then go back and hit refresh and have access to a login. Does that work on your system?

David
11-12-2005, 08:05 PM
Now that's the way to release a mod! 8)