Search Results for 'code'
-
Search Results
-
Hi!
I was trying to integrate a bbpress-1.0.2 forum with my existing WP installation and I found a funny bug.
If I open a topic and use the interface right to the title to add a russian-language tag, only the first half of a tag is actually added.
If I try to add a tag “mama” (written in russian, of course. I write here in english just for the english speaking people being able to read the post) only the first half of a tag (“ma”) is actually added. It happens everytime I add a tag with an even number of letters (2, 4, 6, etc). Tags with an odd number of letters are added correctly.
BTW every russian letter in UTF-8 is encoded using exactly two bytes.
Unfortunatelly, I don’t fully understand what the code does and the below is just my guess.
I guess the problem is in file /bb-includes/functions.bb-formatting.php either in function seems_utf8() or in bb_utf8_cut().
Traditionally, strlen() returned 8 for utf-8-encoded “mama”. In such case bb_utf8_cut() would work correct (althought I haven’t actually checked). But if one use php.ini mbstring.func_overload option to overload str* functions by mb_str* ones, then strlen(“mama”) returns 4 and bb_utf8_cut() thinks this’s is non-utf-8-encoded string length and assumes that the “actual” string length would be 2. That’s wrong.
So, my general suggestions is to fix somehow one of those functions to work correctly with mbstring.func_overload both set and unset.
The quick-fix for people having the option set is to add the following line at the very start of bb_utf8_cut() function:
return $utf8_string;
1. Am I correct or should I search for the problem in another piece of the system?
2. Would this “fix” break anything else?
Topic: @ links (mentions)
Have been working on my forum recently, and I have though tof something I’d like to add to it.
Now, I’m no plugin developer, or PHP junkie, but I’d like to know what steps would be needed to turn @ links (mentions, like those found on Twitter) into links that take the user to a members profile page/or maybe even the member’s website (if any).
Example:
‘@matt’ would become ‘@matt‘
It would obviously have to scan through the post, check for any mentions, check if the user exists, and if it does, then apply the link. Now, I have no idea how this would be implemented – I hope to learn more soon.
This may not be a very great idea to have for a bbPress forum, but I think it would be nice. Could anyone help me with this?
Peace, Michael