Arrow Home arrow Forums
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


<< Start < Prev 1 2 Next > End >>
Admin change User Picture
Date: 2006/01/30 23:03 By: deimann Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 2
graphgraph
How can i, as an admin, change the User Photo?
Click here to see the profile of this user The topic has been locked.

Re:Admin change User Picture
Date: 2006/01/31 00:46 By: rick Status: User  
Karma: 43  
Gold Joomlapolitan

Posts: 290
graphgraph
Without using mysql you can't. If you are really intent on this then you would have to go into mysql find the user id then find the photo associated to that id and replace it with the new photo.
Rick

Running:
Joomla! 1.0.7 Stable
Community Builder 1.0 rc2
SMF 1.1 RC2
Click here to see the profile of this user The topic has been locked.

Re:Admin change User Picture
Date: 2006/01/31 00:54 By: deimann Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 2
graphgraph
Well, my problem is that there are no pictures yet, and i want to attach them.
I already tried it in sql, but it does not work. I updated the user entry in jos_comprofiler. But it seems that it is not enough just tu put a Filename (which exists in the right directory) in the field avatar.
Click here to see the profile of this user The topic has been locked.

Re:Admin change User Picture
Date: 2006/01/31 04:25 By: Overhaul Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 3
graphgraph
I went thru this a couple months back. Here is what I found at MamboJoe.com :


Right now the only way for an admin to add photos is to log into your cpanel and access your myphpadmin. Of course back up your database first, before you start playing. Just in case.

Find the mos_comprofiler table, and click the browse tab. You will then see all your users. You will then access the user you want to add a photo to by clicking on the pencil. Make sure nothing is checked "null". Put the name of the photo in the avatar field, and the following approved and confirmed fields should have a "1" in them. Scroll to the bottom of the page and click "Go".

You will need to upload the images by ftp to the folder that contains the avatars on your server. I create both a thumbnail and the regular photo. 60x80 for the thumb, and 200x267 for the standard photo. If the image you have is named "bill.jpg", call the thumb "tnbill.jpg".

It is a pain in the butt, but it works. I had to go through this for a company employee site.

If anyone has an easier way to do it, I would love to hear it. It would make my life easier.


http://www.mambojoe.com/index.php?option=com_simpleboard&Itemid=25&func=view&catid=6&id=8181#8181

I hope this helps. I'm not sure if it is the same with RC2. I did this with while using the RC1 release.
Click here to see the profile of this user The topic has been locked.

Re:Admin change User Picture
Date: 2006/08/10 21:00 By: Jeque Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
There is my php-script to add/change user photo.
Some of variables must be edited.

Code:

  <?php $hostname "localhost"; $database "intranet"; $username "root"; $password ""; $link mysql_pconnect($hostname$username$password) or trigger_error(mysql_error(),E_USER_ERROR); session_start(); mysql_select_db($database$link); $query "SELECT * FROM jos_users ORDER BY username ASC"; $result mysql_query($query$link) or die(mysql_error()); $users mysql_fetch_assoc($result); ?> <html> <head> <title>Upload/Change user photo</title> </head> <body> <h2>Upload/Change user photo:</h2> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data"> <p>Username: <select name="user" size=1> <?php  while ($row = mysql_fetch_assoc($result)) {     echo "<option value=".$row["username"].">".$row["username"]."</option>"; } mysql_free_result($result); ?> </select><br/> <p>Upload photo:<br/> <input type="file" name="pictures[]" /><br/> <input type="submit" name="upload" value="Upload" /><br/> </p> </form> <?php if (!isset($_POST["upload"])) {     exit; } $filename = "_".$_FILES["pictures"]["name"][0]; $uploaddir = '/usr/local/www/pub/intranet/images/comprofiler/'; $uploadfile = $uploaddir.$filename; move_uploaded_file($_FILES["pictures"]["tmp_name"][0], $uploadfile) or die("Upload failed"«»); $destWidth = 70;  //preview width $destHeight = 87; //preview height $JPEGquality = 95; $src_file = $uploadfile; $dst_file = $uploaddir."tn".$filename; $imginfo = getimagesize($src_file); $src_img = imagecreatefromjpeg($src_file); $dst_img = imagecreatetruecolor($destWidth, $destHeight); imagecopyresized ($dst_img, $src_img, 0, 0, 0, 0, $destWidth, $destHeight, $imginfo[0], $imginfo[1]) ; imagejpeg ($dst_img, $dst_file, $JPEGquality); imagedestroy($src_img); imagedestroy($dst_img); if ($_FILES["pictures"]["name"][0] != ""«») {     $user=$_POST['user'];     $query = "SELECT * FROM jos_users WHERE username = '".$user."'";     $result = mysql_query($query, $link) or die(mysql_error());     $id = mysql_fetch_assoc($result);     $userid = $id["id"];     mysql_free_result($result);     $query = "UPDATE jos_comprofiler SET avatar = '".$_FILES["pictures"]["name"][0]."' WHERE  user_id = 66";     $query = "UPDATE `jos_comprofiler` SET `avatar` = '".$filename."' WHERE `user_id` = ".$userid;     echo $query;     $result = mysql_query($query, $link) or die(mysql_error());     echo "<br/>File ".$_FILES["pictures"]["name"][0]." has been uploaded as a photo of the user " .$user; } ?> </body> </html>

Click here to see the profile of this user The topic has been locked.

Re:Admin change User Picture
Date: 2006/09/15 03:16 By: Joey2804 Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 10
graphgraph
To where am I adding this script, and if it's a new page, which it looks like it is, what is the filename for the file?
Click here to see the profile of this user The topic has been locked.

<< Start < Prev 1 2 Next > End >>

Documentation

Documentation Subscription Service
(updated for CB 1.2 RC4)

What?

Why?

Where?

Just click here for answers!

Click here for a yearly subscription: subscribe now

Download Latest Release

The latest stable Community Builder Release is version 1.1 for Joomla 1.0 and Mambo.
You need to be a registered member of Joomlapolis to download.

The latest release candidate of Community Builder is version 1.2 RC4, native for Joomla 1.0, 1.5 and Mambo.
It is available as "thank you" to all CB documentation subscribers and now also to all registered joomlapolitans.

CB Login