Click here to Skip to main content
14,549,443 members

Web Development

 
PinnedHow to get an answer to your question Pin
Chris Maunder4-Sep-10 2:25
cofounderChris Maunder4-Sep-10 2:25 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:40
cofounderChris Maunder12-Jul-09 22:40 
QuestionMessage Closed Pin
20hrs 27mins ago
MemberLily Loo20hrs 27mins ago 
QuestionMessage Closed Pin
3-Jun-20 18:47
MemberTosca Klasen3-Jun-20 18:47 
QuestionGoogle SignIn and regular account, using the same email Pin
jkirkerx2-Jun-20 12:53
professionaljkirkerx2-Jun-20 12:53 
QuestionMessage Closed Pin
20-May-20 20:45
MemberMember 1192862820-May-20 20:45 
QuestionWhere can passwords for webpages be stored, except in browser itself and Credentials Manager? Pin
arnold_w18-May-20 21:23
Memberarnold_w18-May-20 21:23 
AnswerRe: Where can passwords for webpages be stored, except in browser itself and Credentials Manager? Pin
Richard Deeming19-May-20 0:22
mveRichard Deeming19-May-20 0:22 
GeneralRe: Where can passwords for webpages be stored, except in browser itself and Credentials Manager? Pin
arnold_w19-May-20 9:16
Memberarnold_w19-May-20 9:16 
GeneralRe: Where can passwords for webpages be stored, except in browser itself and Credentials Manager? Pin
Richard Deeming19-May-20 9:25
mveRichard Deeming19-May-20 9:25 
QuestionPHP: Filtering a Wordpress admin post list by role Pin
TectonicEng17-May-20 4:30
MemberTectonicEng17-May-20 4:30 
I'm working on a filter for a Custom Post Type . I need it to filter the list depending on the user's role. The way this should work is the following...

- Users in roles "formusers1" and "formusers2" can post. Users can only see their own posts.
- Users in role "formchecker1" can see all posts assigned role "formusers1' and can approve each post.
- Users in role "formchecker2" can see all posts assigned role "formusers2' and can approve each post.
- Users in roles "formsupervisor" and "administrator" can see everyone's posts.

So far I can filter by roles "formusers1" and "formusers2" using:
$query->set('author', $current_user->ID);
However, when try to filter the list for role "formchecker1" I see posts from all roles. What am I doing wrong? Here's the rest of the code. Thanks for checking out!

add_action('pre_get_posts', 'filter_posts_list');<br />
<br />
function filter_posts_list($query) {<br />
    //GLOBAL VARIABLES<br />
    global $pagenow, $typenow;<br />
<br />
    //MY VARIABLES<br />
    global $current_user;<br />
    get_currentuserinfo();<br />
<br />
    //FILTERING<br />
    if (current_user_can('formchecker1') && ('edit.php' == $pagenow) &&  $typenow == 'mycustomcpt' ) {<br />
        $query->set('author', 'formusers1');<br />
    }<br />
<br />
    if (current_user_can('formchecker2') && ('edit.php' == $pagenow) &&  $typenow == 'mycustomcpt' ) {<br />
        $query->set('author', 'formusers2');<br />
    }<br />
<br />
    if ((current_user_can('formusers1') || current_user_can('formusers2')) && ('edit.php' == $pagenow) &&  $typenow == 'mycustomcpt') {<br />
        $query->set('author', $current_user->ID);<br />
    }<br />
}

SuggestionRe: PHP: Filtering a Wordpress admin post list by role Pin
Richard MacCutchan17-May-20 5:44
mveRichard MacCutchan17-May-20 5:44 
QuestionPowershell timer question Pin
Member 144746071-May-20 10:31
MemberMember 144746071-May-20 10:31 
QuestionWeb API Design Question Pin
Kevin Marois30-Apr-20 8:33
professionalKevin Marois30-Apr-20 8:33 
AnswerMessage Closed Pin
14-May-20 21:56
MemberIvan Puvko14-May-20 21:56 
Questionweb creation Pin
Member 1480564017-Apr-20 22:01
MemberMember 1480564017-Apr-20 22:01 
AnswerRe: web creation Pin
OriginalGriff17-Apr-20 22:13
mveOriginalGriff17-Apr-20 22:13 
AnswerRe: web creation Pin
ZurdoDev30-Apr-20 9:29
mveZurdoDev30-Apr-20 9:29 
AnswerRe: web creation Pin
Eddy Vluggen30-Apr-20 12:28
professionalEddy Vluggen30-Apr-20 12:28 
Questionmigrations errors in Django web Pin
Mohammad Shafique13-Apr-20 13:32
MemberMohammad Shafique13-Apr-20 13:32 
AnswerRe: migrations errors in Django web Pin
Richard MacCutchan13-Apr-20 21:03
mveRichard MacCutchan13-Apr-20 21:03 
AnswerRe: migrations errors in Django web Pin
ZurdoDev30-Apr-20 10:42
mveZurdoDev30-Apr-20 10:42 
QuestionI am looking for School student_result_management Pin
Member 1480089113-Apr-20 7:47
MemberMember 1480089113-Apr-20 7:47 
AnswerRe: I am looking for School student_result_management Pin
Mycroft Holmes13-Apr-20 12:45
professionalMycroft Holmes13-Apr-20 12:45 
GeneralRe: I am looking for School student_result_management Pin
Member 1483624120-May-20 3:35
MemberMember 1483624120-May-20 3:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.