View Full Version : PhotoPost Random Image Option
SVTBlackLight01
08-18-2003, 12:32 AM
I have made an add-on that will display random images from PhotoPost on the forums home page, seen here: http://www.modernengineuity.com/forums/index.php
What I want to do is make this an option in the user CP. I have already added the option to the user control panel and made a separate forumhome template.
What I need help with is modifying index.php to display this template depending on whether or not the user has chosen this option.
Thanks.
Dean C
08-18-2003, 10:40 AM
Add a field fo the user table. Then make your radio buttons in the modifyoptions template. And use your name attributes value to update the field to 1 for yes and 0 to no :)
- miSt
SVTBlackLight01
08-18-2003, 11:12 AM
Thanks for the reply Mist. That's exactly what I have done. I wasn't completely sure of that so it's good to know.
What I need to do now, and what is giving me problems, is use this to display or not display the random image template on the forums home.
Does that make sense?
Dean C
08-18-2003, 01:04 PM
if($bbuserinfo['userfield']==1) // i.e. it's set to yes
{
// your stuff that happens when its set to yes goes here
}
SVTBlackLight01
08-18-2003, 01:42 PM
Well, tried a few things, but it didn't work.
Here is what I'm using to display the thumbnails now
// Thumbnail includer hack
ob_start();
require("../test.php");
$thumbnails = ob_get_contents();
ob_end_clean();
// Thumbnail includer hack end
So is this right to make it optional?
if($bbuserinfo['showphoto']==1) // i.e. it's set to yes
{
// Thumbnail includer hack
ob_start();
require("../test.php");
$thumbnails = ob_get_contents();
ob_end_clean();
// Thumbnail includer hack end
}
And where should it go?
Sorry for all the questions.
Dean C
08-18-2003, 04:03 PM
No idea where you want to put it but that's how the code should be :)
- miSt
SVTBlackLight01
08-18-2003, 08:57 PM
Thanks for all the help so far. I figured out how to make it work that way. The only problem is that I had the table for the thumbnails hardcoded in the forumhomes template. So when the option was set to no it just left an empty table.
I made a completely separate template for this, but I haven't had any luck calling the template. I'm thinking you have to set the variable for the template in index.php and then add the variable to the forumshome template where I want it to show up, right?
Any idea how to do this?
SVTBlackLight01
08-20-2003, 06:26 PM
Anybody have any suggestions? :confused:
SVTBlackLight01
08-23-2003, 12:28 PM
After taking a break from it, I got it working. I guess I had just been at it for too long before, because I figured it out pretty quickly this time around. If anyone is interested in using it, PM me.
You should simply post it...
SVTBlackLight01
09-01-2003, 10:18 AM
OK. Will do so shortly. :)
lasto
09-01-2003, 12:29 PM
works brilliant m8
i just logged in at your forum and i seen the pics so wetn to usercp turned em off and bingo they gone.
Well done m8
SVTBlackLight01
09-01-2003, 01:13 PM
Thanks! :D
lasto
09-01-2003, 03:40 PM
Lo m8,feedback as promised and thanks for letting me be a tester on this hack.Install time for me was about 15 mins max on vb2.3.
Installation went smooth - had no errors what so ever and it works :)
wot can i say it works - the box appears and there is 4 images in it (only downside is it says no image available but this could be to the fact photopost is not inside the vbull dir,but i have called it in and it shows the name and views etc so just need to solve this one.)
Anyway went to usercp and switched it off and bingo it was gone.
Hacks works sweet m8 - is one small thing though is there a query where i can set it so they are all off by default as i prefer it this way.
Top hack so congrats on your next release :)
Edit - pic attached as u can see the names are there just not pic an di cant run photopost in the same dir as vbull as some files have same name etc.
Adds 1 querie to main page
SVTBlackLight01
09-01-2003, 09:46 PM
Glad you like it.
You can set it to be off by default by running this query:
ALTER TABLE `user` CHANGE `showphoto` `showphoto` SMALLINT( 6 ) DEFAULT '0' NOT NULL
As far as the problem with getting the "thumbnail not available", I'll take a look at it.
Mickie D
09-01-2003, 10:31 PM
how do you call your photos from your gallery to your board ???
are u using the thumbincluder.php or you use another method ???
i am currently writing addon hacks for pixelfx's photopost intergration (i just wrote a addon for forum home aswell :))
i have got quite tied into this lol... and i am looking for a better way to call it than implode
SVTBlackLight01
09-01-2003, 10:48 PM
Yes. This is using the thumbnail includer.
Actually the code to call the thumbs is taken form the PhotoPost site.
Here is what I used in index.php:
// Thumbnail includer hack
ob_start();
require("yourfile.php");
$thumbnails = ob_get_contents();
ob_end_clean();
// Thumbnail includer hack end
Then you can basically call the $thumbnails anywhere you want the thumbs to be displayed.
I'm finalizing the full instructions for the rest of it as well and will posting them soon.
themonarch
09-01-2003, 11:01 PM
I've been working on calling a specific user's photos and placing them in their profile. I'm getting close but it's not working yet. This is my first attempt at such a large modification. Here's what I'm doing so far.
Here's my php page code to get the user's photopost image, which when I load it in a browser window works:
<?php
//Connection statement
require_once('Connections/picConn.php');
// begin Recordset
$query_Recordset1 = "SELECT * FROM photos WHERE photos.userid = ('$userid')";
$Recordset1 = $picConn->SelectLimit($query_Recordset1) or die($picConn->ErrorMsg());
$totalRows_Recordset1 = $Recordset1->RecordCount();
// end Recordset
?>
<img src="mediapost/data/500/<?php echo $Recordset1->Fields('bigimage'); ?>" width="120" height="120">
<?php
$Recordset1->Close();
?>
Here's my connection script:
<?php
# Type="ADODB"
# HTTP="true"
# DBTYPE="mysql"
$MM_picConn_HOSTNAME = "localhost";
$MM_picConn_DATABASE = "mysql:photopost";
$MM_picConn_DBTYPE = preg_replace("/:.*$/", "", $MM_picConn_DATABASE);
$MM_picConn_DATABASE = preg_replace("/^.*?:/", "", $MM_picConn_DATABASE);
$MM_picConn_USERNAME = "username";
$MM_picConn_PASSWORD = "password";
$MM_picConn_LOCALE = "Us";
$MM_picConn_MSGLOCALE = "En";
$MM_picConn_CTYPE = "P";
$KT_locale = $MM_picConn_MSGLOCALE;
$KT_dlocale = $MM_picConn_LOCALE;
$KT_serverFormat = "%Y-%m-%d %H:%M:%S";
$QUB_Caching = "false";
switch (strtoupper ($MM_picConn_LOCALE)) {
case 'EN':
$KT_localFormat = "%d-%m-%Y %H:%M:%S";
break;
case 'EUS':
$KT_localFormat = "%m-%d-%Y %H:%M:%S";
break;
case 'FR':
$KT_localFormat = "%d-%m-%Y %H:%M:%S";
break;
case 'RO':
$KT_localFormat = "%d-%m-%Y %H:%M:%S";
break;
case 'IT':
$KT_localFormat = "%d-%m-%Y %H:%M:%S";
break;
case 'GE':
$KT_localFormat = "%d-%m-%Y %H:%M:%S";
break;
case 'US':
$KT_localFormat = "%Y-%m-%d %H:%M:%S";
break;
default :
$KT_localFormat = "none";
}
if (!defined('CONN_DIR')) define('CONN_DIR',dirname(__FILE__));
require_once(CONN_DIR."/../adodb/adodb.inc.php");
ADOLoadCode($MM_picConn_DBTYPE);
$picConn=&ADONewConnection($MM_picConn_DBTYPE);
if($MM_picConn_DBTYPE == "access" || $MM_picConn_DBTYPE == "odbc"){
if($MM_picConn_CTYPE == "P"){
$picConn->PConnect($MM_picConn_DATABASE, $MM_picConn_USERNAME,$MM_picConn_PASSWORD,
$MM_picConn_LOCALE);
} else $picConn->Connect($MM_picConn_DATABASE, $MM_picConn_USERNAME,$MM_picConn_PASSWORD,
$MM_picConn_LOCALE);
} else if (($MM_picConn_DBTYPE == "ibase") or ($MM_picConn_DBTYPE == "firebird")) {
if($MM_picConn_CTYPE == "P"){
$picConn->PConnect($MM_picConn_HOSTNAME.":".$MM_picConn_DATABASE,$MM_picConn_USERNAME,$MM_pic Conn_PASSWORD);
} else $picConn->Connect($MM_picConn_HOSTNAME.":".$MM_picConn_DATABASE,$MM_picConn_USERNAME,$MM_pic Conn_PASSWORD);
}else {
if($MM_picConn_CTYPE == "P"){
$picConn->PConnect($MM_picConn_HOSTNAME,$MM_picConn_USERNAME ,$MM_picConn_PASSWORD,
$MM_picConn_DATABASE,$MM_picConn_LOCALE);
} else $picConn->Connect($MM_picConn_HOSTNAME,$MM_picConn_USERNAME, $MM_picConn_PASSWORD,
$MM_picConn_DATABASE,$MM_picConn_LOCALE);
}
if (!function_exists("updateMagicQuotes")) {
function updateMagicQuotes($HTTP_VARS){
if (is_array($HTTP_VARS)) {
foreach ($HTTP_VARS as $name=>$value) {
if (!is_array($value)) {
$HTTP_VARS[$name] = addslashes($value);
} else {
foreach ($value as $name1=>$value1) {
if (!is_array($value1)) {
$HTTP_VARS[$name1][$value1] = addslashes($value1);
}
}
}
global $$name;
$$name = &$HTTP_VARS[$name];
}
}
return $HTTP_VARS;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = updateMagicQuotes($HTTP_GET_VARS);
$HTTP_POST_VARS = updateMagicQuotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = updateMagicQuotes($HTTP_COOKIE_VARS);
}
}
if (!isset($HTTP_SERVER_VARS['REQUEST_URI'])) {
$HTTP_SERVER_VARS['REQUEST_URI'] = $HTTP_SERVER_VARS['PHP_SELF'];
}
?>
And when I load the page in the browser using this format to switch users, it works...just switch the number of the user on the end.
http://www.allartistaccess.com/profilepics.php?userid=43
How would I get this to be over in the template getinfo?
SVTBlackLight01
09-01-2003, 11:19 PM
You could try the same method as above to set the variable and then call the variable in the profile template.
You would have to add the code to member.php.
lasto
09-02-2003, 01:16 AM
lo SVTBlackLight01,cheers for pm all works ok now :0
SVTBlackLight01
09-02-2003, 02:03 AM
That's great! :D
SVTBlackLight01
09-03-2003, 01:06 AM
OK. Here is the install instructions for turning the PhotoPost thumbnails on/off in the user CP.
SVTBlackLight01
09-03-2003, 01:10 AM
Additional instructions for adding the option to the admin control panel.
SVTBlackLight01
09-03-2003, 01:18 AM
User CP
SVTBlackLight01
09-03-2003, 01:20 AM
Forums Home
lasto
09-03-2003, 06:54 AM
excellant m8 - quite a good hack and glad to see u released it.
gmarik
09-03-2003, 12:37 PM
Evertything works?
Than publish it as a beta hack ... pls
lasto
09-03-2003, 03:11 PM
one small thing
hack was working fine till today so unsure if was me or not.But if i go in usercp/options and turn it off then back to index page they still there.So i did a search in all files for $showphoto and its now there.Weird i know so i went back to usercp/options and where i had turned it off it had auto turned back on.
Checked it about 5 times and every time i turned it off refresh page it was back on.Any idea what could be doing that ?
SVTBlackLight01
09-03-2003, 06:18 PM
I have tried to reproduce this problem repeatedly on my board, but everything is working fine.
If you added the admin option, the problem may be there. You could try using the original user.php to see if that fixes the problem. I am using both the user CP and admin CP options, however with no problems. I'm running 2.2.9.
lasto
09-03-2003, 06:43 PM
m8 your hack works fine - will e down to my end i added a few hacks today and of course checking that this worked after i did em was last thing on my mind so i will just need to re-trace my route and see what damage i done :)
Also your hack is basically 2 hacks you know.
Cause if u forget the bit about the photos you have an excellant system for people to show a box on the forum homepage consisting of stats or links etc and users can decide if they would like to see it by turning it on/off in usercp.
SVTBlackLight01
09-03-2003, 08:03 PM
Today at 08:37 AM gmarik said this in Post #27 (https://vborg.vbsupport.ru/showthread.php?postid=430963#post430963)
Evertything works?
Then publish it as a beta hack ... pls
I'll do that soon.
lasto,
Let us know if you get it worked out. Good point too about being able to use it for other things as well. I'm suprised it hasn't been done before.
sabret00the
09-25-2003, 10:42 PM
good hack, you should've released it seperately, it's hidden away in here :(
SVTBlackLight01
09-26-2003, 09:37 AM
Thanks. :D
I am still planning on releasing it as a separate hack, I just haven't had much time for anything but work lately.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.