Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Ability to delete user account itself (important for germans!)

Asked Modified Viewed 3,326 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

Because of the new privacy policy etc. for example in germany, german need the opportunity that users from a site can unsubscribe and delete himself. Is there a way in Version 9? This is very important and will be prosecuted in Germany.

there is a hack but only version for 7 no longer works
0 replies

9 posts

C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Make a user module. The SQL Execution of it is:

if (iMEMBER && isset($_POST['delete_me']) {
dbquery("DELETE FROM ".DB_USERS." WHERE user_id=fusion_get_userdata('user_id'));
addNotice('success', 'Bye Bye', 'all);
}


The button for it is:


form_button('delete_me', "Delete Me", "delete_me"));
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

in what folder i have to look and what files i have to make?

includes/userfields/.... ?
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Yes, and you need to code the POST execution SQL part in display_user_fields.
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

plz add this in core well its important for other country's too in future.
Edited by Catzenjaeger on 02-09-2016 15:58,
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 311 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

includes/user_fields/
make file
user_delus_include_var.php

<?php
if (!defined("IN_FUSION")) {
    die("Access Denied");
}

// Version of the user fields api
$user_field_api_version = "1.01.00";
$user_field_name = $locale['uf_delus'];
$user_field_desc = $locale['uf_delus_desc'];
$user_field_dbname = "user_delus";
$user_field_group = 1;
$user_field_dbinfo = "VARCHAR(2) NOT NULL DEFAULT ''";


Make file
user_delus_include.php

<?php
if (!defined("IN_FUSION")) {
    die("Access Denied");
}

// Display user field input
if ($profile_method == "input") {
    $user_fields = '';
    if (defined('ADMIN_PANEL')) {
        $user_fields = "<div class='well m-t-5 text-center'>".$locale['uf_delus']."</div>";
    }

// Display in profile
} elseif ($profile_method == "display") {
if (iMEMBER && isset($_POST['delete_me']) && fusion_get_userdata('user_id') == $_GET['lookup']) {
$data = fusion_get_userdata('user_id');

                if (db_exists(DB_ARTICLES)) {
                    dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$data."'");
                }
                dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$data."'");
                dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$data."' OR message_from='".$data."'");
                if (db_exists(DB_NEWS)) {
                    dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$data."'");
                }
                if (db_exists(DB_POLL_VOTES)) {
                    dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$data."'");
                }
                dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$data."'");
                dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$data."'");
                if (db_exists(DB_FORUM_THREADS)) {
                    dbquery("DELETE FROM ".DB_FORUM_THREADS." WHERE thread_author='".$data."'");
                }
                if (db_exists(DB_FORUM_POSTS)) {
                    dbquery("DELETE FROM ".DB_FORUM_POSTS." WHERE post_author='".$data."'");
                }
                if (db_exists(DB_FORUM_THREAD_NOTIFY)) {
                    dbquery("DELETE FROM ".DB_FORUM_THREAD_NOTIFY." WHERE notify_user='".$data."'");
                }
                dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$data."'");

addNotice('success', $locale['uf_delus_exit']);
redirect('index.php');
}

if (iMEMBER && fusion_get_userdata('user_id') == $_GET['lookup']) {
$action_url = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$ab = openform('delete_me', 'post', $action_url);
$ab .= form_button('delete_me', $locale['uf_delus_del'], "delete_me");
$ab .= closeform();
        $user_fields = array('title' => $locale['uf_delus'], 'value' => $ab);

}

}


make file
locale/xxx/user_fields/user_delus.php

<?php
$locale['uf_delus'] = "Delete User";
$locale['uf_delus_desc'] = "Delete User";
$locale['uf_delus_del'] = "Delete Me";
$locale['uf_delus_exit'] = "Acount Deleted...";
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Got it , done.

There: https://github.com/PHPFusion/PHPFusion/commit/beb01755dd3bedef73f26018466cd76242eb4dcf
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 311 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

