{"id":18876375,"date":"2026-04-09T16:39:41","date_gmt":"2026-04-09T16:39:41","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/access-of-custom-roles-to-the-log-in-front-end\/"},"modified":"2026-04-09T16:39:41","modified_gmt":"2026-04-09T16:39:41","slug":"access-of-custom-roles-to-the-log-in-front-end","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/access-of-custom-roles-to-the-log-in-front-end\/","title":{"rendered":"Access of custom roles to the log in front-end"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Please tell me how, in the example from the plugin documentation, to allow access to logs on the frontend for roles other than administrator. I tried using the <code>simple_history\/view_history_capability<\/code> filter &#8211; it doesn&#8217;t work. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Can you tell me what I&#8217;m doing wrong? In the page template, I call the <code>simple_history_user_action_output($paged)<\/code> function and get zero entries, although they actually exist if you give the user the administrator role.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter( 'simple_history\/view_history_capability', function( $capability ) {<br \/>$capability = 'view_fileinput'; <br \/>return $capability;<br \/>} );<br \/><br \/>function simple_history_user_action_output($paged) {<br \/>$log_query = new \\Simple_History\\Log_Query;<br \/>$simple_history = \\Simple_History\\Simple_History::get_instance();<br \/><br \/>$current_user = wp_get_current_user();<br \/>$user_id = $current_user -&gt; ID;<br \/><br \/>$query_results = $log_query-&gt;query( &#091;<br \/>    'posts_per_page' =&gt; 5,<br \/>    'user' =&gt; $user_id,<br \/>    'loggers' =&gt; &#091;'SimplePostLogger', 'SimpleUserLogger', 'SimpleLogger'],<br \/>    'paged' =&gt; $paged<br \/>] );<br \/><br \/>printf(<br \/>    '<br \/>        &lt;p&gt;\u041d\u0430\u0439\u0434\u0435\u043d\u043e %1$d \u0441\u0442\u0440\u043e\u043a(\u0438).&lt;\/p&gt;<br \/>        &lt;p&gt;\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 %2$d \u0438\u0437 %3$d.&lt;\/p&gt;<br \/>    ',<br \/>    esc_html( $query_results&#091;'total_row_count'] ),<br \/>    esc_html( $query_results&#091;'page_current'] ),<br \/>    esc_html( $query_results&#091;'pages_count'] )<br \/>);<br \/><br \/>echo \"&lt;ul&gt;\";<br \/><br \/>foreach ( $query_results&#091;'log_rows'] as $row ) {<br \/>    $header_output = $simple_history-&gt;getLogRowHeaderOutput( $row );<br \/>    $text_output = $simple_history-&gt;getLogRowPlainTextOutput( $row );<br \/>    $details_output = $simple_history-&gt;getLogRowDetailsOutput( $row );<br \/><br \/>    echo \"&lt;li&gt;\";<br \/>    echo \"&lt;hr \/&gt;\";<br \/>    echo \"&lt;p&gt;{$header_output}&lt;\/p&gt;\";<br \/>    echo \"&lt;p&gt;{$text_output}&lt;\/p&gt;\";<br \/>    echo \"&lt;p&gt;{$details_output}&lt;\/p&gt;\";<br \/>    echo \"&lt;\/li&gt;\";<br \/>}<br \/><br \/>echo \"&lt;\/ul&gt;\";<br \/>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"template":"","class_list":["post-18876375","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18876375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18876375\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18876375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}