PDA

View Full Version : drop down user list


skidpics
June 10th, 2008, 07:30 PM
Just noticed this in the uploadphoto.php file.

I removed the comment block, but it doesn't work..

//if you have a low number of users you can use this drop down list box, otherwise you have to input the name manually
//$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['userid']}\">{$User['username']}</option>";
//$useroptions .= useropts();
//$useroptions .= "</select>";

Chuck S
June 11th, 2008, 07:06 AM
You would need to actually comment out the other useroptions lines in uploadphoto.php to see a difference.


//if you have a low number of users you can use this drop down list box, otherwise you have to input the name manually
$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['username']}\">{$User['username']}</option>";
$useroptions .= useropts();
$useroptions .= "</select>";
//if ( $Globals['vbversion'] == "fusion" || $Globals['vbversion'] == "threads" || $Globals['vbversion'] == "threads7" )
//{
//$useroptions = "<input type=\"text\" name=\"upuser\" value=\"{$User['login']}\" />";
//}
//else
//{
//$useroptions = "<input type=\"text\" name=\"upuser\" value=\"{$User['username']}\" />";
//}

skidpics
June 11th, 2008, 09:29 AM
I thought about that after I posted the post. It is an interesting little gem undiscovered by most admins. Thanks!

Chuck S
June 11th, 2008, 09:30 AM
Not a problem glad to help.

skidpics
June 12th, 2008, 09:21 AM
On anything I choose, I get error user not found..

Chuck S
June 12th, 2008, 09:23 AM
Please post a url and a test login

skidpics
June 12th, 2008, 10:14 AM
Cannot PM you the details..

Chuck S has chosen not to receive private messages or may not be allowed to receive private messages. Therefore you may not send your message to him/her.

Chuck S
June 12th, 2008, 11:40 AM
It is fine to post a url here and a test user login non admin. You can do that or email support. That is correct I do not use the PM system here.

skidpics
June 12th, 2008, 11:42 AM
Your username is: chuck
Your new password is: REMOVED



Skidpics - Free Photo Sharing,Free Wallpaper and Free Screensavers - Main Index (http://skidpics.com)

Chuck S
June 12th, 2008, 12:21 PM
I have removed the password please make that user an admin or email us an admin login

regular users dont seem to be affected

Skidpics - Free Photo Sharing,Free Wallpaper and Free Screensavers - chuck Gallery (http://skidpics.com/showgallery.php?cat=500&ppuser=617)

Chuck S
June 12th, 2008, 12:27 PM
I made a slight change to the code in post 2 as this is way old code reapply and see if that helps.

skidpics
June 12th, 2008, 11:33 PM
I have removed the password please make that user an admin or email us an admin login

regular users dont seem to be affected

Skidpics - Free Photo Sharing,Free Wallpaper and Free Screensavers - chuck Gallery (http://skidpics.com/showgallery.php?cat=500&ppuser=617)

User is admin now. applying the code right now also..
..

Code modification did not work.
what was changed?

Chuck S
June 13th, 2008, 08:24 AM
Basically upuser is a username variable not userid that old legacy code passes upuser as the userid not username so I simply changed the code to username

Try this


//if you have a low number of users you can use this drop down list box, otherwise you have to input the name manually
//$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['userid']}\">{$User['username']}</option>";
//$useroptions .= useropts();
//$useroptions .= "</select>";
if ( $Globals['vbversion'] == "fusion" || $Globals['vbversion'] == "threads" || $Globals['vbversion'] == "threads7" )
{
$useroptions = "<input type=\"text\" name=\"upuser\" value=\"{$User['login']}\" />";
}
else
{
$useroptions = "<input type=\"text\" name=\"upuser\" value=\"{$User['username']}\" />";
}



change to this


if ( $Globals['vbversion'] == "fusion" || $Globals['vbversion'] == "threads" || $Globals['vbversion'] == "threads7" )
{
$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['login']}\">{$User['username']}</option>";
$useroptions .= useropts();
$useroptions .= "</select>";
}
else
{
$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['username']}\">{$User['username']}</option>";
$useroptions .= useropts();
$useroptions .= "</select>";
}

Chuck S
June 13th, 2008, 08:27 AM
Then in your integration file photopost.php make sure the useropts function is this


function useropts() {
global $Globals, $db_link;

$useropts = "";

$queryv = ppmysql_query("SELECT userid,username FROM {$Globals['pp_db_prefix']}users ORDER BY name",$db_link);
while ( list( $userid, $username ) = mysql_fetch_row($queryv) ) {
$useropts .= "<option value=\"$username\">$username</option>";
}

return( $useropts );
}

skidpics
June 13th, 2008, 09:27 AM
With the change in photopost.php, I am getting this error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/vande11/public_html/skidpics/forums/photopost.php on line 78

Chuck S
June 13th, 2008, 10:09 AM
Wow that function is archaic. Reapply the code edit above in photopost.php

skidpics
June 13th, 2008, 10:13 AM
same error. perhaps I should just leave it as is.. since the coding is so old?

actually, the userid is not changed to upuser in the code you posted ?

skidpics
June 13th, 2008, 10:32 AM
yea, I replaced userid with upuser and that didn't work either.

Chuck S
June 13th, 2008, 10:40 AM
The edit in uploadphoto.php should remain as posted in post 13. My last post explained to update the user options function in post 14 as thats where I made the change to that query

http://www.photopost.com/forum/1226217-post14.html

skidpics
June 13th, 2008, 10:48 AM
I applied the below to uploadphoto.php:
if ( $Globals['vbversion'] == "fusion" || $Globals['vbversion'] == "threads" || $Globals['vbversion'] == "threads7" )
{
$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['login']}\">{$User['username']}</option>";
$useroptions .= useropts();
$useroptions .= "</select>";
}
else
{
$useroptions = "<select name=\"upuser\"><option selected=\"userid\" value=\"{$User['username']}\">{$User['username']}</option>";
$useroptions .= useropts();
$useroptions .= "</select>";
}

and this to photopost.php:
function useropts() {
global $Globals, $db_link;

$useropts = "";

$queryv = ppmysql_query("SELECT userid,username FROM {$Globals['pp_db_prefix']}users ORDER BY name",$db_link);
while ( list( $userid, $username ) = mysql_fetch_row($queryv) ) {
$useropts .= "<option value=\"$username\">$username</option>";
}

return( $useropts );
}

still getting:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/vande11/public_html/skidpics/forums/photopost.php on line 78

Chuck S
June 13th, 2008, 10:53 AM
That makes no sense until I look farther at that archaic query

ORDER BY name

change to

ORDER BY username

;)

skidpics
June 13th, 2008, 12:02 PM
It works! Thanks!
I always wondered something, is the source code updated when you make changes like this, if it is not considered a tweak, so that is is working in the download of the base install?

Chuck S
June 13th, 2008, 12:35 PM
I will be passing this along to Michael about the useropts thing etc