Support » Plugin: Gravity Forms Directory » [Plugin: Gravity Forms Directory & Addons] How user can see his/her posts only through this plug

  • Resolved masterwoo

    (@masterwoo)


    What I want is that user once logged into my site should be able to see just his/her posts from his/her dashboard. The default role of user on website is “subscriber”. Currently this plugin displays all entries in gravity form to everyone.

    I just want that user should only be able to see only his/her entries on the page.

    http://wordpress.org/extend/plugins/gravity-forms-addons/

Viewing 7 replies - 1 through 7 (of 7 total)
  • I had this problem myself. Just found the solution. Unfortunately I couldn’t find a hook that could filter the entries so I had to insert is in the gravity-forms-addons.php:

    //
    // Or start to generate the directory
    //
    // Hack: added filter kws_gf_directory_lead_filter
    $leads = apply_filters('kws_gf_directory_lead_filter', GFDirectory::get_leads($form_id, $sort_field, $sort_direction, $search_query, $first_item_index, $page_size, $star, $read, $is_numeric, $start_date, $end_date, 'active', $approvedcolumn));

    I added the filter around GFDirectory::get_leads
    at about line number 1040

    then I added this code to my functions

    //Show entries of user logged in only
    
    add_filter('kws_gf_directory_lead_filter','show_user_entries');
    
    function current_user($content) {
    $current_user = wp_get_current_user();
    	return ( $current_user->ID == $content["created_by"]) ;
    }
    
    function show_user_entries($leads) {
    	return array_filter($leads, 'current_user');
    }

    I’m still very new to writing php. If someone knows a better solution..
    Hope it helps

    Plugin Author Zack Katz

    (@katzwebdesign)

    @benjamingaier – Thanks for the solution. I’ll add a filter to get_leads() with the same name in the next update, coming this week.

    Where does this display at? in the back-end? Is there a way to attach it to profile in the fron-tend via custom link?

    Plugin Author Zack Katz

    (@katzwebdesign)

    That would take custom development.

    What kind of development would this take and what kind of rate?

    Thanks a ton benjamingaier… I’ll try this … thanks once again

    You can now activate this functionality in the settings of the plugin under:
    Display entries only the the creator of the entry (users will not see other people’s entries).

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Gravity Forms Directory & Addons] How user can see his/her posts only through this plug’ is closed to new replies.