Title: PHP Guru&#8217;s Help Needed.
Last modified: August 19, 2016

---

# PHP Guru’s Help Needed.

 *  Resolved [trivum](https://wordpress.org/support/users/trivum/)
 * (@trivum)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/)
 * I recently made a hack into the wp-admin/edit.php file so that when users (authors/
   contributors/etc.) were in their backend and managing their posts, they only 
   saw the posts they had made, not everyone esle’s.
 * I found this line:
 * _wp(“what\_to\_show=posts$post\_status\_q&posts\_per\_page=15&order=$order&orderby
   =$orderby”);_
 * and replaced it with the following:
 * _$thisauthor=”;
    if (!current\_user\_can(‘edit\_others\_posts’)) $thisauthor 
   = ‘&author=’ . $user\_ID; wp(‘what\_to\_show=posts&posts\_per\_page&=15&order
   =$order&orderby=$orderby’ . $thisauthor);
 * That did the trick. But now when I use the filter post option (pending review,
   published, any), it doesn’t work.
 * Any idea how I can get both functions to work?
 * Thanks for any suggestions.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [trivum](https://wordpress.org/support/users/trivum/)
 * (@trivum)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684300)
 * Anyone with ideas for this? Thanks.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684317)
 * Why did you remove the `$post_status_q` variable from the call to the wp() function?
 * Try adding it back.
 *  Thread Starter [trivum](https://wordpress.org/support/users/trivum/)
 * (@trivum)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684320)
 * _Why did you remove the $post\_status\_q variable from the call to the wp() function?_
 * Try adding it back.
 * I did try that before, but maybe I’m not getting the right syntax or something.
   I tried it in a few different spots.
 * Any suggestions for how it might go?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684324)
 * Exactly the same as you have it in your post above:
 * `wp("what_to_show=posts$post_status_q&posts_per_page...`
 * The double quotes around that string are key here. You can’t use single quotes
   like you do in your second example. Whenever you’re using $variables inside a
   string, it must be double quoted.
 *  Thread Starter [trivum](https://wordpress.org/support/users/trivum/)
 * (@trivum)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684341)
 * Thanks for the suggestion, but it still doesn’t seem to quite be working. Maybe
   I’m still doing something wrong. Per your suggestions, this is what I’m putting
   in:
 *     ```
       $thisauthor='';
       if (!current_user_can('edit_others_posts'))
       $thisauthor = '&author=' . $user_ID;
       wp("what_to_show=posts&post_status_q&posts_per_page&=15&order=$order&orderby=$orderby" . $thisauthor);
       ```
   
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684343)
 * Still not right. Compare Otto’s line to yours:
 * `$post_status_q`
 * vs.
 * `&post_status_q`
 * Use the dollar sign (making it a PHP variable), not the ampersand, to prefix `
   post_status_q`.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684350)
 * Yep. What’s more, your code is overkill. Eliminate all that extra variable and
   concatenation work.
 * Edit: Removed non-working code. I guess I’m confused about what you were trying
   to do in the first place.
 *  Thread Starter [trivum](https://wordpress.org/support/users/trivum/)
 * (@trivum)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684355)
 * Great! Excellent! Everything seems to work – I put in the $ instead of the &.
   Not knowing php, I didn’t even notice at first.
 * Otto – your more streamlined code didn’t seem to work for me. I wasn’t able to
   see any posts under Manage when I tried it, but maybe it was just how my particular
   system was interacting with it.
 * By the way, if either of you have any say-so about the core code, I would suggest
   adding this. I think it would help a lot if the users that are contributing to
   the blog don’t have to wade through everyone else’s posts in their Manage section.
   It makes it much more user-friendly. I can also see situations (such as mine)
   where the Administrator wants the contributors to feel they have their own personal
   backend section.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP Guru’s Help Needed.’ is closed to new replies.

## Tags

 * [author](https://wordpress.org/support/topic-tag/author/)
 * [filter posts](https://wordpress.org/support/topic-tag/filter-posts/)
 * [pending review](https://wordpress.org/support/topic-tag/pending-review/)
 * [published](https://wordpress.org/support/topic-tag/published/)

 * 8 replies
 * 3 participants
 * Last reply from: [trivum](https://wordpress.org/support/users/trivum/)
 * Last activity: [18 years, 4 months ago](https://wordpress.org/support/topic/php-gurus-help-needed/#post-684355)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
