FAP CUSTOMIZATION - Wanting To Add A Personal Gallery Management Link


Subject: FAP CUSTOMIZATION - Wanting To Add A Personal Gallery Management Link
Im using a profile information organizer hack, user cp organize to be specific. Well Im trying to add links in the profile control panel to manage your personal categories. I got the upload and my pictures figured out. Here is what i added

Code: [Download] [Hide] [Select]

'U_YOUR_PERSONAL_GALLERY' => append_sid("album.$phpEx?user_id=". $userdata['user_id']),
'UPLOAD_PERSONAL_GALLERY' => append_sid("album_upload.php?cat_id=1&user_id=". $userdata['user_id']),
'U_USERS_PERSONAL_GALLERIES' => append_sid("album_personal_index.$phpEx"),
'U_PERSONAL_CAT_ADMIN' => append_sid("album_personal_cat_admin.$phpEx?cat_id=$cat_id"),


the problem im having is with this line

Code: [Download] [Hide] [Select]
'U_PERSONAL_CAT_ADMIN' => append_sid("album_personal_cat_admin.$phpEx?cat_id=$cat_id"),


It cant find the $cat_id. what would i need to add to this non album page to pull the users personal $cat_id

thanks
Adam

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
I think adding something like this may work


Code: [Download] [Hide] [Select]
$album_user_id = $userdata['user_id'];

$sql = "SELECT c.cat_id
FROM ". ALBUM_CAT_TABLE ." AS c
WHERE c.cat_user_id = '$album_user_id' AND c.cat_parent = 0
LIMIT 1";

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

if ($db->sql_numrows($result) == 0)
{

$create_personal_cat_manage_link = append_sid('album_personal_cat_admin.' . $phpEx . '?action=create&user_id=' . $album_user_id);

}
else
{
$thisrow = $db->sql_numrows($result) ;
$cat_id = $thisrow['cat_id'];
$create_personal_cat_manage_link = append_sid('album_personal_cat_admin.' . $phpEx . '?cat_id='.$cat_id.'&user_id=' . $album_user_id);
}
$db->sql_freeresult($result);



Code: [Download] [Hide] [Select]
'U_PERSONAL_CAT_ADMIN' => $create_personal_cat_manage_link,


You'll also need $cat_id for your UPLOAD_PERSONAL_GALLERY

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
First off, thank you. I tried the code and im getting errors maybe if you looked at the whole thing it might be better, its not to big.

