Custom Fields

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

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #125781

    Trevor
    Expired Member
    Post count: 58

    Is it possible to have a custom field (text) that is visible only in the backend “Add a Listing” not the frontend “Add a Listing” but for all role types not just administrator?

    #125793

    Guust
    Moderator
    Post count: 29970

    Only administrators can see the add-listing form in the backend, so that would never work?
    But you can have an admin only field that is not shown on the frontend, check the settings here:
    https://wpgeodirectory.com/docs/core-place-settings/#common

    #125799

    Trevor
    Expired Member
    Post count: 58

    That is not essentially true as an Editor and Author role can also see the add-listing form in the backend but not the custom field if it is set to “Admin only”. I would like them (Editor/Author) to be able to see the custom field as well but no one must see it on the frontend.

    Some of my users will be given these roles so that they can manage their listings but I do not want to give them the Administrator role as they could then cause unnecessary damage having access to all the backend functionality.

    #125801

    Trevor
    Expired Member
    Post count: 58

    Just to add to my previous post..

    This is required in order to keep private notes on each listing. The minimum of “Author” role is required to see these notes in the backend only.

    #125835

    Guust
    Moderator
    Post count: 29970

    My mistake, authors can add new listings in the backend, but cannot “see” admin only fields, and cannot edit other users’ listings.
    Editors can add and edit, but can never see admin only fields.

    I am not sure if “admin only” GD custom fields can be made to be “author and above only” fields and if so, how. I’ll escalate your question.

    #125884

    Trevor
    Expired Member
    Post count: 58

    geodirectory-functions/custom_fields_functions.php

    Change line 1239 from

    if ($for_admin_use && !is_super_admin()) {

    to

    if ($for_admin_use && !is_super_admin() && $current_user->ID == $post->post_author) {

    Would that work?

    #125903

    Paolo
    Site Admin
    Post count: 31206

    Nope, that’s the wrong place.

    Few lines below that you have

    if (is_admin()) {

    Probably changing that to:

    
    
    global $current_user;
    get_currentuserinfo();
    if (is_admin() || $current_user->ID == $post->post_author) {

    Will work, however I haven’t tested it and even if it works, you ‘ll lose this change after every update. Just FYI.

    This is considered a customization.

    Thanks

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
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount