Edit: SHOOT! I just saw I was in the wrong forum when I posted this. I meant to put it in 30. modifications. Can a mod please move it there? So sorry!
Alright so I'm trying to do something a whole lot of crazy with very few coding skills... I'm pretty sure it can be done - although it probably isn't going to be an easy fix one way or the other... so I was hoping I could get some help from all of you wonderful people.
Usually, when you log in, you get redirected to your user account info where all the panel links show listed together. I'm opening a new site where the biggest part of the users will be fanfiction.net refugees so I'm trying to make eFiction duplicate (somewhat) some of the things FF.net does - the most important part being the way the member account info is divided and set up.
Looking at user.php I saw it used the assigned default template so I created a new template called acctinfo and assigned that instead. In that acctinfo.tpl I was able to create the tabs I wanted to use which are : Account, Publish, Favorites, Reviews and Beta (though that will only be in use as I install the beta reader module).
At first I thought I would be able to use a panel variable to create the link and just place it inside the template where I wanted it to appear - kinda like the customs_page_link works... except now I'm pretty sure this is not how it works so I can't go that route (correct me if I'm wrong.)
A quick search on the forums about this resulted in a long-ago post where someone had wanted to group the panels differently and had been told she would have to rewrite the code in user.php to achieve that, except that user was not trying to populate panels to do it and even so, the thread stopped after that suggestion so I have no way of knowing if that was ever achieved.
I've already determined that the code I need to tinker with is this one:
if($action) $current = $action;
else $current = "user";
// end main function
if((empty($action) || $action == "login") && isMEMBER) {
$output .= "<div id="pagetitle">"._USERACCOUNT."</div>
<div class="tblborder" id="useropts" style="padding: 5px; width: 50%; margin: 1em 25%;">";
$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '1' AND (panel_type = 'U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type, panel_order, panel_title ASC");
if(!dbnumrows($panelquery)) $output .= _FATALERROR;
while($panel = dbassoc($panelquery)) {
if(!$panel['panel_url']) $output .= "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";
else $output .= "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a><br />n";
}
$output .= "</div>n";
}
else if(!empty($action)) {
$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '$action' AND (panel_type='U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") LIMIT 1");
if(dbnumrows($panelquery)) {
$panel = dbassoc($panelquery);
if($panel['panel_level'] > 0 && !isMEMBER) accessDenied( );
if($panel['panel_url'] && file_exists(_BASEDIR.$panel['panel_url'])) require_once(_BASEDIR.$panel['panel_url']);
else if(file_exists("user/{$action}.php")) require_once("user/{$action}.php");
else $output = write_error(_ERROR);
}
but looking at that just made me really dread what changes will be needed to make my concept work. As it is now, the code as I understand it is pulling the panels from U (user account), S (submissions) and F (favorites) and putting them all in the same output whereas I want them outputted in different areas. I'd obviously want U panels to appear in the Account tab, while S panels would go in the Publish tab, F panels in the Favorites tab and I'd have to also call on a new panel type called R for Reviews which would populate in the Reviews tab (god I hope I'm not confusing anyone!)
What would be the simplest way to do that and still have it work? I don't know if with the code using $action as it does now it's even possible or if that also need an overhaul?
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
What is that original thread? Was it something Elle was involved in, because I know she'd modded that on at least one of her sites. You might be able to do subpages. That's not really the word, but I was able to break up favorites into two different pages - one for current and one for past. That was much simpler, though.
I moved this thread for you.
You'd only need to modify this section:
if((empty($action) || $action == "login") && isMEMBER) {
$output .= "<div id="pagetitle">"._USERACCOUNT."</div>
<div class="tblborder" id="useropts" style="padding: 5px; width: 50%; margin: 1em 25%;">";
$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '1' AND (panel_type = 'U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type, panel_order, panel_title ASC");
if(!dbnumrows($panelquery)) $output .= _FATALERROR;
while($panel = dbassoc($panelquery)) {
if(!$panel['panel_url']) $output .= "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";
else $output .= "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a><br />n";
}
$output .= "</div>n";
}
The second part handles displaying an individual panel.
It'd probably look something like:
if((empty($action) || $action == "login") && isMEMBER) {
$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '1' AND (panel_type = 'U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type, panel_order, panel_title ASC");
if(!dbnumrows($panelquery)) $output .= _FATALERROR;
while($panel = dbassoc($panelquery)) {
if(!$panel['panel_url']) $tpl->assign($panel['panel_name'], "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a>");
else $tpl->assign($panel['panel_name'], "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a>");
}
}
And then you'd call the panel name as the template variable (i.e. {editprefs} for the Edit Preferences link).
Thanks Tammy I'll try that when I get the dang JFusion thing to not lock me out of my eFiction part altogether. LOL
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
Tammy, that's awesome! aside from a few aesthetic issues, it works pretty much as I wanted it to!
The only thing that needs tweaking is the tab sticking. I was wondering if it would be possible for the script to remember which tab you were in when you click a link. Say I went to the Favorites tab and wanted to manage my favorites. I start with the Favorite authors so click that link and do my thing... Would it be possible for the page to reload being on the Favorites tab instead of always going back to the default view using the very first tab which in this case is the Account tab?
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
You'd probably need to set a variable and then include it in the template based on the panel being shown. It'd look something like what we do in the profile page. I think you could use the panel type information to decide what tab is active.
So, in the section that outputs the panel list, you'd want something like.
$tpl->assign("userPanelClass", "class='activeTab'");
And then in the section displaying a panel, you'd do something like.
if($panel['type'] == "U") $tpl->assign("userPanelClass", "class='activeTab'");
else if($panel['type'] == "S") $tpl->assign("submissionPanelClass", "class='activeTab'");
else $tpl->assign("favoritePanelClass", "class='activeTab'");
And then include {userPanelClass}, {submissionPanelClass}, {favoritePanelClass} in the template.
I'm not sure that will get you 100% where you're trying to go though.
Thats gives me a very good starting point though as looking at it just seemed a lil too big for my britches. Still, not something I'll attempt as I'm brain-dead so I'll play with that over the weekend and let you know how that turns out. You're awesome and I know I don't say it nearly often enough but THANKS for all the hard work you do!
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
I'm going insane... okay insaner. I've tried many variations and all I succeeded in doing is breaking the user.php page until it refused to load and I had to revert it to the last working version and scrap all I had done wrong. LOL
Based on the idea of assigning variables for each tab, I created a new panel_type R for the reviews, and that's where the fun began - but in no way where it ended! Before I even attempted to get to the memory stick, I tried to modify the panel assignment code to tell the file to look at panels from the U, S, F AND R panels and based on the code that Tammy had provided, I thought it would go something like this (can you tell yet I suck at coding?) EDIT: Okay I fixed THAT part after all π :
if((empty($action) || $action == "login") && isMEMBER) {
$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '1' AND (panel_type = 'U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") OR panel_type = 'R' ORDER BY panel_type, panel_order, panel_title ASC");
if(!dbnumrows($panelquery)) $output .= _FATALERROR;
while($panel = dbassoc($panelquery)) {
if(!$panel['panel_url']) $tpl->assign($panel['panel_name'], "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a>");
else $tpl->assign($panel['panel_name'], "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a>");
}
}
But the output scares the bejesus out of me because you already have so many the tpl->assign bits in there that adding the rest with the selective tabs and activeClass just seems too confusing to me. I mean I do need the code above to still make it work right? even if I need the new code to tell the panels that I want one to stay active and... argh!
Tammy, when you say
in the section that outputs the panel list
Did you mean that section?
if(!$panel['panel_url']) $tpl->assign($panel['panel_name'], "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a>");
else $tpl->assign($panel['panel_name'], "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a>");
If not, I don't have any idea where in user.php that would be, sorry to be such a bother. I'm really trying to learn but I don't think my brain has quite grasped the concept of linear thinking. *sigh*
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community