UBB.Dev
Mod Name / Version: PhotoPost / ReviewPost Integrated Index V3.1

Description: Allows users of PhotoPost and/or ReviewPost to add their categories onto their Threads Main Index (with "featured" photos and reviews).

V3 improves on the V2 and prior works by substantially reducing the number of queries used - in my case going from 80 queries to a handful.

Working Under: UBB.Threads 6.1-6.2-6.3

Mod Status: Finished

Any pre-requisites: PhotoPost and/or ReviewPost

Author(s): PhotoPost

Date: 10/15/03

Credits: Michael Pierce, Omegatron

Files Altered: ubbthreads.tmpl

New Files: ubbt_photopost.tmpl, ubbt_reviewpost.tmpl, photopost.inc.php, reviewpost.inc.php

Database Altered: none

Info/Instructions: The new layout also drops the overhead of a connect request and instead simply does a select_db to use the PhotoPost/ReviewPost databases.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.




Attached File
97057-PhotoPostRP.zip  (115 downloads)
http://www.viperalley.com/ubbthreads.php is my site where these integrations are in use.
thanks for the updates, I could never get the older version to work on one site I was trying it on, I'll give this one a shot now

This works with photopost 4.1 and reviewpost 2?
yes
Thanks for this mod, but.....

I couldn't connect to my Photopost database.

At the end of your instructions, you say to adjust the
$Globals['pp_db_prefix'] = ""; line in the template if my default table prefix was changed, but I can't find any reference to this line anywhere.
OKay he missed a step in the files

Yes you have this you place at top of tghe templates

$Globals['pp_db_prefix'] = ""; with your prefix if not default in between the ""

You then need to change every call to a table like this

FROM photos TO FROM {$Globals['pp_db_prefix']}photos
I'm a coder; not a documenter..... STELLLLLA!
Well I gave it a good try, but still couldn't get this to work. Still couldn't connect to database after making those changes.
Well if you made the changes I stated above you would connect to the database as long as ya got the right database user and password defined in your photopost.inc.php.

I have attached the Photopost Template exactly how it should be per the mod. Place your prefix at the top of the file and set path to the include file and upload.

Attached File
97214-ubbt_photopost.txt  (76 downloads)
Here is the updated reviewpost template to allow setting a proper prefix variable.

Attached File
97216-ubbt_reviewpost.txt  (58 downloads)
I had the template changes right, but the problem (or one of them) was that the photopost.inc.php file never had a reference to database user or password.

I added this:

mysql_connect ("localhost", "my_db_username", "my_password");

to that file and got it to start to work.... it now shows "featured photos" but errors out after that:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/folder/templates/default/ubbt_photopost.tmpl on line 121

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/folder/templates/default/ubbt_photopost.tmpl on line 132


Still trying to figure it out.
That template is working on a site as we speak You need to find out in your error log what part of the query it is chocking on

Here is an updated include file seems Michael included one that have all those lines missing

Attached File
97221-photopost.inc.txt  (49 downloads)
Here is a proper working reviewpost.inc.php file as well

Attached File
97222-reviewpost.inc.txt  (66 downloads)
OK the problem with not connecting to the database had to do with the fact that there is no reference to username or password in the photopost.inc.php file, so I added it as I described above, and it then was able to connect.

(Just so you know, your sample reviewpost.inc.php is nothing like the one included in the ZIP file for this mod.)

The errors I mentioned were a result of not being able to find the categories and Boards in the database. To find the Categories and Boards I had to add {$Globals['pp_db_prefix']} in a few other places in the ubbt_photopost.tmpl. I suppose this problem would have been nonexistent if I hadn't set my photopost installation up with a table prefix.

Delta my photopost.inc.php NOT REVIEWPOST is nothing like the one included I know. I said Michael ommitted the needed information as well as omitting the prefix data.

Using the include files and templates I posted everything works fine. I pulled them from my working site
Ooops, sorry, I guess I skipped over what was right in front of my face. Alrighty. I'm a dope.

It works now. Thanks a lot for your help. I appreciate it. Phew. Holy crap.
One thing I noticed is this mod still suffers from dates not being displayed right as in 12-31-69 and new photo's not being displayed.

Also for lightbulbs to work you need to add

$UserID = $user['U_Number'];

under

$Username = $user['U_Username'];

in ubbthreads.php
OKay here is an updated archive with all corrections from the original post

