View Single Post
  #65  
Old 10-06-2005, 02:43 PM
whodah whodah is offline
 
Join Date: Feb 2004
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is on vB 3.0.x

havn't moved to 3.5 yet.

this will add a link beneath the post count of the user.

however it might not work for your situation. all of my members' galleries are their vB username.

like my username is: whodah
my gallery name is: whodah

i have a user named: nifty_guy
his gallery name is: nifty_guy

u get the idea

i have a cron job that runs nightly (u can run it as often as u want of course) that checks usernames against g2 entities of the same name that are albums. if it exists, it populates a custom field in vB. if that field exists, a link to their album shows up in their posts.

so - u might have to tweak this accordingly, i'm not posting this as a cookie-cutter solution. but should getcha goin!



there are no file modifications with this. there is one file [i]addition[/b]. the rest can be done from the admin control panel.

this involves:
  1. adding a user custom field
  2. adding a Scheduled Task (adding a file and adding the task in vB's admin page)
  3. modifying one postbit template


1: adding a user custom field
in your admin pages, go to: User Profile Fields -> Add New User Profile Field

call it wahtever you want. i titled mine:
Title: Gallery
Description: Does this user have a gallery in CVR_Members? If so, what's the name of the gallery?

you need ot make:
Field Editable by User: No

the rest you can fill out however you want. note the field number it assigns it. if you need to review it, click:
User Profile Fields -> User Profile Field Manager

and the 'Name' column is what you need to make a note of. in my case, it's: field10


2: adding a Scheduled Task
create the file:
includes/cron/gallery_field10.php

(yes, u can name the file whatever you want, just make a note of it)

**note: in the file right below this, replace 'field10' with your field number!

and in it add:
Code:
<?php  
    $whodiag = 0;
		
		$whomysqlstring = "SELECT * FROM user;";
		if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
		$results = mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
  	while ($row = mysql_fetch_array($results)) {
  				$whomysqlstring = "SELECT * FROM g2_FileSystemEntity WHERE g_pathComponent='".$row[username]."';";
					if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
					$results2 = mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
					if(mysql_numrows($results2)) { 
									if($whodiag) {echo "<BR>line ".__LINE__.": Found an album for ".$row[username]."<BR>"; }
									while ($row2 = mysql_fetch_array($results2)) {
  											$whomysqlstring = "UPDATE userfield SET `field10` = '".$row2[g_pathComponent]."' WHERE userid = '".$row[userid]."';";
												if($whodiag) {echo "<BR>line ".__LINE__.": whomysqlstring = $whomysqlstring<BR>"; }
  			  							mysql_query($whomysqlstring) or die ("Error: line ".__LINE__.": $whomysqlstring<BR>");
									}
					}

		}		
?>
go to: Scheduled Tasks -> Add New Scheduled Task
call it:
Title: Gallery Profile Updater
Filename: ./includes/cron/gallery_field10.php
(unless u used a different Filename above... if so, change accordingly)
and run it as often as u want. i run mine nightly. thus if a new user gets a gallery, it won't reflect on their posts til the next day. so for mine, everything is a star except Hour which is:
Hour: 2


after yer done, go ahead and 'Run Now' it.



3: modifying one postbit template
ok, if yer in legacy mode, yer using:
postbit_legacy
if not, it's probably
postbit
(someone correct me if i'm wrong)

so - edit the template yer using. for me, it's postbit_legacy.

in postbit or postbit_legacy (we use legacy), find:
Code:
<div>
					$vbphrase[posts]: $post[posts]
				</div>
below it add:
Code:
				<if condition="$post['field10']">
						<div>
    						<a href="$vboptions[bburl]/v/CVR_members/$post[field10]/">$post[musername]'s Gallery</a>
								<if condition="$blockinfo['whodahuserrandompic']">
        								 <!--  -->
        								 <BR>Their Daily Random Pic:<BR>$post[field14]
    						</if>
						</div>
				</if>
and now u'll get a nifty little link below their posts saying:
whodah's gallery

or

nifty_guy's gallery

ggs!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01396 seconds
  • Memory Usage 1,790KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete