Recent Topics

1 Dec 07, 2005 20:04    

Hey, i'm pretty sure this is the right forum to post htis in.

Is their a function or a variable that i can use in my skins/hax to find out if the user is the current blogs administrator.

I need this because in my recent skin it allows administrators to customize it, so the users see it the way the administrator wants.

Thanks
-balupton

2 Dec 07, 2005 21:34

if( is_logged_in() ) {
if( $current_User->get( 'ID' ) != 1 ) {
do a little dance, make a little love, get down tonight
}
}

Obvious but I'll state it anyway: if you're in the back office you don't need the first wee bit, otherwise first verify they've got an ID then see if it's number 1.

3 Dec 07, 2005 21:36

Alrite, I'll probz have the cms of the skin actually in the skin itself (i'll be seeing if i can get live previews working).

I thought that there could be multiple admins?
Or multiple people that can modify blogs, so wouldnt this only check to see if the user is the original admin?

Oh and u forgot you // on your comment ;) :P jks

4 Dec 07, 2005 22:03

Also had a real issue...

Test if the visitor is the admin (and technically there can be only one):

if( is_logged_in() ) {
if( $current_User->get( 'ID' ) == 1 ) {
$do_a_little_dance == true;
}
}

Or is the visitor a member of the admin group (which by design is group 1)?

if( is_logged_in() ) {
if( $current_User->Group->get( 'ID' ) == 1  ) {
$make_a_little_love == true;
}
}

Or perhaps the visitor is a member of group 1 or 2?

if( is_logged_in() ) {
if( $current_User->Group->get( 'ID' ) =< 2  ) {
$get_down_tonight == true;
}
}


This one is untested by me. Might need to use < 3 to get 1 and 2?

Much better to say "is the current user info equal to what I want" instead of "not equal to what I want" before deciding the world is a very nice place. Then again it depends on it's dependencies eh? I've had that error in a blog post since I don't know when because I didn't look at the date stamp on it. I suppose I should correct it, but then again I'd spend my whole life correcting mistakes made so far in it and probably make a few more which would require me to continue correcting blowouts after I croak, so what's the point?

5 Dec 07, 2005 22:12

I have no idea what ur last post is on about ;)
I'll use the 2nd example.

And for the 3rd example the statement:
if( $current_User->Group->get( 'ID' ) =< 2 ) {
Should be corrected to:
if( $current_User->Group->get( 'ID' ) <= 2 ) {
or
if( $current_User->Group->get( 'ID' ) < 3 ) {

I'm not asking you to correct it, im just pointing out your mistake, so you know what is correct (if you don't know already)

6 Dec 07, 2005 22:46

Whatever. Same as using slashslash eh? Totally trivial when one considers the nature of the question asked. Do you *really* need perfectly formed examples to get you moving forward? Some folk do and some folk don't. Generally it shows in their question. When it does I take the time to test. When I feel the asker already has half a clue I give them the other half just by typing in whatever it is that'll get them there.

So you're there eh? Rock on!

7 Dec 07, 2005 22:54

I was joking with the slashes, and for the second one it sounded like u havent used <= before, so i was pointing out how you would use it.
You took it the wrong way, i was trying to help, so sorry...

8 Dec 08, 2005 01:07

No worries. Twas poor code based on observing poor code in a blog post of mine. Originally in the blog post I had greater than 2, which was totally wrong, so I correct the bit that was wrong but not the (whatever it's called...) equalizer bit. I entered this thread with "is not equal to", which again was totally wrong. Anyway I usually test. Unless I don't!!!

No worries: code is life is good!


Form is loading...