Please change it
Administration error (user_field)

} elseif ($profile_method == "display") {

below
  if (!defined('ADMIN_PANEL')) {


and last row

0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

This is current full code:


<?php
if (!defined("IN_FUSION")) {
    die("Access Denied");
}

// Display user field input
if ($profile_method == "input") {

    $user_fields = '';
    if (defined('ADMIN_PANEL')) {
        $user_fields = "<div class='well m-t-5 text-center'>".$locale['uf_delete']."</div>";
    }

// Display in profile
} elseif ($profile_method == "display") {

    if (iMEMBER && isset($_POST['delete_me']) && fusion_get_userdata('user_id') == $_GET['lookup'] && !iSUPERADMIN) {
        $data = fusion_get_userdata('user_id');

        if (db_exists(DB_ARTICLES)) {
            dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$data."'");
        }
        dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$data."'");
        dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$data."' OR message_from='".$data."'");
        if (db_exists(DB_NEWS)) {
            dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$data."'");
        }
        if (db_exists(DB_POLL_VOTES)) {
            dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$data."'");
        }
        dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$data."'");
        dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$data."'");
        if (db_exists(DB_FORUM_THREADS)) {
            dbquery("DELETE FROM ".DB_FORUM_THREADS." WHERE thread_author='".$data."'");
        }
        if (db_exists(DB_FORUM_POSTS)) {
            dbquery("DELETE FROM ".DB_FORUM_POSTS." WHERE post_author='".$data."'");
        }
        if (db_exists(DB_FORUM_THREAD_NOTIFY)) {
            dbquery("DELETE FROM ".DB_FORUM_THREAD_NOTIFY." WHERE notify_user='".$data."'");
        }
        dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$data."'");

        addNotice('success', $locale['uf_delete_exit']);
        redirect('index.php');
    }

    if (iMEMBER && fusion_get_userdata('user_id') == $_GET['lookup'] && !iSUPERADMIN) {
        $action_url = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
        $ab = openform('delete_me', 'post', $action_url);
        $ab .= form_button('delete_me', $locale['uf_delete_del'], "delete_me");
        $ab .= closeform();
        $user_fields = array('title' => $locale['uf_delete'], 'value' => $ab);
    }

}


Which one? Can paste me full code?

Karrak, please get Github account.. lol
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 311 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

Full code

<?php
if (!defined("IN_FUSION")) {
    die("Access Denied");
}

// Display user field input
if ($profile_method == "input") {

    $user_fields = '';
    if (defined('ADMIN_PANEL')) {
        $user_fields = "<div class='well m-t-5 text-center'>".$locale['uf_delete']."</div>";
    }

// Display in profile
} elseif ($profile_method == "display") {
    if (!defined('ADMIN_PANEL')) {

    if (iMEMBER && isset($_POST['delete_me']) && fusion_get_userdata('user_id') == $_GET['lookup'] && !iSUPERADMIN) {
        $data = fusion_get_userdata('user_id');

        if (db_exists(DB_ARTICLES)) {
            dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$data."'");
        }
        dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$data."'");
        dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$data."' OR message_from='".$data."'");
        if (db_exists(DB_NEWS)) {
            dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$data."'");
        }
        if (db_exists(DB_POLL_VOTES)) {
            dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$data."'");
        }
        dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$data."'");
        dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$data."'");
        if (db_exists(DB_FORUM_THREADS)) {
            dbquery("DELETE FROM ".DB_FORUM_THREADS." WHERE thread_author='".$data."'");
        }
        if (db_exists(DB_FORUM_POSTS)) {
            dbquery("DELETE FROM ".DB_FORUM_POSTS." WHERE post_author='".$data."'");
        }
        if (db_exists(DB_FORUM_THREAD_NOTIFY)) {
            dbquery("DELETE FROM ".DB_FORUM_THREAD_NOTIFY." WHERE notify_user='".$data."'");
        }
        dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$data."'");

        addNotice('success', $locale['uf_delete_exit']);
        redirect('index.php');
    }

    if (iMEMBER && fusion_get_userdata('user_id') == $_GET['lookup'] && !iSUPERADMIN) {
        $action_url = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
        $ab = openform('delete_me', 'post', $action_url);
        $ab .= form_button('delete_me', $locale['uf_delete_del'], "delete_me");
        $ab .= closeform();
        $user_fields = array('title' => $locale['uf_delete'], 'value' => $ab);
       }
    }

}
0 replies

Category Forum

User Administration - 9

Labels

None yet

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
K
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 311 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet