{"id":5929066,"date":"2015-03-23T04:05:00","date_gmt":"2015-03-23T04:05:00","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/display-post-for-logged-in-user-only\/"},"modified":"2016-08-22T18:20:28","modified_gmt":"2016-08-22T18:20:28","slug":"display-post-for-logged-in-user-only","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/display-post-for-logged-in-user-only\/","title":{"rendered":"display post for logged in user only"},"content":{"rendered":"<p>HI<\/p>\n<p>Im trying to make what seems like a simple adjustment to a plugin im using, unfortunately im just a &#8216;wannabe programmer&#8217; and not the real deal so i wa shoping someone whom is a real programmer can help me out here. If you can help me i would be foreever grateful and even willing to pay a bit for someone to explain this process to me&#8230;&#8230; here goes:<\/p>\n<p>Im working with a plugin, it has a list of posts recently created and shows ALL posts no matter which user i login with&#8230; I would like to change this to show ONLY post by the user whom is logged in&#8230; Below si the current code<\/p>\n<p>&lt;?php<br \/>\n\t\t\tglobal $wpdb;<br \/>\n\t\t\t$current_time = current_time(&#8216;mysql&#8217;) + 60;<\/p>\n<p>\t\t\t$ereminder_array = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&#8220;<br \/>\n\t\t\t\t\t\t\tSELECT *<br \/>\n\t\t\t\t\t\t\tFROM {$wpdb-&gt;posts}<\/p>\n<p>\t\t\t\t\t\t\tWHERE post_date &lt;= %s<\/p>\n<p>\t\t\t\t\t\t\t\tAND post_type =&#8217;ereminder&#8217;<br \/>\n\t\t\t\t\t\t\t\tAND post_status = &#8216;draft&#8217;<br \/>\n                                                                AND author = &#8216;wp_current_user&#8217;<br \/>\n\t\t\t\t\t\t\tORDER BY post_date ASC<br \/>\n\t\t\t\t\t\t\t&#8220;, $current_time) );<br \/>\n\t\t\t$scheduled_data = array(<br \/>\n\t\t\t\t&#8216;list&#8217; =&gt; $ereminder_array,<br \/>\n\t\t\t\t&#8216;type&#8217; =&gt; &#8216;scheduled&#8217;<br \/>\n\t\t\t);<br \/>\n\t\t\techo PDER_Utils::get_view( &#8216;ereminder-list.php&#8217;, $scheduled_data );<br \/>\n\t\t?&gt;<\/p>\n<p>if anybody can tell me how to alter above code to show only post by the user that is logged in instead of all the users like it does now i would be forever grateful.<\/p>\n<p>thanks in advance<\/p>\n","protected":false},"template":"","class_list":["post-5929066","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5929066","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\/5929066\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5929066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}