Firefox PHP

Let the user set a "home" folder to jump to after logging in

Posted by korsakov 
Let the user set a "home" folder to jump to after logging in
March 17, 2010 04:30PM
I am just looking for an idea how to best let a user choose a ("Home-")folder and have the ID of this folder saved during the user's registration. I would like to direct the user to his home-folder after login for example. Thank you for your help!



Edited 1 time(s). Last edit at 03/17/2010 04:35PM by Maurice Makaay.
Re: Let the user set a "home" folder to jump to after logging in
March 17, 2010 04:34PM
Not really on topic for the enhanced custom profiles module, so I split this off.

What's the idea with doing this during the user's registration? It sounds more like a feature that a user wants to access after registration and after using the forums ("Make this my startup page after logging in"). Choosing a folder during signup seems like putting a feature in the wrong spot to me.

If I would implement something like this, I wouldn't make it an "after login" folder. I would rather provide the user with a kind of in-Phorum bookmark list, where he/she can quickly jump to the pages that are bookmarked. I think that this would be a more useful feature, but maybe you have a different use case in mind here.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 03/17/2010 04:35PM by Maurice Makaay.
Re: Let the user set a "home" folder to jump to after logging in
March 21, 2010 07:40PM
I apparently forgot to send my reply. The reason why I want to give the user the option to choose his home-folder during registration is the fact that I want to spare him the frustration in case the site is not for him. As Thomas recommended I inserted code from the "Favorite Forum" module into register.tpl. The drop-down is correctly listing all folders. I am currently working on a small baby-laptop and I just have difficulties to set the custom variable "folder_sel" with the according folder_id. Could you look at the last line where I use a hidden <input>-field? It would be very helpful. Thank you!!


Language: PHP
  1. global $PHORUM;
  2. $forums = phorum_mod_favorite_forums_get_forums();
  3. $content = "<select name='FavoriteForums"."[]' size='5'>";
  4. foreach ($forums as $forum_id => $forum_data) {
  5. if (!empty($forum_data["folder_flag"])) {
  6.  
  7. $content .= "<option value=\"{$forum_id}\"";
  8. if (!empty($dropdown_chosen)) {
  9. foreach ($dropdown_chosen as $chosen) {
  10. if ($chosen == "$forum_id") {
  11. $content .= " selected='selected'";$folder_sel=$chosen;
  12. break;
  13. }
  14. }
  15. }
  16. $content .= ">".$forum_data["name"]."</option>";
  17. }
  18. }
  19. $content .= "</select><input type=\"hidden\" name=\"folder_sel\" value=\"{$folder_sel}\" />";
  20. print $content;



Edited 1 time(s). Last edit at 03/21/2010 07:41PM by korsakov.
Re: Let the user set a "home" folder to jump to after logging in
March 21, 2010 07:54PM
I am seeing a number of things wrong here. If you want to save the forum_id to a custom profile field named "folder_sel" then you need to change your code a bit. Drop the whole hidden input field and simple change the select tag's name to folder_sel. So, line 3 becomes:
Language: PHP
  1. $content = "<select name='folder_sel' size='5'>";
line 11 becomes:
Language: PHP
  1. $content .= " selected='selected'";
and line 19 becomes:
Language: PHP
  1. $content .= "</select>";


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Let the user set a "home" folder to jump to after logging in
March 21, 2010 08:26PM
Joe, thank you for showing mercy! You must have visualized me with my 3-month old and a small laptop sharing my lap!
If I could now make the last layer of folders selectable... Thank you anyway, it saved my Sunday afternoon!
Sorry, only registered users may post in this forum.

Click here to login