This deletes user's wall comments, but not work in feed page, status and viewstory. Where can I it wrong code,Deleting but coming back we refresh the page. i need help
thanks
jquery.module.php find
[code] function stream_delete($storyid) {
global $client, $config;
if (!$client['id']) die('please login first');
$res = sql_query("select * from ".tb()."streams where id='$storyid'");
$stream = sql_fetch_array($res);
if (!$stream['id']) die('wrong sid');
if ($stream['uid'] == $client['id'] || in_array('3',$client['roles']) ) {
sql_query("update ".tb()."streams set hide=1 where id='{$stream['id']}'");
echo 'ok';
}
else {
echo 'access denied';
}
exit;
}[/code]
After add
[code] function comment_delete($comment_id) {
global $client, $config;
if (!$client['id']) die('please login first');
$res = sql_query("select * from ".tb()."comments where id='$comment_id'");
$comment = sql_fetch_array($res);
if (!$comment['id']) die('wrong sid');
if ($comment['uid'] == $client['id'] || in_array('3',$client['roles']) ) {
sql_query("update ".tb()."comments set hide=1 where id='{$comment['id']}'");
echo 'ok';
}
else {
echo 'access denied';
}
exit;
} [/code]
to includes\libs\common.inc.php find
[code]$config['stream_delete_form_displayed'] = 1;
c('<script>
$(document).ready( function(){[/code]
After add
[code]$("a[class=comment_delete]").click( function () {
var parentdd = $(this).parents(".user_comment");
var sid = $(this).prev()[0].value;
$(this).after("<img src=\''.uhome().'/files/loading.gif\' /> '.t('hiding..').'");
$(this).hide(); $.get(\''.uhome().'/index.php?p=jquery/comment_delete/\'+sid,
function(data) {
parentdd.hide("slow");
});
return false;
});[/code]
ss.inc.php function find
[code] $row['avatar'] = $row2['avatar'];
$row['fullname'] = $row2['fullname'];
};
if (!strlen($row['fullname'])) $row['fullname'] = $row['username']; [/code]
After add
[code]$hidelink = ($row['uid'] == get_client('id') || in_array('3',get_client('roles')))?'<input type="hidden"name="commentid" value="'.$row["id"].'" /><a href="#" class="comment_delete"><b>x</b></a>':'';[/code]
find
[code] '.h($row['message']).'
<div class="att_bottom">'.get_date($row['created']).'</div></td>[/code]
After add
[code]<td valign="top" width="5px">'.$hidelink.'</td> [/code]
|