ADDED : Unscriptions
FIXED : PM order
This commit is contained in:
parent
1c4944b535
commit
491f93d466
6 changed files with 106 additions and 5 deletions
|
@ -203,6 +203,24 @@ if(!empty($mode))
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'unsubscribe_user':
|
||||||
|
{
|
||||||
|
$subscribe_to = mysql_clean($_POST['subscribe_to']);
|
||||||
|
$userquery->unsubscribe_user($subscribe_to);
|
||||||
|
if(msg())
|
||||||
|
{
|
||||||
|
$msg = msg_list();
|
||||||
|
$msg = '<div class="msg">'.$msg[0].'</div>';
|
||||||
|
}
|
||||||
|
if(error())
|
||||||
|
{
|
||||||
|
$msg = error_list();
|
||||||
|
$msg = '<div class="error">'.$msg[0].'</div>';
|
||||||
|
}
|
||||||
|
echo $msg;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 'add_friend':
|
case 'add_friend':
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,19 @@ switch($mode)
|
||||||
assign('mode','ban_users');
|
assign('mode','ban_users');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'subscriptions':
|
||||||
|
{
|
||||||
|
//Removing subscription
|
||||||
|
if(isset($_GET['delete_subs']))
|
||||||
|
{
|
||||||
|
$sid = mysql_clean($_GET['delete_subs']);
|
||||||
|
$userquery->unsubscribe_user($sid);
|
||||||
|
}
|
||||||
|
assign('mode','subs');
|
||||||
|
assign('subs',$userquery->get_user_subscriptions(userid()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ class cb_pm
|
||||||
global $db;
|
global $db;
|
||||||
if(!$uid)
|
if(!$uid)
|
||||||
$uid = userid();
|
$uid = userid();
|
||||||
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.userid,users.username'," message_id='$mid' AND message_to LIKE '%#$uid#%' AND userid=".$this->tbl.".message_from");
|
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.userid,users.username'," message_id='$mid' AND message_to LIKE '%#$uid#%' AND userid=".$this->tbl.".message_from",NULL," date_added DESC ");
|
||||||
|
|
||||||
if($db->num_rows>0)
|
if($db->num_rows>0)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@ class cb_pm
|
||||||
}else{
|
}else{
|
||||||
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
||||||
$this->tbl.".message_to LIKE '%#$uid#%' AND users.userid = ".$this->tbl.".message_from
|
$this->tbl.".message_to LIKE '%#$uid#%' AND users.userid = ".$this->tbl.".message_from
|
||||||
AND ".$this->tbl.".message_box ='in' AND message_type='pm'");
|
AND ".$this->tbl.".message_box ='in' AND message_type='pm'",NULL," date_added DESC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -377,7 +377,7 @@ class cb_pm
|
||||||
}else{
|
}else{
|
||||||
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
||||||
$this->tbl.".message_from = '$uid' AND users.userid = ".$this->tbl.".message_from
|
$this->tbl.".message_from = '$uid' AND users.userid = ".$this->tbl.".message_from
|
||||||
AND ".$this->tbl.".message_box ='out'");
|
AND ".$this->tbl.".message_box ='out'",NULL," date_added DESC");
|
||||||
|
|
||||||
|
|
||||||
//One More Query Need To be executed to get username of recievers
|
//One More Query Need To be executed to get username of recievers
|
||||||
|
@ -429,7 +429,7 @@ class cb_pm
|
||||||
}else{
|
}else{
|
||||||
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
$result = $db->select($this->tbl.',users',$this->tbl.'.*,users.username AS message_from_user ',
|
||||||
$this->tbl.".message_to LIKE '%#$uid#' AND users.userid = ".$this->tbl.".message_from
|
$this->tbl.".message_to LIKE '%#$uid#' AND users.userid = ".$this->tbl.".message_from
|
||||||
AND ".$this->tbl.".message_box ='in' AND message_type='notification'");
|
AND ".$this->tbl.".message_box ='in' AND message_type='notification'",NULL," date_added DESC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1131,6 +1131,9 @@ class userquery extends CBCategory{
|
||||||
if(!$user)
|
if(!$user)
|
||||||
$user = userid();
|
$user = userid();
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
if(!$user)
|
||||||
|
return false;
|
||||||
$result = $db->select($this->dbtbl['subtbl'],"*"," subscribed_to='$to' AND userid='$user'");
|
$result = $db->select($this->dbtbl['subtbl'],"*"," subscribed_to='$to' AND userid='$user'");
|
||||||
if($db->num_rows>0)
|
if($db->num_rows>0)
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -1138,6 +1141,25 @@ class userquery extends CBCategory{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to remove user subscription
|
||||||
|
*/
|
||||||
|
function remove_subscription($subid,$uid=NULL)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
if(!$uid)
|
||||||
|
$uid = userid();
|
||||||
|
if($this->is_subscribed($subid,$uid))
|
||||||
|
{
|
||||||
|
$db->execute("DELETE FROM ".$this->dbtbl['subtbl']." WHERE userid='$uid' AND subscribed_to='$subid'");
|
||||||
|
e("You have unsubscribed sucessfully","m");
|
||||||
|
return true;
|
||||||
|
}else
|
||||||
|
e("You are not subscribed");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}function unsubscribe_user($subid,$uid=NULL){ return $this->remove_subscription($subid,$uid); }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function used to get user subscibers
|
* Function used to get user subscibers
|
||||||
|
@ -1180,6 +1202,8 @@ class userquery extends CBCategory{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function used to reset user password
|
* Function used to reset user password
|
||||||
* it has two steps
|
* it has two steps
|
||||||
|
|
|
@ -4,7 +4,13 @@
|
||||||
<div class="usr_thumb_container" align="center">
|
<div class="usr_thumb_container" align="center">
|
||||||
<img src="{$userquery->getUserThumb($u)}" alt="{$u.username}" class="user_thumb">
|
<img src="{$userquery->getUserThumb($u)}" alt="{$u.username}" class="user_thumb">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{if !$userquery->is_subscribed($u.userid)}
|
||||||
<span class="cb_button" onClick="subscriber('{$u.userid}','subscribe_user','result_cont')">{lang code='subscribe'}</span><br>
|
<span class="cb_button" onClick="subscriber('{$u.userid}','subscribe_user','result_cont')">{lang code='subscribe'}</span><br>
|
||||||
|
{else}
|
||||||
|
<span class="cb_button" onClick="subscriber('{$u.userid}','unsubscribe_user','result_cont')">{lang code='unsubscribe'}</span><br>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{assign var='channel_action_links' value=$userquery->get_channel_action_links($u)}
|
{assign var='channel_action_links' value=$userquery->get_channel_action_links($u)}
|
||||||
<ul class="channel_action_links">
|
<ul class="channel_action_links">
|
||||||
{foreach from=$channel_action_links item=link key=link_title}
|
{foreach from=$channel_action_links item=link key=link_title}
|
||||||
|
@ -86,7 +92,7 @@
|
||||||
{assign var=users_items_subscriptions value=func->config(users_items_subscriptions)}
|
{assign var=users_items_subscriptions value=func->config(users_items_subscriptions)}
|
||||||
{assign var='usr_subs' value=$userquery->get_user_subscriptions($u.userid,$users_items_subscriptions)}
|
{assign var='usr_subs' value=$userquery->get_user_subscriptions($u.userid,$users_items_subscriptions)}
|
||||||
{section name=u_list loop=$usr_subs}
|
{section name=u_list loop=$usr_subs}
|
||||||
{include file="$style_dir/blocks/user.html" user=$usr_subs[u_list] block_type='small'}
|
{include file="$style_dir/blocks/user.html" user=$usr_subs[u_list] block_type='small'}
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
<div align="center"><em><strong>{lang code='user_no_subscriptions' assign='user_subs'}{$user_subs|sprintf:$u.username}</strong></em></div>
|
<div align="center"><em><strong>{lang code='user_no_subscriptions' assign='user_subs'}{$user_subs|sprintf:$u.username}</strong></em></div>
|
||||||
{/section}
|
{/section}
|
||||||
|
|
|
@ -262,4 +262,44 @@ OR
|
||||||
<!-- Banning Users End-->
|
<!-- Banning Users End-->
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
{if $mode=='subs'}
|
||||||
|
<h2>Manage Subscriptions</h2>
|
||||||
|
|
||||||
|
|
||||||
|
{if $subs}
|
||||||
|
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="manage_contacts_tbl_head">
|
||||||
|
<tr>
|
||||||
|
<td width="15"><input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/></td>
|
||||||
|
<td width="50"> </td>
|
||||||
|
<td>Username</td>
|
||||||
|
<td width="100">views</td>
|
||||||
|
<td width="50"> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{foreach from=$subs item=sub}
|
||||||
|
<div class="manage_contacts_tbl">
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td width="15"><input type="checkbox" name="sub[]" id="check_userd-{$user_detail.userid}" value="{$sub.subscribed_to}" /></td>
|
||||||
|
<td width="50" height="50" align="center" valign="middle"><a href="{$userquery->profile_link($sub)}"><img src="{$userquery->getUserThumb($sub)}" alt="{$sub.username}" width="40" height="40" border="0"></a></td>
|
||||||
|
<td><a href="{$userquery->profile_link($sub)}">{$sub.username}</a> | <a href="{$userquery->get_user_videos_link($sub)}">View Videos</a></td>
|
||||||
|
<td width="100">{$sub.profile_hits|number_format}</td>
|
||||||
|
|
||||||
|
<td width="50" align="center" valign="middle"><a href="?mode=subscriptions&delete_subs={$sub.subscribed_to}"><img src="{$imageurl}/cancel.png" width="16" height="16" border="0" /></a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
{else}
|
||||||
|
<div><em><strong>No subscription found</strong></em></div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue