Jump to content

What was that now.....


Guest .KX

Recommended Posts

I can remember seeing a post made by a member of the IPS staff. It was saying something about the group colouring (prefix and suffix). They stated that you can replace any instance of a code which shows a members name with something else; resulting in the name being coloured. I remember that this would mean we could make the prefix and suffix work anywhere without file edits.

What was the damn thing?

Link to comment
Share on other sites

The first method works for just the active member, the second works for some other member. For example, I would use the first method if I wanted my name as it shows up in the Member Bar to be colored, and I'd use the second method if I wanted to color your name in posts.

Link to comment
Share on other sites

Can you really even use the formatting many places? They arent setup in the $this format hardly anywhere currently. For example, in topic view it is an $author field and in profile view it is a $member field, rather than either having a $this format to them. I am not 100% sure if those should be changed.

And definitely it cant be done for the board index or the forum index, because they use a $data field rather than the actual display name field.

Link to comment
Share on other sites

That's because those method calls are done in the source files directly.

If you are on PHP5, you can use that method in the templates (wrapping a method call inside curly braces and treating it like a variable essentially, as in the example) - PHP4 doesn't seem to like it so much. As it's more of a developer helper and not a "feature" so to speak, I'm sure developers can figure it out. :)

This is also the reason I did the formatting directly in the source files - for cross-platform compatibility.

Link to comment
Share on other sites

Well, I haven't done extensive testing on it, but as I recall when I put something like

{$tihs->anyfunction()}

inside a template, PHP4 yelled at me and said no soup for you.

I'll test it out from work today and let you know what I find. I know testing it on PHP5 it worked fine. And as we do not use the method calls in the same fashion as variables ourselves, IPB works fine.

Link to comment
Share on other sites

Ok, test results.

PHP5 - worked properly. Added to top of global_board_header, and I get my name in blue.

PHP4 - does not work

If you add

$this->ipsclass->make_name_formatted( $this->ipsclass->member['members_display_name'], $this->ipsclass->member['mgroup'] )



It prints out

Object->make_name_formatted( Object->member['members_display_name'], Object->member['mgroup'] )



The ACP won't let you add

{$this->ipsclass->make_name_formatted( $this->ipsclass->member['members_display_name'], $this->ipsclass->member['mgroup'] )}



(with curly brackets). If you add it with curly brackets directly to the skin file you get

Parse error: syntax error, unexpected '(', expecting '}' in /path..../cache/skin_cache/cacheid_#/skin_global.php on line 279



So, as stated, it will work in the skin templates in PHP5, but not 4. In PHP4, use the function call in the source file (which is why we did this in IPB, for cross-compatibility).
Link to comment
Share on other sites

No. Brandon just stated he put it in the global header and his name appeared. This is a call to PHP itself, it doesn't have anything to do with the template's variables. The template becomes a plain PHP string when parsing. You can use method calls like that in strings, so it makes sense you can do it in IPB's templates. It really is on a completely different layer than the templating system.

Link to comment
Share on other sites

There is some confusion here.

A variable is like so

$var
$array['key']

The new addition, however, is a call to a function

$this->ipsclass->make_name_formatted( .... )

You can tell the difference by the parenthesis on the last example.

PHP5 lets you TREAT function calls like variables, while PHP4 does not. I hope that helps.

Link to comment
Share on other sites

Basically though when it comes down to it, this wouldnt help as far as coloring in RenderRow or the profile or anything because this function would not be for the "poster's" display name, thus me replacing it would just put the same display name for eveery post (that of whoever is reading them) right?

So this is more of a thing which would help a modder get the name to show up somewhere, colored, but not necessarily "change" cuurrent setup, right?


I say IPB should just make the names formatted everywhere already, to begin with! It probably should be that way. I doubt many people coloring usernames would have any reason NOT tow ant the prefix/suffix setup showing up everywhere on the board automatically.

Link to comment
Share on other sites

The first method works for just the active member, the second works for some other member. For example, I would use the first method if I wanted my name as it shows up in the Member Bar to be colored, and I'd use the second method if I wanted to color your name in posts.


So basically the second method works for everyone?
Link to comment
Share on other sites

@drygnfyre - yes, editing the source file works for everyone.

@BASHER, read the post I linked to. It IS possible to color other names besides the viewers name - instead of passing $this->ipsclass->member['members_display_name'] you pass the name you want to color (and pass their group as the second argument). I'm afraid direct support for this really belongs on IPS Beyond however. :thumbsup:

We don't want the name colored *everywhere* by default, however in 2.2 we added a lot more places where it is colored. Additionally, the new drop downs don't directly support the span tags, so you won't see the name colored in the drop down titles.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...