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:
- adding a user custom field
- adding a Scheduled Task (adding a file and adding the task in vB's admin page)
- 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!