Code: [Download] [Hide] [Select]
<?php
/***************************************************************************
* cpl_menu.php
* -------------------
* mod version : 1.0.5
* date : Monday, 08.22.2005
* copyright : Dustin < adminkrez@dumbassjones.com >
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/

if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}


$album_user_id = $userdata['user_id'];

$sql = "SELECT c.cat_id
FROM ". ALBUM_CAT_TABLE ." AS c
WHERE c.cat_user_id = '$album_user_id' AND c.cat_parent = 0
LIMIT 1";

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

if ($db->sql_numrows($result) == 0)
{

$create_personal_cat_manage_link = append_sid(album_append_uid('album_personal_cat_admin.' . $phpEx . '?action=create&amp;user_id=' . $album_user_id));

}
else
$thisrow = $db->sql_numrows($result) ;
$cat_id = $thisrow['cat_id'];
$create_personal_cat_manage_link = append_sid(album_append_uid('album_personal_cat_admin.' . $phpEx . '?cat_id='.$cat_id.'user_id=' . $album_user_id));
}
$db->sql_freeresult($result);


$template->set_filenames(array(
'cpl_menu_output' => 'profile_cpl_menu.tpl')
);

$template->assign_vars(array(
'L_CPL_REG_INFO' => $lang['Registration_info'],
'L_CPL_PROFILE_INFO' => $lang['Profile_info'],
'L_CPL_AVATAR_PANEL' => $lang['Avatar_panel'],
'L_CPL_PREFERENCES' => $lang['Preferences'],
'L_CPL_SETTINGS_OPTIONS' => $lang['Cpl_Settings_Options'],
'L_CPL_BOARD_SETTINGS' => $lang['Cpl_Board_Settings'],
'L_CPL_PRIVATE_MESSAGES' => $lang['Private_Messages'],
'L_CPL_NEWMSG' => $lang['Cpl_NewMSG'],
'L_CPL_PERSONAL_PROFILE' => $lang['Cpl_Personal_Profile'],
'L_CPL_VIEW_PROFILE' => $lang['Cpl_View_Profile'],

'U_CPL_NEWMSG' => append_sid('privmsg.'.$phpEx.'?mode=post'),
'U_CPL_REGISTRATION_INFO' => append_sid('profile.'.$phpEx.'?mode=editprofile&cpl_mode=reg_info'),
'U_CPL_PROFILE_INFO' => append_sid('profile.'.$phpEx.'?mode=editprofile&cpl_mode=profile_info'),
'U_CPL_PREFERENCES' => append_sid('profile.'.$phpEx.'?mode=editprofile&cpl_mode=preferences'),
'U_CPL_BOARD_SETTINGS' => append_sid('profile.'.$phpEx.'?mode=editprofile&cpl_mode=board_settings'),
'U_CPL_AVATAR_PANEL' => append_sid('profile.'.$phpEx.'?mode=editprofile&cpl_mode=avatar'),
'U_YOUR_PERSONAL_GALLERY' => append_sid("album.$phpEx?user_id=". $userdata['user_id']),
'UPLOAD_PERSONAL_GALLERY' => append_sid("album_upload.php?cat_id=1&user_id=". $userdata['user_id']),
'U_USERS_PERSONAL_GALLERIES' => append_sid("album_personal_index.$phpEx"),
'U_PERSONAL_CAT_ADMIN' => $create_personal_cat_manage_link,
));

$template->assign_var_from_handle('CPL_MENU_OUTPUT', 'cpl_menu_output');

?>


The first error i got was

Code: [Download] [Hide] [Select]
Parse error: syntax error, unexpected '}' in /home/sweetpro/public_html/cpl_menu.php on line 48


so i removed the } and got this error

Code: [Download] [Hide] [Select]
Fatal error: Call to undefined function: album_append_uid() in /home/sweetpro/public_html/cpl_menu.php on line 46

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
I have edited the code that I supplied above..... try it now.

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
The code didn't cause any errors but its not pulling the cat id tho. any ideas?

viewprofile

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
Oooops !

change

$thisrow = $db->sql_numrows($result) ;


to

$thisrow = $db->sql_fetchrow($result);

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
One more little thing for people wanting to use this in the future

Find

$create_personal_cat_manage_link = append_sid('album_personal_cat_admin.' . $phpEx . '?cat_id='.$cat_id.'user_id=' . $album_user_id);

and change to

$create_personal_cat_manage_link = append_sid('album_personal_cat_admin.' . $phpEx . '?cat_id='.$cat_id.'&user_id=' . $album_user_id);

After that it works excellent,

Thank you

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
Glad you got it working.

Good eye on the & :up:

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
is cat_id of user's personal gallery always the same as user's id?

because i tried putting your code in page_header since i want the management link in the overall header but it screws up
so instead of your code, i simply put in page_header.php

$template->assign_vars(array(
'U_PERSONAL_CAT_ADMIN' => append_sid('album_personal_cat_admin.' . $phpEx . '?cat_id='.$userdata['user_id'].'&amp;user_id=' . $userdata['user_id']),

now it seems to be working.....well, unless cat_id of user will change....then i have a problem

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
They are not the same, it just happened to work out that way for you.
It may work without specifying the cat_id, altogether. Try it by just adding the user_id part to the url

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
i removed cat_id, so far seems to work...so with this should just be one liner and thus won't need the sql call for cat_id

love simplicity thanks! :mrorange:

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
You are welcome :wink:

Profile PM  
Subject: Re: Wanting To Add A Personal Gallery Management Link
Hello, I find this helpful... but what are the {links_name} ? I cant figure that part out... :o

Profile PM  

Page 1 of 1


  
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.1201s (PHP: 17% SQL: 83%)
SQL queries: 10 - Debug Off - GZIP Enabled