Support » Plugin: Gravity Forms Sticky List » Entries that both admins and entry creators can view
Entries that both admins and entry creators can view
-
Has anyone figured out how to create a list that both admins and entry creators can view?
More specifically, admins can see all submissions from all members, while entry creates can only see their submissions. Thanks.
-
Solved. In plugin file
class-sticky-list.php
, around like 318 (// Get entries to show depending on settings
), hide that whole if statement and replace with:$user = wp_get_current_user(); if(is_user_logged_in()) { $user = wp_get_current_user(); if($user && !in_array( "administrator", (array) $user->roles )) { $search_criteria["field_filters"][] = array("key" => "status", "value" => "active"); $search_criteria["field_filters"][] = array("key" => "created_by", "value" => $current_user_id); } if (in_array( "administrator", (array) $user->roles )) { $search_criteria["field_filters"][] = array("key" => "status", "value" => "active"); } $entries = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging); }
Hi thanks a lot for this,
I need to allow admins and also EDITORS to be able to view entries.
Any ideas?
Waiting on your answer.
Thanks in advance.
Maybe change line to:
if (in_array( "administrator", (array) $user->roles ) || in_array( "editor", (array) $user->roles )) {
Might be
editors
– no ideaThanks mate!
It work?
Hi, more or less. I´m using this and it seems to work:
if(is_user_logged_in()) { $user = wp_get_current_user(); if (($user) && (!in_array( “administrator”, (array) $user->roles )) && (!in_array( “editor”, (array) $user->roles ))) { $search_criteria[“field_filters”][] = array(“key” => “status”, “value” => “active”); $search_criteria[“field_filters”][] = array(“key” => “created_by”, “value” => $current_user_id); } if (in_array( “administrator”, (array) $user->roles )) { $search_criteria[“field_filters”][] = array(“key” => “status”, “value” => “active”); } if (in_array( “editor”, (array) $user->roles )) { $search_criteria[“field_filters”][] = array(“key” => “status”, “value” => “active”); } $entries = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging); } By the way, perhaps you can help me this other issue. I want to show featured image on list but I don´t know where to place this code and how. Any ideas? jQuery(document).ready(function($) { cell = $(‘.stickylist-fileupload a’); cell.each(function(index) { image = $(this).attr(‘href’); $(this).html(‘‘); }); });
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
Thanks again, mate.
- This reply was modified 7 years ago by bdbrown.
In your child theme create a /js/ folder and create a .js file; copy the jquery code into that file. In your
functions.php
file copy this function if it’s not there already and replace the name of the .js file to whatever you named it. That will load the script into the footer of your site.It worked!! I only had to change the class for this one .stickylist-post_image. THANKS
One more question, for the first change (Entries that both admins and entry creators can view) is it possible to do it in an overrite file in child theme? I don´t like at all to modify plugin files…
Thanks again.
Unfortunately I don’t know.
Thanks anyway, my friend. You have helped me a lot!!
Hi @navyspitfire, you are my only help in this forum…
I have moved my wordpress to a subfolder and now EDIT option in stickylist is not working anymore… It still tries to call the old article in the root.
Any ideas?
Thanks a lot.
No idea. Recreate everything?
You might check the list here to make sure you didn’t miss any steps:
https://codex.wordpress.org/Moving_WordPressThanks friends.
Sticky List setting had lost the page to be shown, it is working now.
Thanks a million
- The topic ‘Entries that both admins and entry creators can view’ is closed to new replies.