Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
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.


Attachments
97057-PhotoPostRP.zip (0 Bytes, 115 downloads)

Last edited by Omegatron; 11/05/2003 9:20 AM.
Sponsored Links
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
http://www.viperalley.com/ubbthreads.php is my site where these integrations are in use.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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?


- Allen wavey
- What Drives You?
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
yes

Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
I'm a coder; not a documenter..... STELLLLLA!

Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.
Attachments
97214-ubbt_photopost.txt (0 Bytes, 76 downloads)

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Here is the updated reviewpost template to allow setting a proper prefix variable.
Attachments
97216-ubbt_reviewpost.txt (0 Bytes, 58 downloads)

Sponsored Links
Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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
Attachments
97221-photopost.inc.txt (0 Bytes, 49 downloads)

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Here is a proper working reviewpost.inc.php file as well
Attachments
97222-reviewpost.inc.txt (0 Bytes, 66 downloads)

Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.


Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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

Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
OKay here is an updated archive with all corrections from the original post
Attachments
97284-PhotoPostRP.zip (0 Bytes, 25 downloads)

Joined: Sep 2000
Posts: 49
Power User
Power User
Offline
Joined: Sep 2000
Posts: 49
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.

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
I have updated the original post with the updates posted by Chuck


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
thank you guys


- Allen wavey
- What Drives You?
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
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).

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thank you!

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
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


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290
Question, is it possible to update this to not show the gallery tables if all forums are members only?


- Custom Web Development
http://www.JCSWebDev.com
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
What are you using to restrict things by U_Group? You could use the same type of thing.

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369


Awesome work Chuck.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
I updated it again with a config option to set NEW POST TRACKING off or either posts or replies on or both on.

Joined: Jun 2002
Posts: 670
Code Monkey
Code Monkey
Offline
Joined: Jun 2002
Posts: 670
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
[]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.

Joined: Jun 2002
Posts: 670
Code Monkey
Code Monkey
Offline
Joined: Jun 2002
Posts: 670
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.

Last edited by donJulio; 11/05/2003 12:29 AM.
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
No Problem. I kinda like finding out server problems

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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!

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
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.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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

Page 1 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)