FAP CUSTOMIZATION - Link To Personal Sub Cat In Lang File »  Show posts from    to     

Icy Phoenix


Archived phpBB Topics (Styles, Mods, Support) - FAP CUSTOMIZATION - Link To Personal Sub Cat In Lang File



DWho [ Sun 04 Jan, 2009 02:10 ]
Post subject: FAP CUSTOMIZATION - Link To Personal Sub Cat In Lang File
Hi

I would like to place a link in a lang file that goes to members personal sub cat..

I manages to get a link to work to goto members personal album I used...

Code: [Hide] [Select]
<a href="' . append_sid('album.' . $phpEx . '?user_id=' . $userdata['user_id']) . '">


this works fine..

all my membes have one sub cat and I would also like to point a link to there is this possible I have tried

Code: [Hide] [Select]
('album_cat.' . $phpEx . '?cat_id=' . $cat_id . 'user_id=' . $userdata['user_id'])


but it does not work...

I would like the link to show you the members upload avatar page which is this link profile.php?mode=editprofile&cpl_mode=avatar

or is it possible to just add a link in the tpl file and which files do I need to edit... sorry if this is not in the right forum...


Artie [ Mon 05 Jan, 2009 04:17 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Not sure I understand exactly what you are asking

Your members only have 1 sub-cat in their personal gallery and you want a link to that sub-cat .
Are you saying that you want that link to show on the user's Avatar Control Panel page



Moved to proper forum - FAP General Discussions And Customizations


DWho [ Mon 05 Jan, 2009 09:41 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Artie wrote: [View Post]
Not sure I understand exactly what you are asking

Your members only have 1 sub-cat in their personal gallery and you want a link to that sub-cat .
Are you saying that you want that link to show on the user's Avatar Control Panel page




yes exactly if that is possible... thanks for reading


Artie [ Mon 05 Jan, 2009 15:33 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
There are 2 different tpl files for the Avatar CP ... I assume you want the link in the menu on the left side of the page.
You can copy code from profile_main.php to cpl_menu.php and that should give you your sub_cat_id.


COPY
Code: [Hide] [Select]
//////////////////////////////////////
$sql = "SELECT * FROM " . ALBUM_CAT_TABLE . "
WHERE cat_user_id = " . $userdata['user_id'];

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}

while($row = $db->sql_fetchrow($result))
{
$sub_cat_id = ($row['cat_parent'] > 0) ? $row['cat_id'] : '';
}

$db->sql_freeresult($result);

if (!empty($sub_cat_id))
{
$u_personal_gallery = append_sid('album_cat.' . $phpEx . '?cat_id=' . $sub_cat_id .'&user_id=' . $userdata['user_id']);
}
else
{
$u_personal_gallery = append_sid('album.' . $phpEx . '?user_id=' . $userdata['user_id']);
}
//////////////////////////////////////


ADD TO cpl_menu.php (you can add just before the template variables are assigned)

Assign and add some template variables and it should work ..... keep in mind that if a user has more than 1 sub_cat, then the link will take you to the last sub_cat that was created.


DWho [ Mon 05 Jan, 2009 16:09 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
excellant thank you

what if I would like it just by the upload avatar area which php file would I need .. and what code do I place in the tpl file...

thanks again


Artie [ Mon 05 Jan, 2009 17:19 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
It would be the same php file, but the tpl would be profile_add_body.tpl

Put your link in the area between
Code: [Hide] [Select]
<!-- BEGIN switch_cpl_avatar -->

AND
Code: [Hide] [Select]
<!-- END switch_cpl_avatar -->


DWho [ Mon 05 Jan, 2009 17:39 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
sorry really confused now... I cannot find cpl_menu.php in any of the files (using latest version)

and still not sure what to place in tpl file...

sorry for being a pain..


Artie [ Mon 05 Jan, 2009 23:30 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
I'm sorry that php file is no longer used... I need to update to the current version of IP .....


I'll have to get back to you on this after I upgrade.(I've put it off long enough )
But the new php file would be usercp_register.php if you wish to try yourself.


DWho [ Mon 05 Jan, 2009 23:44 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
no worries I thought it was either you or me... lol

I had a go using usercp_register.php

but I cannot get the right code for the tpl file...



Artie [ Tue 06 Jan, 2009 01:00 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
OK, I'm now using ver 1.2.0.27 0007

You almost need to be specific where you want the link on the page, because it does make a difference where you need to place the code.
The following code should allow you to place it as shown in the attach pic below.

OPEN profile_add_body.tpl

FIND
Code: [Hide] [Select]
<tr>
<td class="row-header" colspan="2"><span>{L_AVATAR_PANEL}</span></td>
</tr>

AFTER ADD
Code: [Hide] [Select]
<tr>
<td colspan="2"><span><a href="{U_USER_SUBCAT}">{L_USER_SUBCAT}</a></span></td>
</tr>


OPEN includesusercp_register.php

FIND
Code: [Hide] [Select]
$template->assign_block_vars('switch_cpl_avatar', array() );

BEFORE ADD
Code: [Hide] [Select]
//////////////////////////////////////
$sql = "SELECT * FROM " . ALBUM_CAT_TABLE . "
WHERE cat_user_id = " . $userdata['user_id'];

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}

while($row = $db->sql_fetchrow($result))
{
$sub_cat_id = ($row['cat_parent'] > 0) ? $row['cat_id'] : '';
}

$db->sql_freeresult($result);

if (!empty($sub_cat_id))
{
$u_personal_gallery = append_sid('album_cat.' . $phpEx . '?cat_id=' . $sub_cat_id .'&user_id=' . $userdata['user_id']);
}
else
{
$u_personal_gallery = append_sid('album.' . $phpEx . '?user_id=' . $userdata['user_id']);
}
//////////////////////////////////////


FIND
Code: [Hide] [Select]
'L_PROFILE' => $lang['Avatar_panel']));

BEFORE ADD
Code: [Hide] [Select]
'U_USER_SUBCAT' => $u_personal_gallery,
'L_USER_SUBCAT' => "HERE IS YOUR SUB_CAT LINK",


MODIFY TO SUIT YOUR NEEDS

usercp


DWho [ Tue 06 Jan, 2009 10:17 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Hi Artie

Thanks for the help with this... I have followed your guide above exactly and checked it 3 times... but for some reasons the link just sends you to the members 1st personal gallery and not the sub_cat...

I have checked to see if the member has a sub cat which they do... but for some reason it will not pick it up..

any ideas..



Artie [ Tue 06 Jan, 2009 23:22 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Works fine for me

You must inserted something in the wrong place... hard to say without seeing your modded files/code.


DWho [ Wed 07 Jan, 2009 00:20 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Hi

Well after checking and rechecking

I replace this part

Code: [Hide] [Select]
$sql = "SELECT * FROM " . ALBUM_CAT_TABLE . "
WHERE cat_user_id = " . $userdata['user_id'];

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}


with this

Code: [Hide] [Select]
$sql = "SELECT * FROM " . ALBUM_TABLE . " AS p, " . ALBUM_CAT_TABLE . " AS c
WHERE c.cat_user_id = " . $userdata['user_id'] . "
AND p.pic_cat_id = c.cat_id
AND p.pic_approval = 1
ORDER BY pic_time DESC";

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql);
}


and all works good...

thanks though I do not know why mine is different to yours


Artie [ Wed 07 Jan, 2009 01:38 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
DWho wrote: [View Post]

thanks though I do not know why mine is different to yours


Me either .... glad you made it work for you.


DWho [ Wed 07 Jan, 2009 10:57 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
Thanks again for the help...



s00th [ Thu 07 Jan, 2010 13:49 ]
Post subject: Re: Link To Personal Sub Cat In Lang File
try something like this..........

"<a href=" . append_sid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id . '&user_id=' . $userdata['user_id']) . ">LINK</a>"


in the lang_faq.php could look like..........

$faq[] = array("New Title", "<a href=" . append_sid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id . '&user_id=' . $userdata['user_id']) . ">LINK</a>");


.....of course $cat_id will need to be defined somewhere




Powered by Icy Phoenix