« first day (2220 days earlier)   

2:09 AM
[ SmokeDetector ] Possible low-quality post: Different of "simple tense" and "compound sentence" by Dinda Yufhanda on english.stackexchange.com
 
 
2 hours later…
4:00 AM
<is coding in PHP> Why?
 
@tchrist Haha, aww.
Is it that bad?
It's hard for me to compare.
Meanwhile, I managed to do what I wanted, but now I want to write it properly.
> if ( in_array( 'subscriber', (array) $current_user->roles )||in_array( 'contributor', (array) $current_user->roles )||in_array( 'administrator', (array) $current_user->roles ) ) {
echo implode(', ', $current_user->roles) . "\n";
}
This works, but it looks terrible.
Now I'm trying to intersect arrays, or something.
 
4:16 AM
@Cerberus You're complaining that php looks horrible?
 
Heh.
I'm complaining because I have to do the same thing thrice.
 
As well you should.
 
I'd rather test for all three user roles in one "in_array" action.
 
It's a code smell.
 
It's my own code, so it is I who am to blame, not the language...
 
4:17 AM
But please don't ask me what to do about it. There I do not go.
 
Don't worry.
The code works as it is; I don't really need it to look proper.
Ah, I've solved it.
I probably forgot some semicolon.
 
Oh?
 
> if (array_intersect(array ('subscriber', 'contributor', 'administrator'), $current_user->roles) ) {
echo "Access granted.";
}
Else {
echo "Denied.";
}
 
Yay you.
 
Yay, indeed.
 
 
6 hours later…
10:51 AM
hi sir
 
 
2 hours later…
12:29 PM
@Cerberus noöne knows.
 

« first day (2220 days earlier)