Attached File
97284-PhotoPostRP.zip  (25 downloads)
Thanks -- that will help people get this running.

I also noticed the whacky dates and the new photos thing. That's a little disconcerting but not a deal-breaker.

Another thing that I had trouble with in my earlier attempts with this was that I had a "hidden" (just visible to me) category I called "Purgatory" where I moved photos that didn't really fit in (I moved them to "Purgatory" rather than delete them outright in case of future disputes, as I do in Threads). Unfortunately that category showed up on the Threads index with this mod. I simply deleted that category for now so it wouldn't show up.

I'm not sure if this was just because of something I did or what (I did try different Photopost settings), but maybe somebody else will be able to verify this without me having to setup another "secret" photo board.
I have updated the original post with the updates posted by Chuck
thank you guys
This mod doesn't use the security settings of PhotoPost to decide who can see what - although that would be a good modification, I havent had time to do it myself (yet).
Okay first post of this mod has been updated to reflect a change that was made to allow lastpost dates to display right.

Basically in laymans terms users where reporting dates being displayed of 12/31/69 which was the start of the unix timestamp translating to 0. This was happening because the lastpost data was being grabbed from the comments/reviews table. However any Photo/Products that had no reviews that column is 0. The changes allows the timestamp to be set by the comments first which of course would have the most current post and if null then set by the product lastpost column.
Thank you!
This is probably not possible - but it would be great to be able to include specific photopost categories - for example if the browser address bar said ...Cat=1&pCat=506 it would then show the photos from photopost category 506, along with threads category 1.

As I say probably not possible - but it would be nice
Well showing only specific categories is easy in the main index.

Combining Threads and Photopost categories in the top index might be a big project.

Being able to create different Indexes with different main index combinations might be easy as creating a few different templates and assigning them.
Question, is it possible to update this to not show the gallery tables if all forums are members only?
What are you using to restrict things by U_Group? You could use the same type of thing.
Since both system use the groups infrormation, you could add some security with a little work. Its been on my list, just not done yet.

One way would be to call authenticate(), but thats probably excessive. Another would be to call set_user_perms (i think thats it) with the userid and then use those variables to process the list.
Okay This hack has been updated to use NEWPOST/COMMENTS INDICATOR COUNTS JUST LIKE THREADS next to the total counts showing how many new since last login.

ONLY ADDS two queries.


Awesome work Chuck.
I updated it again with a config option to set NEW POST TRACKING off or either posts or replies on or both on.
I tried adding this one line to ubbthreads.php to make the lightbulbs work:
[] $UserID = $user['U_Number']; [/]
but I got all these errors:
[]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 201

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 188

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 189 [/]

I removed that line from ubbthreads.php and the errors went away, but I'm not sure if the lightbulbs are working or not.
[]donJulio said:
I tried adding this one line to ubbthreads.php to make the lightbulbs work:
[] $UserID = $user['U_Number']; [/]
but I got all these errors:
[]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 201

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 188

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 189 [/]

I removed that line from ubbthreads.php and the errors went away, but I'm not sure if the lightbulbs are working or not. [/]

The problem you are reporting is very strange indeed. I highly doubt that adding something like this $UserID = $user['U_Number']; which is just a defining statement really.

The later error is a mysql error and know issue with the sidebar hack. So if you are running the sidebar hack you might want to place this line with your database for threads on your last line right above ?>


mysql_select_db('DATABASE') or die("Could not select database 'DATABASE'\n");?>

I would try resetting the $UserID in ubbthreads again as your lightbulbs will never work unless you let threads know that the $UserID variable in photopost is equal to Threads U_Number field.

If you have any more questions contact me via PM. I know you have had problems in the past getting things set right and I have helped out.
I'm not using the IIP Sidebar Pal mod, so that can't be it. I'll try this over, just to see if it doesn't work itself out.
-EDIT-
Thank you for your offer, and also for solving the date problem with the last image uploaded not showing properly.
No Problem. I kinda like finding out server problems
OK - I had the same error donJulio did - with the $UserID in the ubbthreads.php file.

Here's how I fixed it, now it works perfectly:

in ubbt_photopost.tmpl

Find this:

$newm = mysql_query($query3,$rplink);


Change to:

$newm = mysql_query($query3);


Find this:

$newm = mysql_query($query4,$rplink);

change to this:

$newm = mysql_query($query4);



Then it works beautifully!
I installed this for ReviewPost and got similar errors to:
Code
<br />Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/foros/templates/default/ubbt_photopost.tmpl on line 201<br />

when I first installed. The fix was to enter the correct table prefix for my ReviewPost install into:
Code
$Globals['rp_db_prefix'] = "";

in ubbt_reviewpost.tmpl.
Also, is anyone else having problems with the newposts and nonewposts icons not updating properly? For me, anything with a product is permanently marked unread.
LittleJosh,

Thats why reading the directions would have helped you LOL

It states to set your table prefix. I dont beleive you did not read them. Also I sent you a private message on this at your site. You forgot to place $UserID = $user['U_Number'];
in your ubbthreads.php file. Plus your files were old. I just updated this with the new post indicator's yesterday so your files had none of the coding. Your set.


JoshPet thats I will correct that. Thats an error on my part since the code is the same in both templates except the prefix statement and the rplink
LittleJosh. hehe.... I have a cousin named Josh and my family calls him LittleJosh and me BigJosh, so that's a change for me.

Thanks for your help, Chuck!
LOL well gotta keep you and the other Josh separated.
Just follow the smell of Oreo cookies.....
Oh My
The place that puts the number of new posts in ( ) are hardcoded red. Should be

<span class="new">($newwhatever)</span>

So it matches. Otherwise, great work!
Duh yes thanks That would be correct.
Not sure what I'm missing here in this one....Seems pretty simple but here's my error.....

Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/ubbthreads/templates/default/ubbt_photopost.tmpl on line 63

Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/ubbthreads/templates/default/ubbt_photopost.tmpl on line 83




Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/ubbthreads/templates/default/ubbt_photopost.tmpl on line 128

Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/ubbthreads/templates/default/ubbt_photopost.tmpl on line 139

Any ideas?
Chalk it up to lack of sleep and too much turkey? Got it working...... Sorry.... Great hack!
Spoke too soon maybe.... Everything is showing up but when clicking on a photopost forum the lightbulb stays gold and the amount of photos are saying (500) as if 500 new images are in each forum. What might cause this?
LOL

Okay in top of the instructions my friend it gives you a bit of code to add in ubbthreads.php

I beleive it was under this

$Username = $user['U_Username'];

add this

$UserID = $user['U_Number'];
Hiya Chuck....

It's amazing what a little space will do..... dum de dum.... Pleading the flu thing.....

Thanks again!
Ok... This is probably another dumb question... But I just realized after all this time that on my below my main index it ends at the photopost forums... There is nothing in the footer or any threads information....What should I look for?
try this template
Hey, that did fix the problem I was having with the new post indicators showing up...... However... Look at the format.....

http://stormchat.com/ubbthreads/ubbthreads.php
How are you including this in your ubbthreads.tmpl?

within the forum list or separate?
Within.......
My Bad I posted mine. I use mine within the forum list not outside thats why you dont see a tbopen or tbclose or photo list

try this one

Attached File
102675-ubbt_photopost.txt  (52 downloads)
Thanks as always Chuck! You're a lifesaver! Still not showing the footer stuff down there for some reason but the new post indicators are working....
Thats easy you have one of those servers like mine

Yuo have trouble closing DB connections to another so use this at the bottom of ubbt_photopost.tmpl and fill in the value where it says DATABASE and replace that with your threada database name.

mysql_select_db('DATABASE') or die("Could not select database 'DATABASE'\n");
No go.... darnit.... I did try that actually.. It was in the first file you sent me so I tried that just in case...I probably missed some code somewhere.... lol
mysql_select_db('DATABASE') or die("Could not select database 'DATABASE'\n");

That should do it basically it closes the other database connection telling it to connect to threads. My server will have my pages look like yours if I did not use that line. Make sure you typed the right database name for threads where I have DATABASE. It goes right before the closing ?> tag in ubbt_photopost.tmpl
I'm having problems with installing this. I'm getting a parse error and also mysql querys.
I did read that the sidebar hack is a known problem, (which i have installed) and i have to install ?> in a file, but i cant find out the details.
To see the error:
http://www.fordmondeo.org/ubbthreads/ubbthreads.php?Cat=
ta!
ok, sorry all, fixed it.
Theres an error in one of the files, reviewpost.inc.php

$rppassword = ""]; //Password

there shouldnt be ] in there.

The original needs fixing, as this is how i downloaded it.
Works great on my UBBT6.2.3 setup - Thank you for your excellent work!
© UBB.Developers