• Resolved alexzaragoza21

    (@alexzaragoza21)


    Hello Great GD Team,

    I really love your plugin. Really the best among all the listing plugins here in wordpress.

    However, I was just wondering regarding your “admin only edit checkbox” in listing form field.

    Whenever I check this, admin can only edit a particular field. How about if I want the editor role to be included in this function? So far editors can’t see what admins can only edit.

    In my case, I want to deligate the admin only edit function to editor role as well. Do you think that is possible? Thank you so much.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Paolo

    (@paoltaia)

    hi @alexzaragoza21,

    I’m sorry for the late reply and also to tell you that’s not possible out of the box.

    I asked to the developers if a plugin like the user role editor could help with this. We will let you know asap.

    Thanks for your patience ??

    Thread Starter alexzaragoza21

    (@alexzaragoza21)

    I really appreciate your help. Please let me know if this is possible. Hope there is a way.

    My client wants to delegate tasks to his editor and he doesn’t want to just give an admin account.

    More power to your team! Thank you so much. ??

    Plugin Author Paolo

    (@paoltaia)

    Hi Alex,

    with the current version, it is not possible.

    That said, we added a hook that will be available from the next update. A code snippet will make it possible to enable other roles to edit those fields.

    This would be an example of the code needed for fields “for_staff” & “covid_note” for the editor role:

    /**
     * Extend "Admin Only" field edit to user with Editor role.
     */
    function gd_snippet_add_listing_custom_field_is_hidden( $is_hidden, $field, $package_id, $default ) {
    	if ( $is_hidden && ! empty( $field['for_admin_use'] ) && is_user_logged_in() && ( $roles = (array) wp_get_current_user()->roles ) ) {
    		if ( in_array( 'editor', $roles ) && in_array( $field['name'], array( 'for_staff', 'covid_note' ) ) ) {
    			$is_hidden = false;
    		}
    	}
    	return $is_hidden;
    }
    add_filter( 'geodir_add_listing_custom_field_is_hidden', 'gd_snippet_add_listing_custom_field_is_hidden', 11, 4 );

    If you wish, you can test this by downloading the development version of the plugin from Github.

    Let us know how it goes.

    • This reply was modified 3 years, 8 months ago by Paolo.
    Thread Starter alexzaragoza21

    (@alexzaragoza21)

    This is great! Thank you so much! ??

    Plugin Author Paolo

    (@paoltaia)

    You are welcome, if you are enjoying GeoDirectory and the service we provide, please consider posting a review… Thanks!

    Thread Starter alexzaragoza21

    (@alexzaragoza21)

    I did a review and I am really thankful I found your plugin. I hope your next update will happen this month?

    Thank you so much. ??

    Plugin Author Paolo

    (@paoltaia)

    Most likely yes.

    Thanks for the review!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to add Editor role to “Admin only edit function”’ is closed to new replies.