If <first post> and user id = <id>

Started by Mayhem30, July 19, 2011, 06:13:25 PM

Previous topic - Next topic

Mayhem30

I've been working on a small little project - and was wondering if someone could help me with the last part.

I only want my code snippet to show if :

1) it's the first post in a thread
2) User id = 6 (me)

SMF 1.1.14 (2.0 example would be great as well)

Thank you.

Matthew K.

if ($message['id'] == $context['first_message'] && $context['user']['id'] === 6)


Matthew K.

Not a problem, good luck with your project :) Thanks for marking the topic resolved, by the way

Mayhem30

The code bit only shows if I'm logged in (won't display code to guests or other users).

How would I fix this?

ascaland

If you want it so everyone can see it and its the first message, then use this if statement,
if ($message['id'] == $context['first_message'])

cicka

Quote from: Mayhem30 on July 26, 2011, 02:04:03 AM
The code bit only shows if I'm logged in (won't display code to guests or other users).

How would I fix this?

In your first post you wanted the code to show only to your user id and it's the first post in a thread. And that is exactly what the code posted above by Labradoodle-360 does.

Now you are asking something different. It would help if you were more precise in what you wanted :)

Mayhem30

Sorry, I didn't explain myself clearly in my first post.

What I want to do is add some custom links (and other stuff) under my avatar - but I only want the stuff to show if it's the first post in a thread - and only on my profile (but I would like it to be visible to everyone).


Matthew K.

This is definitely possible, right now, I am on a trip, and when I get back, I'll post the code for you.

Joker™

Try this

if ($message['id'] == $context['first_message'] && $message['member']['id'] == 1)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Advertisement: