Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Add a link to a user's Photopost Gallery Details »»
Add a link to a user's Photopost Gallery
Version: 0.75, by iRO Wiki iRO Wiki is offline
Developer Last Online: Feb 2014 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.8 Rating:
Released: 01-31-2008 Last Update: 02-21-2008 Installs: 21
DB Changes Template Edits
Re-useable Code Additional Files  
No support by the author.

Edit: I no longer use photopost, so this mod is no longer supported!


After noticing a few people wanting a working version of this, I decided to release what I did to make it work! This is the first time I've done anything like this, go easy on me.

This Mod helps "advertise" your PhotoPost gallery on your forums. It will allow you to place "View Gallery" links into the postbit_legacy, the dropdown menu when you click a user's name, and on your profile page. The postbit links will only appear when people actually have photos uploaded. The profile page will display the number of photos uploaded (you could put that on the postbit as well with some code changes).

This is similar to several different mods already out there, except this has been tweaked and confirmed to work on 3.6.8.

The Mod is made up of template changes and a cron script upload. The cron script is designed for the case of the VB and PP databases being seperate, but should work if they are in the same database, just edit the proper fields.

This mod also assumes you are not using search engine friendly URL's. If you are, you can edit the code to reflect it.


Before doing ANYTHING backup your database, I'm not responsible for data loss!

Step One

Using Execute SQL Query in the ACP, run the following as a manual query, making sure to adjust for your table prefix and rename the field if needed:

Code:
ALTER TABLE `vb_user` ADD `photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'

Step Two

Download the attached gallery.php and edit it to reflect your database details and table prefixes.

Step Three

Upload the edited gallery.php to your /includes/cron/ folder.

Step Four

Create a new scheduled task in your ACP:

Varname: gallery_check
Title: Gallery Check
Description: Updates the photo field in vb_users
Day of week: *
Day of month: *
Hour: *
Minute: 1 16 31 46 - -
Active: Yes
Log Entries: No
Filename: ./includes/cron/gallery.php
Product: vBulletin
vBulletin Default: No

Step Five

Add a new phrase:

Phrase Type: GLOBAL
Product: vBulletin
Varname: pp_gallery
Text: Gallery

Step Six

Template edits! First off, the profile page.

Edit MEMBERINFO and insert the following code wherever you would like it, AFTER editing the URL to match your site. I placed mine inbetween Posts and Referrals.

Code:
<fieldset class="fieldset">
                <legend>$vbphrase[pp_gallery]</legend>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr>
                    <td>
                        Images: <strong>$post[photos]</strong><br> <a href="http://yoursitegoeshere.com/showgallery.php?cat=500&amp;ppuser=$post[userid]">View $userinfo[username]'s Gallery</a>
                    </td>
                </tr>
                </table>
            </fieldset>
Edit postbit_legacy (not sure if the same code works or not in postbit).

This is the code for the dropdown menu:

Code:
<if condition="$post['photos']">
<tr><td class="vbmenu_option"><a href="http://yoursitegoeshere.com/showgallery.php?cat=500&ppuser=$post[userid]">View $post[username]'s Photo Gallery </a></td></tr>
</if>
This is the code for "View Gallery" link in the postbit_legacy:

Code:
<if condition="$post['photos']"><div><a href="http://yoursitegoeshere.com/showgallery.php?cat=500&amp;ppuser=$post[userid]">View Gallery</a></div><br></if>

After all that, you should be set.


Changelog:

.5 - First Release
.75 - Fixed issue with "logging" line and the cron not properly updating vb's user table when the user no longer had photos

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-17-2008, 11:40 PM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyway, it's working. I checked some threads and it's got the link for those with pics and no link for those without! Awesome, lets hope it holds up. I still wonder about that error but hey if it works and its not leaking memory or causing some other tax or strain, what do I care!
Good job, thanks for piecing this mod together!
Reply With Quote
  #13  
Old 02-18-2008, 05:42 AM
dutchbb dutchbb is offline
 
Join Date: Nov 2003
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by iRO Wiki View Post
I'll try testing that out!
Thank-you
Reply With Quote
  #14  
Old 02-22-2008, 04:47 PM
iRO Wiki iRO Wiki is offline
 
Join Date: Sep 2007
Location: Colorado
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Solved both issues! I simply commented out the "log cron action" line since we should have it set to not log anyway.

To fix the issue with it not updating properly once all of a user's photos have been deleted:


Find this line:


Code:
$link2 = mysql_connect ('localhost', 'VBmysqlusername', 'VBmysqlpassword') or die ('I cannot connect to the database. Forum'); 
mysql_select_db ("VBdatabasename") or die ('could not connect: ' .mysql_error());
NOTE: Your line will be different as you will have already edited in your account infos.

Move the entire line of code above this line:

Code:
while($row = mysql_fetch_array( $result ))


Then, between the $link2 and while lines, add this:

Code:
mysql_query("Update vb_user SET photos = '0';");


The final code should look like this:


Code:
$result = mysql_query("Select userid, user, Count(*) AS num FROM pp_photos Group BY userid;")  
or die(mysql_error());   

$link2 = mysql_connect ('localhost', 'VBmysqlusername', 'VBmysqlpassword') or die ('I cannot connect to the database. Forum'); 
mysql_select_db ("VBdatabasename") or die ('could not connect: ' .mysql_error()); 

mysql_query("Update vb_user SET photos = '0';");

while($row = mysql_fetch_array( $result ))

I have updated the attachment in the first post if you'd like to use that to compare instead.

Let me know if you have any questions or problems!
Reply With Quote
  #15  
Old 02-22-2008, 07:48 PM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, just did the fix manually and also commented out the last line so it now looks like this:

PHP Code:
// log_cron_action("gallery task updated", $nextitem); 
Regards
Reply With Quote
  #16  
Old 03-29-2008, 02:50 PM
marin marin is offline
 
Join Date: Mar 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for this great MOD.
It works also on Vbulletin 3.7.0 RC1 + PhotoPost PHP Pro v6.02.

Just insted of MEMBERINFO i edited the MEMBERINFO_block_statistics and instead of postbit_legacy i added the code to postbit.

Regards, Marin
Reply With Quote
  #17  
Old 04-18-2008, 06:29 AM
littleginsu littleginsu is offline
 
Join Date: Mar 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not able to get the links to show up in the drop-down menu or in the user info found in the posts..? The link on the user info page shows up, but the postbit edits don't appear to be working for me.. any suggestions? Thanks!
Reply With Quote
  #18  
Old 04-18-2008, 09:56 AM
Basit Basit is offline
 
Join Date: Apr 2004
Location: London
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working without any problem

Link: http://www.hallagulla.com/urdu

Thanks
Reply With Quote
  #19  
Old 04-19-2008, 04:39 AM
iRO Wiki iRO Wiki is offline
 
Join Date: Sep 2007
Location: Colorado
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by littleginsu View Post
I am not able to get the links to show up in the drop-down menu or in the user info found in the posts..? The link on the user info page shows up, but the postbit edits don't appear to be working for me.. any suggestions? Thanks!
Do you use postbit, or postbit_legacy?
Reply With Quote
  #20  
Old 04-26-2008, 05:24 AM
littleginsu littleginsu is offline
 
Join Date: Mar 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did I use (or edit)? I tried both (one at a time) and neither produced a link

Quote:
Originally Posted by iRO Wiki View Post
Do you use postbit, or postbit_legacy?
Reply With Quote
  #21  
Old 05-18-2008, 09:10 PM
littleginsu littleginsu is offline
 
Join Date: Mar 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone has any advice why I cannot get the links to work correct?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:56 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04501 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete