Posts: 14
Threads: 3
Joined: Jan 2015
30-Jan-2015, 08:47 AM
Hello there,
I have a login system on my site and I want my users to upload avatars they want so these avatars can be displayed on the commenting system. If there are no logged in users then show default image.
Is that snippet beyond your service?
Posts: 2,894
Threads: 59
Joined: Jun 2010
Hi,
Does your site already have the ability for users to upload their avatars? If so then it wouldn't be difficult to integrate that with Commentics and I could provide help with that. If your site doesn't have that ability and you're asking for me to build it, either for your site or for Commentics itself, then yes it's beyond the support of the project.
Have
you completed
the interview?
Posts: 14
Threads: 3
Joined: Jan 2015
Fortunately, I have the ability to upload avatars.
I have the following code but when I log in my avatar is on the every comment then...
I know that there is should be another logic. I'm still thinking exactly what kind of logic...
Here's my code
PHP Code:
<?php
$stmt = $db->prepare("SELECT * FROM users WHERE user_id = :user_id");
// bind the parameters
$stmt->bindParam(':user_id', $_SESSION['user_id'], PDO::PARAM_STR);
// execute the prepared statement
$stmt->execute();
$row = $stmt->rowCount();
if ($row != NULL)
{
while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
if ($row['user_id'])
{
$old_picture = $row['picture'];
$cmtx_box .= '<img src="' . MM_UPLOADPATH . $old_picture . '" alt="Profile Picture" />';
}
}
}
else
{
$cmtx_box .= "<img src='http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . ".png?s=71" . $gravatar_parameter . "' alt='Gravatar' title='Gravatar'/>";
}