2008-10-26, 08:24 PM
When installing this works fine:
When I add the following to uninstall function in my plugin, It doesn't change it back:
There was a topic on this that I referrered to. Can someone help me?
nvm, made better function which does the job:
find_replace_templatesets('usercp_nav_misc', '#'.preg_quote('</tbody>').'#', '<tr><td class="trow1 smalltext"><a href="usercp.php?action=newapplication" class="usercp_nav_item usercp_nav_viewprofile">Apply For Clan</a></td></tr></tbody>');
When I add the following to uninstall function in my plugin, It doesn't change it back:
require_once MYBB_ROOT."inc/adminfunctions_templates.php";
find_replace_templatesets('usercp_nav_misc', '#'.preg_quote('<tr><td class="trow1 smalltext"><a href="usercp.php?action=newapplication" class="usercp_nav_item usercp_nav_viewprofile">Apply For Clan</a></td></tr></tbody>').'#', '</tbody>');
There was a topic on this that I referrered to. Can someone help me?
nvm, made better function which does the job:
public function replace_temp_set($title,$find,$replace) {
global $db;
$title = $db->escape_string( $title );
$query = $db->simple_select("templates", "*", "title='$title' AND sid='-2'");
if( $db->num_rows( $query ) > 0 ) {
$rows = $db->fetch_array( $query );
$temp = str_replace($find,$replace, $rows['template']);
$updatetemp = array("template" => $db->escape_string($temp), "dateline" => TIME_NOW);
$db->update_query("templates", $updatetemp, "title='$title'");
}
}