MyBB Community Forums

Full Version: Find / Replace template help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm having trouble getting it to do a match and replace. This is what I have, but it isn't working.

find_replace_templatesets("member_profile", "#".preg_quote("<td class=\"{\$bgcolors['msn']}\"><strong>{\$lang->msn}</strong></td>
<td class=\"{\$bgcolors['msn']}\"><a href=\"javascript:;\" onclick=\"MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={$uid}', 'imcenter', 450, 300);\">{\$memprofile['msn']}</a></td>
</tr></table>")."#i", "<td class=\"{\$bgcolors['msn']}\"><strong>{\$lang->msn}</strong></td>
<td class=\"{\$bgcolors['msn']}\"><a href=\"javascript:;\" onclick=\"MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={$uid}', 'imcenter', 450, 300);\">{\$memprofile['msn']}</a></td>
</tr></table><br /><!--Social Groups-->{\$socialgroups}<!--Social Groups-->");

Basically I'm trying to create a new table that lists the social groups a member is in. I know how to manually add them, but the plugin should do it automatically.
What is the problem? Any error message or something?
The problem is it doesn't always change the template.
Try this and see if it works:

find_replace_templatesets("member_profile", "#".preg_quote("<td class=\"{\$bgcolors['msn']}\"><strong>{\$lang->msn}</strong></td>
<td class=\"{\$bgcolors['msn']}\"><a href=\"javascript:;\" onclick=\"MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={\$uid}', 'imcenter', 450, 300);\">{\$memprofile['msn']}</a></td>
</tr></table>")."#i", "<td class=\"{\$bgcolors['msn']}\"><strong>{\$lang->msn}</strong></td>
<td class=\"{\$bgcolors['msn']}\"><a href=\"javascript:;\" onclick=\"MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={\$uid}', 'imcenter', 450, 300);\">{\$memprofile['msn']}</a></td>
</tr></table><br /><!--Social Groups-->{\$socialgroups}<!--Social Groups-->"); 
(2012-04-04, 06:04 PM)dragonexpert Wrote: [ -> ]The problem is it doesn't always change the template.

That's a common problem with the current method MyBB uses. It just sometimes doesn't work. MyBB should simplify this function imho.