<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[vldPersonals Forum - Cancel Account page with feedback form before cancelation]]></title>
	<link rel="self" href="http://www.vldpersonals.com/forum/feed/atom/topic/7272/"/>
	<updated>2011-01-18T17:01:59Z</updated>
	<generator>PunBB</generator>
	<id>http://www.vldpersonals.com/forum/topic/7272/cancel-account-page-with-feedback-form-before-cancelation/</id>
		<entry>
			<title type="html"><![CDATA[Re: Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/43602/#p43602"/>
			<content type="html"><![CDATA[<p>It works with 2.6.0</p><p>The only thing missing is htaccess modification if you use URL rewrite.</p><p>You have to add this in your .htaccess<br /></p><div class="codebox"><pre><code>RewriteRule ^cancel/?$ index.php?m=cancel [L]</code></pre></div><p>And also language translation of the menu should correctly go in:<br />/includes/languages/english/lang.custom.php</p><p>If you want to translate in your core file you have to modify &lt;li&gt; line to name=&quot;core|cancel_account&quot;}</p>]]></content>
			<author>
				<name><![CDATA[avantmedia]]></name>
				<uri>http://www.vldpersonals.com/forum/user/9250/</uri>
			</author>
			<updated>2011-01-18T17:01:59Z</updated>
			<id>http://www.vldpersonals.com/forum/post/43602/#p43602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/41687/#p41687"/>
			<content type="html"><![CDATA[<p>you have to add a line in the htaccess</p>]]></content>
			<author>
				<name><![CDATA[misulicus]]></name>
				<uri>http://www.vldpersonals.com/forum/user/6101/</uri>
			</author>
			<updated>2010-10-06T14:34:27Z</updated>
			<id>http://www.vldpersonals.com/forum/post/41687/#p41687</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/41683/#p41683"/>
			<content type="html"><![CDATA[<p>I tried in 2.5.7. everything its OK. But I have mode Search friendly URLs turned on. And address mypage.xx/cancel don&#039;t works. Only mypage.xx/index.php?m=cancel.</p>]]></content>
			<author>
				<name><![CDATA[point24]]></name>
				<uri>http://www.vldpersonals.com/forum/user/4738/</uri>
			</author>
			<updated>2010-10-06T09:44:49Z</updated>
			<id>http://www.vldpersonals.com/forum/post/41683/#p41683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/38510/#p38510"/>
			<content type="html"><![CDATA[<p>I tried installing this but it did not work.&nbsp; I clicked on the Cancel Account link but the form did not display.&nbsp; I followed all the steps and created all the necessary files.&nbsp; Any insights on why this is not working.&nbsp; I&#039;m using 2.5.5.&nbsp; Thanks!</p>]]></content>
			<author>
				<name><![CDATA[cbbanescu]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7907/</uri>
			</author>
			<updated>2010-05-19T05:59:14Z</updated>
			<id>http://www.vldpersonals.com/forum/post/38510/#p38510</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/36024/#p36024"/>
			<content type="html"><![CDATA[<p>Hey thanks - I&#039;ll definitely give this one a spin</p>]]></content>
			<author>
				<name><![CDATA[fatlizard]]></name>
				<uri>http://www.vldpersonals.com/forum/user/5980/</uri>
			</author>
			<updated>2010-02-01T15:44:40Z</updated>
			<id>http://www.vldpersonals.com/forum/post/36024/#p36024</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Cancel Account page with feedback form before cancelation]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/35948/#p35948"/>
			<content type="html"><![CDATA[<p>Ok u need 2 files for this<br />lib.cancel.php&nbsp; put it inside /includes/lib/<br />crate it and add this code to it:</p><div class="codebox"><pre><code>&lt;?php
//------------------------------------------------
// Includes
//------------------------------------------------
include SYS_PATH . &#039;includes/languages/&#039; . SYS_LANG . &#039;/lang.lib.contactus.php&#039;;
include SYS_PATH . &#039;includes/core/core.email.php&#039;;
include SYS_PATH . &#039;includes/fns/fns.validate.php&#039;;


//------------------------------------------------
// Check if user has access to this page
//------------------------------------------------
if (!$PREFS-&gt;conf[&#039;enable_feedback&#039;])
{
    $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;core&#039;][&#039;no_access&#039;]), 0, 0);
    redirect(VIR_PATH . ($PREFS-&gt;conf[&#039;fancy_urls&#039;] ? &quot;account/home/&quot; : &quot;index.php?m=account_home&quot;));
}


//------------------------------------------------
// Show contact form
//------------------------------------------------
show_contactus();


//------------------------------------------------
// Show contact form
//------------------------------------------------
function show_contactus()
{
    global $DB, $LANG, $TEMPLATE, $SESSION, $PREFS;


    //------------------------------------------------
    // Set template file
    //------------------------------------------------
    $TEMPLATE-&gt;set_template(&quot;cancel.tpl&quot;);


    //------------------------------------------------
    // Assign page title
    //------------------------------------------------
    $TEMPLATE-&gt;assign(&quot;app_page&quot;, ($LANG[&#039;core&#039;][&#039;menu_cancel&#039;]));


    //------------------------------------------------
    // Check if user has access to this page
    //------------------------------------------------
    if (!$SESSION-&gt;auth  &amp;&amp;  !$SESSION-&gt;conf[&#039;can_send_feedback&#039;])
    {
        $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;core&#039;][&#039;not_loggedin&#039;]), 0, 0);
        redirect(VIR_PATH . ($PREFS-&gt;conf[&#039;fancy_urls&#039;] ? &quot;account/login/&quot; : &quot;index.php?m=account_login&quot;), 1);
    }


    //------------------------------------------------
    // Get fields
    //------------------------------------------------
    $from = isset($_POST[&#039;from&#039;]) ? $DB-&gt;strip_slashes(trim($_POST[&#039;from&#039;])) : &#039;&#039;;
    $subj = isset($_POST[&#039;subject&#039;]) ? $DB-&gt;strip_slashes(trim($_POST[&#039;subject&#039;])) : &#039;&#039;;
    $body = isset($_POST[&#039;body&#039;]) ? $DB-&gt;strip_slashes(trim($_POST[&#039;body&#039;])) : &#039;&#039;;
    $captcha = isset($_POST[&#039;captcha&#039;]) &amp;&amp; $_POST[&#039;captcha&#039;] ? $DB-&gt;strip_slashes(trim($_POST[&#039;captcha&#039;])) : &quot;&quot;;


    //------------------------------------------------
    // Check if the user has clicked on Submit
    //------------------------------------------------
    if (isset($_POST[&#039;iscancel&#039;])  &amp;&amp;  $_POST[&#039;iscancel&#039;]) {
        if (send_feedback($from, $subj, $body, $captcha)) $body = &quot;&quot;;
    }
    $_SESSION[&#039;captcha&#039;] = random_string(5);

    //------------------------------------------------
    // Assign page title
    //------------------------------------------------
    $TEMPLATE-&gt;assign(&quot;from&quot;, htmlentities2utf8($from));
    $TEMPLATE-&gt;assign(&quot;body&quot;, htmlentities2utf8($body));
    $TEMPLATE-&gt;assign(&quot;subj&quot;, $subj);

    return 1;
}
// End Function


//------------------------------------------------
// Send feedback
//------------------------------------------------
function send_feedback($from, $subj, $body, $captcha)
{
    global $DB, $LANG, $TEMPLATE, $SESSION, $PREFS;


    // *system demo admin label* //
    //------------------------------------------------
    // Validate email
    //------------------------------------------------
    $valid_email =  validate_email($from);
    if ($from == &quot;&quot;)
    {
        $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;contactus&#039;][&#039;empty_email&#039;]), 0, 0);
        return 0;
    }
    elseif ($valid_email  == 1)
    {
        $TEMPLATE-&gt;set_message(&quot;error&quot;, str_replace(&quot;%1%&quot;, 4, ($LANG[&#039;contactus&#039;][&#039;email_too_long&#039;])), 0, 0);
        return 0;
    }
    elseif ($valid_email == 2)
    {
        $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;contactus&#039;][&#039;invalid_email&#039;]), 0, 0);
        return 0;
    }


    //------------------------------------------------
    // Validate body
    //------------------------------------------------
    if ($body == &quot;&quot;)
    {
        $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;contactus&#039;][&#039;empty_body&#039;]), 0, 0);
        return 0;
    }


    //------------------------------------------------
    // Check if captcha is available and accepted
    //------------------------------------------------
    if ($PREFS-&gt;conf[&#039;feedback_captcha&#039;] != 0  &amp;&amp;  strcasecmp($_SESSION[&#039;captcha&#039;], $captcha) != 0  &amp;&amp;  extension_loaded(&#039;gd&#039;))
    {
        //------------------------------------------------
        // Set the message
        //------------------------------------------------
        $TEMPLATE-&gt;set_message(&quot;error&quot;, ($LANG[&#039;contactus&#039;][&#039;invalid_catcha&#039;]), 0, 0);
        return 0;
    }


    //------------------------------------------------
    // Create email class
    //------------------------------------------------
    $EMAIL = new Email();


    //------------------------------------------------
    // Send out an email to the member
    //------------------------------------------------
    $EMAIL-&gt;send($from, $PREFS-&gt;conf[&#039;return_email_name&#039;], $PREFS-&gt;conf[&#039;feedback_email&#039;], $subj, $body.&quot;\n\nSender IP:&quot;.$SESSION-&gt;get_ip());


    //------------------------------------------------
    // Set message and redirect to the default page
    //------------------------------------------------
    redirect(VIR_PATH . ($PREFS-&gt;conf[&#039;fancy_urls&#039;] ? &quot;account/privacy/cancel/&quot; : &quot;index.php?m=account_privacy&amp;p=cancel&quot;));
    return 1;
}
// End Function
?&gt;</code></pre></div><p>create a file called <br />cancel.tpl and put it inside /temlplates/your template/</p><p>put this code in it:<br /></p><div class="codebox"><pre><code>&lt;!-- INCLUDE header.tpl --&gt;
&lt;div class=&quot;header_wrap&quot;&gt;
    &lt;div class=&quot;location_wrap&quot;&gt;
        &lt;div class=&quot;location&quot;&gt;
            &lt;h1&gt;Account Cancelation Form&lt;/h1&gt;
        &lt;/div&gt;
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;options_wrap&quot;&gt;
        &lt;div class=&quot;title&quot;&gt;
            &lt;h1&gt;Account Cancelation Form&lt;/h1&gt;
        &lt;/div&gt;
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- INCLUDE message.tpl --&gt;
&lt;!-- IF hide_content != &quot;1&quot; --&gt;
    &lt;div class=&quot;outter page_contactus&quot;&gt;
        &lt;div class=&quot;typepage&quot;&gt;
            &lt;div class=&quot;dataitem single&quot;&gt;
                &lt;div class=&quot;form&quot;&gt;
                    &lt;form name=&quot;edit&quot; method=&quot;post&quot; action=&quot;&quot;&gt;
                        &lt;div class=&quot;fieldset&quot;&gt;
                            &lt;dl class=&quot;fieldset&quot;&gt;
                                &lt;dt&gt;&lt;/dt&gt;
                                &lt;dd&gt;&lt;input type=&quot;hidden&quot; class=&quot;text&quot; size=&quot;40&quot; id=&quot;field_from&quot; name=&quot;from&quot; value=&quot;{session.email}&quot; /&gt;&lt;/dd&gt;
                                &lt;dt&gt;&lt;label for=&quot;field_subject&quot;&gt;{lang:&quot;contactus&quot;,&quot;subject&quot;}&lt;/label&gt;&lt;/dt&gt;
                                &lt;dd&gt;&lt;input type=&quot;text&quot; class=&quot;text&quot; size=&quot;40&quot; id=&quot;subject&quot; name=&quot;subject&quot; value=&quot;Account Cancelation Form&quot; /&gt;&lt;/dd&gt;
                                &lt;dt&gt;&lt;label for=&quot;field_body&quot;&gt;Why do you cancel your account and feedback.&lt;/label&gt;&lt;/dt&gt;
                                &lt;dd&gt;&lt;textarea class=&quot;textarea textarea_full&quot; id=&quot;field_body&quot; name=&quot;body&quot;&gt;{body}&lt;/textarea&gt;&lt;/dd&gt;
                                &lt;!-- IF settings.feedback_captcha --&gt;
                                    &lt;dt&gt;&lt;label for=&quot;field_captcha&quot;&gt;{lang:&quot;contactus&quot;,&quot;verify_number&quot;}&lt;/label&gt;&lt;/dt&gt;
                                    &lt;dd&gt;
                                        &lt;input type=&quot;text&quot; id=&quot;field_captcha&quot; class=&quot;text captcha&quot; name=&quot;captcha&quot; maxlength=&quot;5&quot; /&gt;
                                        &lt;img src=&quot;{virtual_path}includes/fns/fns.captcha.php&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;
                                    &lt;/dd&gt;
                                &lt;!-- ENDIF --&gt;
                                &lt;dd class=&quot;submit&quot;&gt;&lt;input class=&quot;submit&quot; name=&quot;submit&quot; value=&quot;{lang:&quot;contactus&quot;,&quot;submit&quot;}&quot; type=&quot;submit&quot; /&gt;&lt;/dd&gt;
                            &lt;/dl&gt;
                        &lt;/div&gt;
                        &lt;input type=&quot;hidden&quot; name=&quot;iscancel&quot; value=&quot;1&quot; /&gt;
                    &lt;/form&gt;
                &lt;/div&gt;
                &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;!-- ENDIF --&gt;
&lt;!-- INCLUDE footer.tpl --&gt;</code></pre></div><p>go to your language files:<br />/includes/languages/english/lang.core.php<br />add a line:<br />&quot;menu_cancel&quot; =&gt;<br />&quot;Cancel Account&quot;,</p><p>then open header.tpl file<br />and add this line where you want to show the cancel link in the menus<br /></p><div class="codebox"><pre><code>&lt;li class=&quot;blocked&quot;&gt;{anchor:url1=&quot;cancel/&quot;,url2=&quot;index.php?m=cancel&quot;,name=&quot;custom|cancel_account&quot;}&lt;/li&gt;</code></pre></div><p>after they access the page they will seea form to enter feedback and acptcha and after clicking submit tyhey wil be redirected to the cancel page and u get an email with the forms details</p>]]></content>
			<author>
				<name><![CDATA[jwysocki73]]></name>
				<uri>http://www.vldpersonals.com/forum/user/5367/</uri>
			</author>
			<updated>2010-01-30T18:44:19Z</updated>
			<id>http://www.vldpersonals.com/forum/post/35948/#p35948</id>
		</entry>
</feed>

