In notification bar accept or deny
This commit is contained in:
@@ -28,4 +28,4 @@ if(!empty($_POST["request"]) AND $friendship_status == 0) {
|
|||||||
|
|
||||||
$username = getUsername($_POST["userID"]);
|
$username = getUsername($_POST["userID"]);
|
||||||
|
|
||||||
header("Location: profile.php?username=$username");
|
header("Location: ../profile.php?username=$username");
|
||||||
@@ -1,9 +1,19 @@
|
|||||||
function showFriendNotifications(notifications) {
|
function showFriendNotifications(notifications) {
|
||||||
$("#friendrequestslist").html("");
|
$("#friendrequestslist").html("");
|
||||||
for (i in notifications) {
|
for (i in notifications) {
|
||||||
|
var outgoing = "";
|
||||||
|
if (notifications[i].friend_state == "3") {
|
||||||
|
outgoing = "<button\
|
||||||
|
name='accept' \
|
||||||
|
class='accept-notification' \
|
||||||
|
value='"+ notifications[i].userID +"'> \
|
||||||
|
<i class='fa fa-check'></i> \
|
||||||
|
</button>";
|
||||||
|
}
|
||||||
|
|
||||||
$("#friendrequestslist").append(" \
|
$("#friendrequestslist").append(" \
|
||||||
<li class='friend-item'> \
|
<li class='friend-item'> \
|
||||||
<form action='profile.php' method='post'> \
|
<form action='profile.php' method='get'> \
|
||||||
<button type='submit' \
|
<button type='submit' \
|
||||||
name='username' \
|
name='username' \
|
||||||
value='"+ notifications[i].username +"'> \
|
value='"+ notifications[i].username +"'> \
|
||||||
@@ -15,18 +25,14 @@ function showFriendNotifications(notifications) {
|
|||||||
</form> \
|
</form> \
|
||||||
<div class='notification-options'>\
|
<div class='notification-options'>\
|
||||||
<form action='API/edit_friendship.php' method='post'> \
|
<form action='API/edit_friendship.php' method='post'> \
|
||||||
|
<input type='hidden' name='userID' value='"+ notifications[i].userID +"' /> \
|
||||||
|
"+ outgoing +" \
|
||||||
<button type='submit' \
|
<button type='submit' \
|
||||||
name='accept' \
|
|
||||||
class='accept-notification' \
|
|
||||||
value='"+ notifications[i].userID +"'> \
|
|
||||||
<i class='fa fa-check'></i> \
|
|
||||||
</button>\
|
|
||||||
<button\
|
|
||||||
name='delete' \
|
name='delete' \
|
||||||
class='deny-notification' \
|
class='deny-notification' \
|
||||||
value='"+ notifications[i].userID +"'> \
|
value='"+ notifications[i].userID +"'> \
|
||||||
<i class='fa fa-times'></i> \
|
<i class='fa fa-times'></i> \
|
||||||
</button> \
|
</button>\
|
||||||
<form>\
|
<form>\
|
||||||
</div> \
|
</div> \
|
||||||
</li> \
|
</li> \
|
||||||
|
|||||||
@@ -39,6 +39,21 @@ function selectAllFriendRequests() {
|
|||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
|
CASE `status` IS NULL
|
||||||
|
WHEN TRUE THEN 0
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `status` = 'confirmed'
|
||||||
|
WHEN TRUE THEN
|
||||||
|
1
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `user1ID` = :userID
|
||||||
|
WHEN TRUE THEN
|
||||||
|
2
|
||||||
|
WHEN FALSE THEN
|
||||||
|
3
|
||||||
|
END
|
||||||
|
END
|
||||||
|
END AS `friend_state`,
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
|
|||||||
Reference in New Issue
Block a user