.KX Posted December 7, 2006 Posted December 7, 2006 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?
bfarber Posted December 7, 2006 Posted December 7, 2006 http://forums.invisionpower.com/index.php?...t&p=1417890
.KX Posted December 7, 2006 Posted December 7, 2006 Thankyou. May your children be blessed with 2 heads. Each. ;) :blink:
Debbie Posted December 7, 2006 Posted December 7, 2006 Thankyou. May your children be blessed with 2 heads. Each. ;) :blink: :blink: His children each have one head and are very cute!
TestingSomething Posted December 8, 2006 Posted December 8, 2006 I don't understand what it is saying the difference is between the 2 methods.
Michael Posted December 8, 2006 Posted December 8, 2006 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.
TestingSomething Posted December 8, 2006 Posted December 8, 2006 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.
TestingSomething Posted December 8, 2006 Posted December 8, 2006 I was going to, but I just wondered if I would end up having it where it "seems" to work and then really it is doing something I don't notice so I leave it messed up unknwingly. I am pretty close to 100% sure the data ones wouldnt work, but possible topic view and profile view would.
.KX Posted December 8, 2006 Posted December 8, 2006 Revert FTW?Try it...if it messed up then just revert the changed you made.
bfarber Posted December 8, 2006 Posted December 8, 2006 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.
.KX Posted December 8, 2006 Posted December 8, 2006 So you're saying that if we aren't using PHP 5.x+ then I won't be able to colour usernames all over the board using the method you explained? Or am I not interpreting what you said right?
bfarber Posted December 8, 2006 Posted December 8, 2006 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.
.KX Posted December 8, 2006 Posted December 8, 2006 Okay then, thanks a lot. I'm assuming you'll post your findings in this topic? (No need to reply to this unless you are goin' to put them somewhere else). :P
bfarber Posted December 8, 2006 Posted December 8, 2006 Ok, test results.PHP5 - worked properly. Added to top of global_board_header, and I get my name in blue.PHP4 - does not workIf 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 getParse error: syntax error, unexpected '(', expecting '}' in /path..../cache/skin_cache/cacheid_#/skin_global.php on line 279So, 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).
TestingSomething Posted December 8, 2006 Posted December 8, 2006 I am using PHP 5. But like I said, almost everywhere on the site it is using variables set up in files. So if I udnerstand things correwctly, there is almost nowhere it would work other than member_bar.
ZuCruTrooper2 Posted December 8, 2006 Posted December 8, 2006 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.
bfarber Posted December 8, 2006 Posted December 8, 2006 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.
TestingSomething Posted December 9, 2006 Posted December 9, 2006 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.
Quillz Posted December 9, 2006 Posted December 9, 2006 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?
bfarber Posted December 9, 2006 Posted December 9, 2006 @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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.