You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 544 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to redirect Your Info to the Forums user profile

18.6.2. How to redirect Your Info to the Forums user profile

Figure 18-5. Your Info link in the User Preferences panel.

Your Info link in the User Preferences panel.



With the advent of phpBB forums in PHP-Nuke (starting from somewhere around v. 6.5), you not only have to cope with two administration panels, one for PHP-Nuke in general and one for the Forums in particular, your users can maintain their profile in two places too, from the Your Info link in the User Preference panel (Figure 18-5), as well as the Forums profile link in the Forums module (Figure 18-6).

Figure 18-6. Forum Profile link in the Forums module.

Forum Profile link in the Forums module.



The Your Info link has the URL

modules.php?name=Your_Account&op=edituser

and leads to a panel similar to the one of Figure 18-7.

Figure 18-7. User profile in Your Info.

User profile in Your Info.



The Profile link in the Forums module, on the other hand, has the URL

modules.php?name=Forums&file=profile&mode=editprofile

(optionally with the session ID parameter, sid, which is not shown here) and leads to the panel shown in Figure 18-8.

Both panels use the same database tables in the background, so it doesn't matter which one you use. This may be confortable for some, but also confusing for other users.

If your users find it confusing to use two different entry points for their personal information, you can modify the Your_Account module to redirect them to the Forum profile (Figure 18-8), even when they click on the Your Info link (Figure 18-5).

Figure 18-8. User profile in the Forums.

User profile in the Forums.



The Your Info link is output ("echoed") in modules/Your_Account/navbar.php, in the following code block:

echo "<font class=\"content\">"
    ."<center><a href=\"modules.php?name=Your_Account&amp;op=edituser\">
      <img src=\"$menuimg\" border=\"0\" alt=\""._CHANGEYOURINFO.
     "\" title=\""._CHANGEYOURINFO."\"></a><br>"
    ."<a href=\"modules.php?name=Your_Account&amp;op=edituser\">"
    ._CHANGEYOURINFO."</a>"
    ."</center></font></td>";

To redirect the users to the Forum profile (Figure 18-8), you can change the above block to:

echo "<font class=\"content\">"
    ."<center><a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=editprofile\">
      <img src=\"$menuimg\" border=\"0\" alt=\""._CHANGEYOURINFO.
     "\" title=\""._CHANGEYOURINFO."\"></a><br>"
    ."<a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=editprofile\">"
    ._CHANGEYOURINFO."</a>"
    ."</center></font></td>";

As you can easily see, we have changed only the two links (one for the image and one for the text), the other lines are for your reference only.

Note

It is not necessary to compute the user's numeric ID and pass it on the URL through the u parameter - the mode=editprofile parameter on the URL will find the user automatically (but mode=viewprofile will not!).

But wait a minute! Is this really all we have to change? Is the Your Info link (Figure 18-5) the only one that leads a user to the profile screen of the Your_Info module (Figure 18-7)? How about the user name links in other modules, for example? Search for the string "op=edituser" and you will already find a ton of those links in various places (Newsletter, language files, Reviews...) And how about a new user? Will the new user registration screen be the one of Your_Account or the one of Forums?

Instead of chasing links in the code, there is a more elegant solution that will eliminate any attempt to bring a user to the Your Info profile at its very beginning! It is also a very good example of what type of control you can achieve over your PHP-Nuke, if you put your knowledge about the way a module works (see Chapter 21) into practice:

In modules/Your_Account/index.php find the lines:

case "edituser":
edituser();
break;

and replace them with:

case "edituser":
Header("Refresh: 0; url=modules.php?name=Forums&file=profile&mode=editprofile");
break;

This will take care of the "edit user" case. We need to do the same for the "new user" case too. Just replace

case "new_user":
new_user();
break;

with:

case "new_user":
Header("Refresh: 0; url=modules.php?name=Forums&file=profile&mode=register");
break;

The idea here is the following: instead of searching all code of all modules for links that point to the Your Info profile, we look at the parameters that such a link passes on the URL. A typical Your Info profile link is of the form:

modules.php?name=Your_Account&op=edituser

so the parameters it passes to the modules.php script are:

  • name: the name of the module to execute (Your_Account)

  • op: the operation to execute (edituser)

The second URL parameter, op, is checked at one single place in the code, in the switch statement of modules/Your_Account/index.php:

switch($op) {
    case "logout":
        logout();
        break;
    ...many other cases checked here, among them "edituser" and "new_user"
    
    default:
        main($user);
        break;
}

This is the one and only point of control for the actions taken by the Your_Account module. We make use of this fact and change the actions that are to be taken for the operations "edituser" and "new_user". We don't change the links, we change the actions that follow when the links are clicked.

This will make the Your Info profile practically inaccessible in your system and will present the Forums profile instead.

Warning Missing functionality in the Forums profile!
 

Bear in mind that, depending on the versions of PHP-Nuke and Forums, you may be missing some functionality in the Forums profile, that was present in the profile that was accessible through the Your Info link. This may include changing the fake email address, changing the subscription to the newsletter, or changing the extra info (Figure 12-1). However, this is planned to be corrected in the future.


Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.179 Seconds - 205 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::