https://www.icyphoenix.com/viewtopic.php?f=26&t=5259
-----------------------------------
DWho
Sun 04 Jan, 2009 02:10

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 linenumbers=false]<a href="' . append_sid('album.' . $phpEx . '?user_id=' . $userdata['user_id']) . '">[/code]

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 linenumbers=false]('album_cat.' . $phpEx . '?cat_id=' . $cat_id . 'user_id=' . $userdata['user_id'])[/code]

but it does not work... 

I would like the link to show you the members upload avatar page which is this link [b]profile.php?mode=editprofile&cpl_mode=avatar[/b]

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

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  :?:



[size=10][color=red]Moved to proper forum - FAP General Discussions And Customizations[/color][/size]


-----------------------------------
DWho
Mon 05 Jan, 2009 09:41

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
[quote user="Artie" post="35386"]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  :?:


[/quote]

yes exactly if that is possible... thanks for reading


-----------------------------------
Artie
Mon 05 Jan, 2009 15:33

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
[strike]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.
[/strike]

[b]COPY[/b] 
[codeblock]//////////////////////////////////////
$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']);
}
//////////////////////////////////////[/codeblock]

[strike][b]ADD TO cpl_menu.php[/b] (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.[/strike]


-----------------------------------
DWho
Mon 05 Jan, 2009 16:09

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

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
It would be the same [b]php[/b] file, but the [b]tpl[/b] would be [b]profile_add_body.tpl[/b]

Put your link in the area between
[code linenumbers=false]<!-- BEGIN switch_cpl_avatar -->[/code]
AND
[code linenumbers=false]<!-- END switch_cpl_avatar -->[/code]


-----------------------------------
DWho
Mon 05 Jan, 2009 17:39

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
sorry really confused now... I cannot find [b]cpl_menu.php[/b] 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

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 [b]usercp_register.php[/b] if you wish to try yourself.


-----------------------------------
DWho
Mon 05 Jan, 2009 23:44

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:


-----------------------------------
Artie
Tue 06 Jan, 2009 01:00

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
OK, I'm now using ver 1.2.0.27  [img]http://www.icyphoenix.com/images/smiles/0007.gif[/img] 

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 [b]profile_add_body.tpl[/b]

FIND
[codeblock]<tr>
	<td class="row-header" colspan="2"><span>{L_AVATAR_PANEL}</span></td>
</tr>[/codeblock]
AFTER ADD
[codeblock]<tr>
	<td colspan="2"><span><a href="{U_USER_SUBCAT}">{L_USER_SUBCAT}</a></span></td>
</tr>[/codeblock]

OPEN [b]includesusercp_register.php[/b]

FIND
[codeblock]$template->assign_block_vars('switch_cpl_avatar', array() );[/codeblock]
BEFORE ADD
[codeblock]	//////////////////////////////////////
$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']);
}
//////////////////////////////////////[/codeblock]

FIND
[codeblock]'L_PROFILE' => $lang['Avatar_panel']));[/codeblock]
BEFORE ADD
[codeblock]'U_USER_SUBCAT' => $u_personal_gallery,
'L_USER_SUBCAT' => "HERE IS YOUR SUB_CAT LINK",
[/codeblock]

[b]MODIFY TO SUIT YOUR NEEDS[/b]

[img]http://www.icyphoenix.com/files/images/821/usercp.png[/img]


-----------------------------------
DWho
Tue 06 Jan, 2009 10:17

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:


-----------------------------------
Artie
Tue 06 Jan, 2009 23:22

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.


-----------------------------------
DWho
Wed 07 Jan, 2009 00:20

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
Hi

Well after checking and rechecking  :roll: 

I replace this part 

[code linenumbers=false]$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);
}
[/code]

with this

[code linenumbers=false]$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);
}
[/code]

and all works good...  

thanks though I do not know why mine is different to yours  :roll:


-----------------------------------
Artie
Wed 07 Jan, 2009 01:38

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
[quote user="DWho" post="35446"]
thanks though I do not know why mine is different to yours  :roll:[/quote]

Me either .... glad you made it work for you.


-----------------------------------
DWho
Wed 07 Jan, 2009 10:57

Re: Link To Personal Sub Cat In Lang File
-----------------------------------
Thanks again for the help...

 :mrgreen:  :mrgreen:


-----------------------------------
s00th
Thu 07 Jan, 2010 13:49

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


