Then should I revert my changes...? Just to be sure. What about passing params? (I suspect you discuss it below...)
Yes, but it means doing that treatment everywhere where names are pulled directly. The alternatives are converting everything to a case of loadMemberData (minimal) or doing it in the post-replace phase, either way that's an extra query.
And lMD is going to be slower...
I have to admit I'm a sucker for dynamic replacements. Even on very text-heavy pages, it's still always super fast, and as long as it's done correctly... Well, there's nothing better
:PRight now, my color injection code, as slow and unoptimized as it is (preg_replace_callback...), only takes a millisecond to execute, and that includes loading the cached data. And with recaching, it takes 3ms, but OTOH I only have one custom group on my test site (admin), so it's bound to be fast overall...
Hmm. I'm thinking that we could do it better by querying and caching the member group colours on a longer term basis, and fetching user+group instead, as querying every user with their group is going to be quite expensive.
Can you elaborate on this...?
I've rewritten my code to store members+groups followed with a list of colors per group, to avoid repetition and thus generate a smaller cache file for bigger arrays. But I'm not sure what you're suggesting...?
The result is something like this: (let's say users 1, 2 and 5 are admins and user 3 is from group 7)
$member_colors = array(
'group' => array(
1 => 1,
2 => 1,
3 => 7,
5 => 1,
),
'color' => array(
1 => '#FF0000',
7 => '#FFCC99',
),
);
So, basically, we retrieve the color with $member_colors['color'][$member_colors['group'][$USER_ID]].
Of course, I'm also testing for 'bbc_link' inside the match, and it works well.
It depends how fussy the receiver is. A receiver expecting Atom and gets not-strictly-valid Atom might throw a wobbly. Besides, in XML modes, there's no point running that operation, might as well save a few CPU cycles...
I'm not sure... For instance, I quick-edited a post and the result had the proper group color, which was fine (and wouldn't have happened if XML didn't run it.) Obviously I've disabled it now, but basically I don't really see a reason to prevent any XML that shows a profile link, to actually show it in the proper color...
Works for me. Just something I wanted to be careful of, really.
I'm not entirely convinced it's the best way though. I mean, to me as a user, it would make sense to have my link show in red if I'm linking inside my post to an admin's profile... I don't know.
Of course, if I'm using PURLs, the link will show with the regular color because then Wedge has no way to (easily) figure out the target's group color...
It works like any other nesting, and for the most part it's pretty transparent.
Sorry, I don't mean that I don't understand them, I just mean that I don't get the point. To me, output buffers are nice if you're trying to 'catch' data output by something else, etc, but if you know the exact execution order, it's best to just put everything into the same OB...
For instance, link replacements have to happen after <URL> is transformed, but before pretty URLs are applied. I was thinking of using my replacement code right inside the purl filter file, to be able to both transform profile URLs and add a color at the same time, but... Err, one millisecond...? Who cares. Might as well make the code clearer and put everything in the same place.
Well, we could simply turn these into sub-functions and call them all from ob_sessrewrite...
That would work and would probably be faster than using true buffers to pass back and forth.
Definitely... But I'm not in a hurry to do that either, though
:lol:If you're sending out a feed of new members, there's really only so much you can put into it before you break Atom format, no?
What do you mean?
Memberlist is definitely a custom candidate. We need to decide what columns are actually needed.
Sure.......................... Who's up for it?
:PI think that's the only place you get it apart from the info center... A real bummer.
Yup, it either should be throughout or not at all.
(With the technicality of big user names (e.g. userbox authors) being potentially a problem. I'm thinking of fixing it by changing the default colors to pastel ones, like the group colors on wedge.org... #d2653a is definitely nicer than red for admins!)
You know, you COULD revert this and no one would blame you for that...
I could but it would feel wrong. The whole solution seems hacky and I don't like it but I just don't know a better one.
Looking at the SMF2 code, it only checks for %p (lowercase), which generates uppercase AM and PM, and manually transforms them to time_am and time_pm, but they're not dealing with %P... Just so you know-- if you add a %P on a server that doesn't support it, it'll return an empty string... Not an empty am/pm; but an entirely empty string. (At least under Windows.) I don't think 'wrong' values are being filtered out if the user enters a custom time format...
(Heck, if it wasn't for the custom time format thing, I wouldn't have had to do the whole preg_match stuff to find the year.)
Also, why would you want to pass in parameters not related to the query itself, exactly?
<evil grin> "I don't know, but it's going to be a lot of fun finding out!" (Lister, epilogue, Red Dwarf 2x06)
Okay, forget it, once the query is converted, plugins will still have access to $users from within the query anyway...
;)Oh... I just found out that my replacement code was also changing the color for links inside the profile area (showposts, etc.), ah ah... Well, easy to fix (just match against URLs with just a profile ID and nothing else...)
I could make the fix 'perfect' by storing user names in addition to groups in the cache. Then I would simply need to determine if the visible link matches the real_name, but... That would make for a bigger cache. I don't like the idea too much.
It wouldn't be too bad to provide somewhere that that value can be reset through a hook, and optionally a hook in the validatePassword subsystem to allow authentication plugins to safely handle admin-type security checks.
I'm definitely leaving that one up to you
;)