Please Note: We are no longer using forums to facilitate standard support. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Converting category post field to hidden

  1. psm9640
    Member

    Hey guys,

    I have a wordpress install I'm working on that's basically being used as a glorified forum. I want to convert the post category drop-down to a hidden field (I'm only allowing one category to be posted to for easy admin'ing). After an hour of messing around with the pre_render I'm at a loss. Any direction would be greatly appreciated!

    -Peter

    Posted 4 years ago on Tuesday March 1, 2011 | Permalink
  2. psm9640
    Member

    Think I got it... finally...

    foreach($form["fields"] as &$field)
            if($field["id"] == 3){
                $field["type"] = "hidden";
                $field["value"] = "5"; //category_id
            }

    Update: well thought I had it... it's being converted to a hidden field just fine but I'm getting nothing for value.

    Posted 4 years ago on Tuesday March 1, 2011 | Permalink
  3. If you install the latest development release of Gravity Forms v1.5 which is available on the Downloads page you can use the Post Category field, select a specific Category and then go to the Advanced tab and set the Visibility to Admin Only. This will effectively make that Post Category field hidden on the frontend while still storing the category you selected.

    Posted 4 years ago on Tuesday March 1, 2011 | Permalink
  4. psm9640
    Member

    Just did that, and when I try to edit the Post Category field, I get the following jscript error in Firebug:

    Error: Currency is not defined
    Source File: http://www.mysite.com/fa-forum/wp-admin/admin.php?page=gf_edit_forms&id=1
    Line: 1406
    Posted 4 years ago on Wednesday March 2, 2011 | Permalink
  5. I have a similar problem; I have created two category fields, one for the parent, one for selecting the child category; I set the parent to "admin only" and selected the parent but when the post is created via the submission of the form, only the child is selected. Why is this not working? Form is at mgam.dreamhosters.com/add-artist. I've also noticed that no slug is created for the post when the post is created (in draft mode). Is this a bug or isn't slug created til post is published?

    Posted 4 years ago on Wednesday March 2, 2011 | Permalink
  6. @psm9640 Can you send us a WordPress admin login via our Contact Us form for this site and instructions on how we can recreate this issue so we can see the error happen? It will make it easier for us to debug it.

    @vizou It depends on what version of Gravity Forms you are using. Setting a Post Category field to visibility admin only works in the current development release of v1.5 but I don't believe it works in earlier versions of the plugin.

    Posted 4 years ago on Wednesday March 2, 2011 | Permalink
  7. Thanks for the quick reply; I am using 1.4.5 which is not showing as "updatable" in my admin... is 1.5 a beta? I thought GF was updatable thru the admin??

    Posted 4 years ago on Wednesday March 2, 2011 | Permalink
  8. 1.5 is a development release, it isn't available via automatic upgrade. You would have to download it via the Downloads page and manually install it via FTP or by deleting your existing plugin and using the built in WordPress plugin uploader.

    Posted 4 years ago on Wednesday March 2, 2011 | Permalink
  9. psm9640
    Member

    Hey Carl,

    I sent the login info but neglected to send instructions of what was happening... in the form admin (there should only be 1 form), after adding a post category to the form, if I click "edit" for that form field, I get the error. Sorry I didn't include this in my email. Thanks again.

    Posted 4 years ago on Thursday March 3, 2011 | Permalink

 

Support Tickets

Open A New Support Ticket
 Open A New Priority Support Ticket *

* Developer license holders only