SimplePortal

Social => General Discussion => Topic started by: johncccccc on June 22, 2010, 05:38:32 PM

Title: Something I need a little help with... $memberContext
Post by: johncccccc on June 22, 2010, 05:38:32 PM
Hi,

Im trying to make a mod, but having a slight issue

I'm still learning PHP and SMFs layouts, so bear with me, please lol.

OK, without giving away the idea of my mod...

What makes the "Modify Message" link appear to only the member who posted the message?

I have been looking relentlessly and hardly found a thing. So far I have gathered its something to do with $memberContext + [$message['id_member'], but other than that I'm baffled.

Thanks for any help.
Title: Re: Something I need a little help with... $memberContext
Post by: Nathaniel on June 22, 2010, 10:06:16 PM
As long as you are adding code where the $message variable is defined (within the message display loop of the Display.template.php file), you can use the "$message['can_modify']" variable, which will be set to true if they can modifiy that post, false if otherwise. That link actually appears to moderators and admin, not just the origional poster.
Title: Re: Something I need a little help with... $memberContext
Post by: johncccccc on June 23, 2010, 03:46:04 PM
OK thanks for the information..

What about if I were adding something after the signature, for that message?

would $message still be defined there?
Title: Re: Something I need a little help with... $memberContext
Post by: Nathaniel on June 23, 2010, 09:51:25 PM
Yes. That should work fine.
Title: Re: Something I need a little help with... $memberContext
Post by: johncccccc on June 24, 2010, 04:15:25 PM
OK
Thanks for that information, saved me some time there.

So how exactly is the syntax to let a member (who made that post) see the object I want to add.

$message['what_goes_here'][are_there_anymore_required']
Title: Re: Something I need a little help with... $memberContext
Post by: ccbtimewiz on June 24, 2010, 06:47:10 PM
$message['member']['reference_to_your_permission']

Object-oriented programming isn't supported by SMF.
Title: Re: Something I need a little help with... $memberContext
Post by: johncccccc on June 24, 2010, 08:08:22 PM
I got it working as follows:

Code: [Select]
                if ($message['can_modify'])
            echo 'MY stuff here ', then maybe some more PHP here , '';

Works fine, thanks for the help, its for a mod I'm currently working on :)
Title: Re: Something I need a little help with... $memberContext
Post by: ccbtimewiz on June 24, 2010, 08:16:26 PM
Great. If you need any further assistance feel free to ask.
Title: Re: Something I need a little help with... $memberContext
Post by: johncccccc on June 24, 2010, 08:32:57 PM
Oh, more than likely I probably will.

Thanks
Title: Re: Something I need a little help with... $memberContext
Post by: MultiformeIngegno on June 30, 2010, 10:33:12 AM
What mod is it? I'm curious..! :P
Title: Re: Something I need a little help with... $memberContext
Post by: johncccccc on June 30, 2010, 11:51:19 PM
What mod is it? I'm curious..! :P

Well, I don't really want to disclose, you know, since I'm not as good at coding as many and my idea could easily get taken and packaged by a better coder, because I'm still coding for a long time to get my mod going,

Nevertheless, I think many will find this simple feature addition very useful, especially if you code a lot and like to announce process of certain things there up to.
SimplePortal 2.3.8 © 2008-2024, SimplePortal