Hooks needed – Custom Fields

This topic contains 6 replies, has 3 voices, and was last updated by  boxportable 9 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #18428

    boxportable
    Buyer
    Post count: 42

    I would like to request hooks to add custom fields for my directory listings.

    Currently have 2 custom fields I made by editing core files and having to do these updates after each update is a pain.

    Also if and when could I expect to see these hooks? Just so I know to hold off updating until that time or not.

    #18431

    boxportable
    Buyer
    Post count: 42

    also on the topic of hooks, any idea when some sort of documentation would be available on this topic (ie; list of available hooks)?

    I bought this plugin several months ago now and have yet to see any progress with documentation and having to search or ask on the forums every time I want to hook something is time consuming and to be honest a little annoying.

    Also just noticed the feature request bit to the right there, so this will only be implement if its in there and voted as popular? Because that kind of contradicts the bit about hooks and actions here:

    #18438

    Jeff
    Buyer
    Post count: 188

    Hey Boxportable, I just want to check in.

    Why do you need hooks for custom fields? GeoDirectory offers custom field management built-in for each post type (including the default places), and will automatically add them to the forms if you set the options.

    Additionally, there are functions (not hooks) that can be run one time (via a plugin or theme) to programmatically add them. I used this in my GT-Vouchers plugin.

    While I agree that more hooks/filters are needed, and a list would be nice, so far I’ve found the custom fields options built in to work quite well.

    #18480

    Paolo
    Site Admin
    Post count: 31206

    As Jeff said, there shouldn’t be any need for custom fields.

    In any case, we would need a through description of what you need in order to create any new hooks.

    Thx

    #19194

    boxportable
    Buyer
    Post count: 42

    Well this is all good to know perhaps if the documentation wasn’t so barren I would of known this :/ but based on what your saying its still not what I want.

    The code I added is custom HTML / Javascript for opening hours and also a bit for extra listing images using the wordpress built in media browser instead of the one that comes with geodirectory as standard which seems to be just a simple browse for file popup window.

    I had to add code into the following files;

    – Admin_hooks_actions.php (declare the 2 fields for them to appear as drag / drop items)
    – Custom_field_html.php (added them to the switch in here, needed to but nothing under them as code)
    – Custom_fields_functions.php (the actual code and some script file hooks for what would render when in the add/edit listing page)

    Each time I update I need to go and update all these files which is somewhat annoying.

    Not sure what you mean by (again documentation isn’t very populated):
    “Additionally, there are functions (not hooks) that can be run one time (via a plugin or theme) to programmatically add them. I used this in my GT-Vouchers plugin.”

    #19233

    Jeff
    Buyer
    Post count: 188

    For your last point, there’s a function called

    geodir_custom_field_save() in custom_fields_functions that you can run on the activation hook. It will permanently save your custom fields.

    The structure of it’s array can be see in geodir_create_default_fields() in admin_db_install.php

    Drop me an email at jeff at jeffrose dot ca if you need some help.

    I’ve said before, the hooks & filters are not everywhere I want them yet, but for the most part I haven’t had to hack core. Except for overriding a template, but that’s built in too.

    #19420

    boxportable
    Buyer
    Post count: 42

    Ah Jeff that sounds good and something I will definitely look into thanks for the help I appreciate it.

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket