Unofficial modifications
nieoficjalne modyfikacje for?w phpBB by Przemo

Modyfikacje mniejsze - Usuwanie w?asnego profilu

nitro18 - Nie 22 Lip, 2007
Temat postu: Usuwanie w?asnego profilu
Przedstawiona ni?ej modyfikacja jest autorstwa Poupoune i w oryginale dzia?a na phpbb2 i 3.

Ta wersja dzia?a z wersj? forum by Przema.

Pozwala ona usun?? sw?j profil poprzez klikni?cie w 'Profil', zaznaczenie na dole checkboxa i wys?anie. Usuwa profil ale nie posty.

Jednyne "co mnie dra?ni" to ?e, podczas rejestracji jest ta opcja, mimo ?e nie powinno jej by?. Mo?e kto? b?dzie mia? pomys? jak to usun??.

Korzystaj?c z kt?re? wersji nie zapominajmy wykona? najpierw polecenia z 'Wersji z belk?' bo tam jest ca?a instrukcja', a potem wykonujemy polecenia wersji kt?r? chcemy mie?.

Je?eli kto? b?dzie mia? k?opoty nie napisze do mnie emaila: nitro18.2006@gmail.com do??czaj?c 4 pliki wymagane z forum oraz pisz?c jak? wersj? chce mie?.


Pozdro :)


Wersja z belk?

screenshot: poka?

Wiadomo?? ukryta / Hidden message
Aby zobaczy? wiadomo?? postaw piwo autorowi piwo.

##############################################################
## Nazwa moda: Samo usuwanie swojego profilu
## Autor, oryginalny: Poupoune < poupoune@phpbb-fr.com >
## Autor, modyfikacje: Nitro < nitro18.2006@gmail.com >
##
## Opis: MOD pozwala na usuni?cie w?asnego profilu z forum
##
## Wersja: 1.0.1
##
## Poziom instalacji: ?atwy
## Czas instalacji: ~3 minuty
## Plik?w do edycji: 4
## includes/usercp_register.php
## templates/subSilver/profile_add_body.tpl
## langugage/lang_polish/lang_main.php
## langugage/lang_english/lang_main.php
##
##
##############################################################

#
#-----[ OTW?RZ ]----------------------------------------------
#

includes/usercp_register.php

#
#-----[ ZNAJD? ]----------------------------------------------
#

if ( isset($HTTP_POST_VARS['submit']) )
{
include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
include($phpbb_root_path . 'includes/usercp_signature.'.$phpEx);

$passwd_sql = '';

#
#-----[ PO TYM, DODAJ ]----------------------------------------------
#

---
if( isset($HTTP_POST_VARS['deleteuser']) && ( $HTTP_GET_VARS['mode'] == 'editprofile' || $HTTP_POST_VARS['mode'] == 'editprofile' ) && $userdata['user_level'] == USER )
{
$sql = "SELECT g.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
AND g.group_single_user = 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group information for this user', '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);

$sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . DELETED . ", post_username = '$username'
WHERE poster_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update posts for this user', '', __LINE__, __FILE__, $sql);
}

$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_poster = " . DELETED . "
WHERE topic_poster = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update topics for this user', '', __LINE__, __FILE__, $sql);
}

$sql = "UPDATE " . VOTE_USERS_TABLE . "
SET vote_user_id = " . DELETED . "
WHERE vote_user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update votes for this user', '', __LINE__, __FILE__, $sql);
}

$sql = "SELECT group_id
FROM " . GROUPS_TABLE . "
WHERE group_moderator = $user_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select groups where user was moderator', '', __LINE__, __FILE__, $sql);
}

while ( $row_group = $db->sql_fetchrow($result) )
{
$group_moderator[] = $row_group['group_id'];
}

if ( count($group_moderator) )
{
$update_moderator_id = implode(', ', $group_moderator);

$sql = "UPDATE " . GROUPS_TABLE . "
SET group_moderator = " . $userdata['user_id'] . "
WHERE group_moderator IN ($update_moderator_id)";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group moderators', '', __LINE__, __FILE__, $sql);
}
}

$sql = "DELETE FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from user_group table', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . GROUPS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from topic watch table', '', __LINE__, __FILE__, $sql);
}

$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_userid = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
}

$sql = "SELECT privmsgs_id
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_from_userid = $user_id
OR privmsgs_to_userid = $user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select all users private messages', '', __LINE__, __FILE__, $sql);
}

// This little bit of code directly from the private messaging section.
while ( $row_privmsgs = $db->sql_fetchrow($result) )
{
$mark_list[] = $row_privmsgs['privmsgs_id'];
}

if ( count($mark_list) )
{
$delete_sql_id = implode(', ', $mark_list);

$delete_text_sql = "DELETE FROM " . PRIVMSGS_TEXT_TABLE . "
WHERE privmsgs_text_id IN ($delete_sql_id)";
$delete_sql = "DELETE FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_id IN ($delete_sql_id)";

if ( !$db->sql_query($delete_sql) )
{
message_die(GENERAL_ERROR, 'Could not delete private message info', '', __LINE__, __FILE__, $delete_sql);
}

if ( !$db->sql_query($delete_text_sql) )
{
message_die(GENERAL_ERROR, 'Could not delete private message text', '', __LINE__, __FILE__, $delete_text_sql);
}
}

$message = $lang['User_deleted'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

message_die(GENERAL_MESSAGE, $message);
}
else if(($userdata['user_level'] > 0 || $mode != 'editprofile') && $HTTP_POST_VARS['deleteuser'])
{
message_die(GENEARL_MESSAGE, 'Nie jeste? zalogowany, aby usun?? sw?j profil lub ten profil nie mo?e zosta? usuni?ty.<br><br>You are not logging on for removing this profile or this profile cannot be removed.');
}


#
#-----[ ZNAJD? ]----------------------------------------------
#

'SMILIES_STATUS' => $smilies_status,

#
#-----[PO TYM, DODAJ ]----------------------------------------------
#

'L_DELETE_USER' => $lang['User_delete'],
'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'],
'L_DEL_ACC' => $lang['txt_user_acc'],

#
#-----[OTW?RZ ]----------------------------------------------
#

templates/subSilver/profile_add_body.tpl

#
#-----[ ZNAJD? ]----------------------------------------------
#

{PHOTO_BOX}

#
#-----[PO TYM, DODAJ ]----------------------------------------------
#

<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_DEL_ACC}</th>
</tr>
<tr>
<td class="row1"><span class="gen">{L_DELETE_USER}</span></td>
<td class="row2">
<input type="checkbox" name="deleteuser">
<span class="genmed">{L_DELETE_USER_EXPLAIN}</span></td>
</tr>


#
#-----[OTW?RZ ]----------------------------------------------
#

langugage/lang_polish/lang_main.php

#
#-----[ ZNAJD? ]----------------------------------------------
#

?>

#
#-----[PRZED TYM, DODAJ ]----------------------------------------------
#

$lang['User_delete_explain'] = 'Kliknij tutaj, aby usun?? sw?j profil.';
$lang['User_deleted'] = 'Tw?j profil zosta? usuni?ty!';
$lang['user_delete_not_auth'] = 'Nie jeste? zalogowany do usuni?cia swojego profilu lub ten profil nie mo?e zosta? usuni?ty.';
$lang['txt_user_acc'] = "Usuwanie profilu";

#
#-----[OTW?RZ ]----------------------------------------------
#

langugage/lang_english/lang_main.php

#
#-----[ ZNAJD? ]----------------------------------------------
#

?>

#
#-----[PRZED TYM, DODAJ ]----------------------------------------------
#

$lang['User_delete'] = 'Delete your profile:';
$lang['User_delete_explain'] = 'mark checkbox beside in order to remove your profile';
$lang['User_deleted'] = 'your profile was removed!';
$lang['user_delete_not_auth'] = 'You aren\'t logging on for removing your profile or this profile cannot be removed. ';
$lang['txt_user_acc'] = "Remove your profile";



Wersja bez belki

screenshot: poka?

Wiadomo?? ukryta / Hidden message
Aby zobaczy? wiadomo?? postaw piwo autorowi piwo.
w pliku: langugage/lang_polish/lang_main.php nie dodawa?: $lang['txt_user_acc'] = "Usuwanie profilu";
w pliku: langugage/lang_english/lang_main.php nie dodawa?: $lang['txt_user_acc'] = "Remove your profile";
w pliku: templates/subSilver/profile_add_body.tpl nie dodawa?:

<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_DEL_ACC}</th>
</tr>


Wersja z zainstalowanym modu?em: New_Profile_Panel

screenshot: poka?

Wiadomo?? ukryta / Hidden message
Aby zobaczy? wiadomo?? postaw piwo autorowi piwo.
otw?rz
-------

templates/subSilver/profile_add_body.tpl

szukaj
-------

'notes',
<!-- END switch_edit_profile -->
'prefinfo'

dodaj po
------

,'rp'

szukaj
------
<tr>
<td class="row1" nowrap="nowrap" onMouseOver="this.className='row2'; this.style.cursor='pointer';" onMouseOut="this.className='row1'; this.style.cursor='pointer';" onClick="dom_menu.set('prefinfo'); return false;"><div id="prefinfo_opt" class="menu"><b>»</b> <span class="gensmall">Preferencje</span></div></td>
</tr>

dodaj po
-------------
<tr>
<td class="row1" nowrap="nowrap" onMouseOver="this.className='row2'; this.style.cursor='pointer';" onMouseOut="this.className='row1'; this.style.cursor='pointer';" onClick="dom_menu.set('rp'); return false;"><div id="rp_opt" class="menu"><b>»</b> <span class="gensmall">{L_DEL_ACC}</span></div></td>
</tr>

szukaj
--------
<!-- END switch_avatar_block -->

dodaj po
-------------
<table id="rp" style="display:none" border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_DEL_ACC}</th>
</tr>

<tr>
<td class="row1"><span class="gen">{L_DELETE_USER}</span></td>
<td class="row2">
<input type="checkbox" name="deleteuser">
<span class="genmed">{L_DELETE_USER_EXPLAIN}</span></td>
</tr>
<tr>
<td class="catBottom" colspan="2" align="center" height="22">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" name="reset" class="liteoption" /></td>
</tr>

</table>

KnofeL - Nie 22 Lip, 2007

nitro18 napisał/a
Jednyne co mnie dra?ni to ?e, podczas rejestracji jest ta opcja, mimo ?e nie powinno jej by?. Mo?e kto? b?dzie mia? pomys? jak to usun??.

Znajd? i usu?:
Kod
'L_DELETE_USER' => $lang['User_delete'],
'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'],
'L_DEL_ACC' => $lang['txt_user_acc'],

Nast?pnie znajd?:
Kod
if( isset($HTTP_POST_VARS['deleteuser']) && ( $HTTP_GET_VARS['mode'] == 'editprofile' || $HTTP_POST_VARS['mode'] == 'editprofile' ) && $userdata['user_level'] == USER )

I dodaj po tym:
Kod
$template->assign_block_vars('delete_user', array(
'L_DELETE_USER' => $lang['User_delete'],
'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'],
'L_DEL_ACC' => $lang['txt_user_acc']
));

Teraz otw?rz plik: profile_add_body.tpl i to:
Kod
<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_DEL_ACC}</th>
</tr>
<tr>
<td class="row1"><span class="gen">{L_DELETE_USER}</span></td>
<td class="row2">
<input type="checkbox" name="deleteuser">
<span class="genmed">{L_DELETE_USER_EXPLAIN}</span></td>
</tr>

Znue? na:
Kod
<!-- BEGIN delete_user -->
<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{delete_user.L_DEL_ACC}</th>
</tr>
<tr>
<td class="row1"><span class="gen">{delete_user.L_DELETE_USER}</span></td>
<td class="row2">
<input type="checkbox" name="deleteuser">
<span class="genmed">{delete_user.L_DELETE_USER_EXPLAIN}</span></td>
</tr>
<!-- END delete_user -->

;)

nitro18 - Nie 22 Lip, 2007

ooo. Knofel dzieki Ci bardzo ;)

[ Dodano: Nie 22 Lip, 2007 ]
Co? nie tak. Nie dzia?a :(

Tommy76 - Czw 02 Sie, 2007

M?g?by kto? poprawi? ten mod, poniewa? nie za bardzo dzia?a. S? problemy z rejestracj?, a po zastosowaniu poprawek by KnofeL mod si? ca?y sypie.

Edit:

Zrobi?em ju? swoj? wersj?. Jest dost?pna TUTAJ


Powered by phpBB modified by Przemo © 2003 phpBB Group