FAP CUSTOMIZATION - Link To Personal Sub Cat In Lang File


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: [Download] [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: [Download] [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...

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

Profile PM  
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

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: [Download] [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.

Profile PM  
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

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: [Download] [Hide] [Select]
<!-- BEGIN switch_cpl_avatar -->

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

Profile PM  
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..

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 ..... :censored:


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

Profile PM  
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...

:mrgreen: :mrgreen:

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: [Download] [Hide] [Select]
<tr>
<td class="row-header" colspan="2"><span>{L_AVATAR_PANEL}</span></td>
</tr>

AFTER ADD
Code: [Download] [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: [Download] [Hide] [Select]
$template->assign_block_vars('switch_cpl_avatar', array() );

BEFORE ADD
Code: [Download] [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: [Download] [Hide] [Select]
'L_PROFILE' => $lang['Avatar_panel']));

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


MODIFY TO SUIT YOUR NEEDS

usercp

Profile PM  
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..

:mrgreen: :mrgreen:

Subject: Re: Link To Personal Sub Cat In Lang File
Works fine for me :roll:

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

Profile PM  
Subject: Re: Link To Personal Sub Cat In Lang File
Hi

Well after checking and rechecking :roll:

I replace this part

Code: [Download] [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: [Download] [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 :roll:

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 :roll:


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

Profile PM  
Subject: Re: Link To Personal Sub Cat In Lang File
Thanks again for the help...

:mrgreen: :mrgreen:


Page 1 of 2


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.2207s (PHP: 12% SQL: 88%)
SQL queries: 11 - Debug Off - GZIP Enabled