In keeping with GauGau's FAQ on contributing to this forum if it helps you, I offer the following mod/hack/integration because the forum has educated me in the ways of CPG and php of which I know just enough to make me crazy, being that I am about four months new to both; so I can't guarantee that this will work for everyone, nor do I know if I can be of help if you get stuck, but I'm willing to try.
Mostly, I'm truly amazed, and very happy, that I figured it out on my own after spending some time in this forum to get an idea of what direction I needed to go. I couldn't find exactly what I was wanting to do, though I could have overlooked it; but there was enough information in the forum to figure out how to do it. My sincere thanks to the dev team, moderators, and forum users for providing a wealth of information to use.
I am using CPG 1.4.19, which I integrated into my custom site and customized the theme. I wanted to integrate a guestbook for registered users, and not have its link visible unless the user was logged in. I've read the pros and cons here, of having it that way but it was decided it would be this way for now as it involves 30-60 year old private family photos that I was enlisted to digitize.
I looked at several different guestbooks and settled on Advanced Guestbook, which can be found at:
http://www.proxy2.de/scripts.php It has some good features and there are also several other useful and well written scripts there too.
I installed the guestbook per the instructions in the readme file, and then modified it, through its styles menu under the admin login to fit my theme colors, though I had to make one mod by editing the body.php template file to change the font color of the navigation page number and total page indicators; and also added custom header graphics that match my site, and a link that would take users back to CPG after signing the book.
I didn't want to password the guestbook since users were already using a password to login. I figured out that I could use the custom link feature, but it would be visible to un-registered users on the login page and I couldn't figure out how to move it to the sys_menu and have it only appear when logged in.
I knew the My Profile link was only visible after login so studied CPG's theme.php and english.php files and followed my_profile and its variations till I though I understood. I used Notepad++ because it helps me understand the code better than notepad because of the color coding for comments, functions and etc. The structure of php is very similar to the basic programming language from the old days of DOS, at least to me. There I go telling my age.
NOTE: A very good practice when adding or removing code is to comment any code you add, and comment out any that you don't want to use. I use my nickname and current date. That way, if you get stuck you can easily find the lines and un-comment code you need back or comment out code giving trouble till you can figure it out or get help.
In theme.php under the heading, //HTML template for template sys_menu buttons, I copied the following line:
addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
pasted it below the line copied and changed it to
addbutton($sys_menu_buttons,'{GUESTBOOK_LNK}','{GUESTBOOK_TITLE}','{GUESTBOOK_TGT}','guestbook',$template_sys_menu_spacer); //Calvinite code 10-17-08
Under the heading, //Function for creating a main menu (SYS_MENU or SUB_MENU), I copied the line:
template_extract_block($template_sys_menu, 'my_profile');
and pasted it below the line copied and changed it to:
template_extract_block($template_sys_menu, 'guestbook'); //Calvinite code 10-17-08
Under the same heading, in the, $param = array(, section I copied the following code:
'{FAQ_TGT}' => "faq.php",
'{FAQ_TITLE}' => $lang_main_menu['faq_title'],
'{FAQ_LNK}' => $lang_main_menu['faq_lnk'],
and pasted it below the lines copied and changed it to:
'{GUESTBOOK_TGT}' => "http://www.MYURL.com/guestbook/index.php", //Calvinite code 10-17-08
'{GUESTBOOK_TITLE}' => $lang_main_menu['guestbook_title'], //Calvinite code 10-17-08
'{GUESTBOOK_LNK}' => $lang_main_menu['guestbook_lnk'], //Calvinite code 10-17-08
I uploaded this and of course it generated errors. It couldn't find the <-- BEGIN code block because I hadn't added anything to the $lang_main_menu array in the language file. So in english.php under the heading, //File theme.php, I copied the following code:
'faq_title' => 'Frequently Asked Questions on the picture gallery "Coppermine"',
'faq_lnk' => 'FAQ',
and pasted it below the lines copied, because that's where I wanted the new Guestbook link to appear, and changed it to:
'guestbook_title' => 'Guestbook for Registered members to leave comments.', // Calvinite code 10-07-08
'guestbook_lnk' => 'Guestbook', //Calvinite code 10-07-08
You can probably move the code up in the line to make it appear in a different palce in the sys_menu, though I didn't try it. I uploaded the file to my site and it works, with no bugs that I could find.
I hope this will be useful to someone, and to let the newer members know to stick with it. When I first started working with CPG and php I didn't think I'd ever be able to understand it. Yes, I have a long way to go to be as good as GauGau, Nibbler, Stramm, Tranz N Danz and others, but with time, who knows.
Again, thanks for your help, even though you might not know you did.
Calvinite