How to record IP Address to field

More
11 years 4 months ago #44650 by bunnachart
Please suggestion how to record IP Address user to field.

Best Regards

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #44657 by ggppdk
Hello

-1- duplicate a FLEXIcontent 'text' field and create a new field type called 'userip'
UPDATED (more detailed instructions):
How to Duplicate a FLEXIcontent Field to create a new Field Type

-2- replace function onBeforeSaveField()

with:
Code:
function onBeforeSaveField( &$field, &$post, &$file, &$item ) { // execute the code only if the field type match the plugin type if ( !in_array($field->field_type, self::$field_types) ) return; if ( !is_array($post) && !strlen($post) ) return; $editor_ip = $_SERVER['REMOTE_ADDR']; $post = array(0=> ); }

3. Use this onDisplayFieldValue()
Code:
function onDisplayFieldValue(&$field, $item, $values=null, $prop='display') { // execute the code only if the field type match the plugin type if ( !in_array($field->field_type, self::$field_types) ) return; $field->label = JText::_($field->label); $field->prop = "Automatic"; }



4. Create a new field and assign it to your content type

5. You may also set field to be hidden in item form


NOTE: i have not tested the above, please correct any mistakes that i have made ...


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #44663 by bunnachart
Thank you very very much. I have to try. But now on the way. Best regards

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #44673 by bunnachart

bunnachart wrote: Thank you very very much. I have to try. But now on the way. Best regards


I try but can't do it.

Sorry i wait for if you have next version. Thank you very much.

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #44676 by kenmcd
I decided to take a look at creating the User IP field plug-in – and it is not easy to modify the text plug-in to do this. Too much other stuff needs to be removed to make a simple field plug-in.

If you can wait a few days, I think we can have a working User IP plug-in.

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #44678 by ggppdk

bunnachart wrote:

bunnachart wrote: Thank you very very much. I have to try. But now on the way. Best regards


I try but can't do it.

Sorry i wait for if you have next version. Thank you very much.


Hello,
i did not say that it will be added to next version, but Kenmcd (above)
said that he may have time to do it

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.475 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save