Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2014, 12:14 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default User profile settings - How to add a link to Profile.php

Right now the links to the profile settings are like this:


Code:
http://example.com/profile.php?do=editprofile
I have added a custom Setting Page to Profile.php, using this code in profile.php:

Code:
$cmd = $_GET['cmd']; 
switch($cmd)
{ 
case "extrasettings":
@include('profile_extra.php');
break; 
}
However, to get to my custom setting page, the link is like this:

Code:
http://example.com/profile.php?cmd=extrasettings

My question is, how do I make the link show up as the other Profile Setting Links? How can I make the link show up like this: "?do=extrasettings" instead of "?cmd=extrasettings" . I would like to change the "cmd" to "do" like the other profile links.



Example:
Code:
http://example.com/profile.php?do=extrasettings
Reply With Quote
  #2  
Old 09-12-2014, 12:34 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use the profile_start hook and then just do something like:

PHP Code:
if($_REQUEST['do'] == "extrasettings")
{
   
// Your code.

Don't forget to attach it to a template though.
Reply With Quote
2 благодарности(ей) от:
Lynne, tbworld
  #3  
Old 09-12-2014, 04:55 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave View Post
Use the profile_start hook and then just do something like:

PHP Code:
if($_REQUEST['do'] == "extrasettings")
{
   
// Your code.

Don't forget to attach it to a template though.

Thank you for helping me. But where would I add that code? Should I make a new plugin? Or should I just add the code to Profile.php?
Reply With Quote
  #4  
Old 09-12-2014, 05:07 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As Dave said, you would use a plugin and use the profile_start hook for the plugin.
Reply With Quote
  #5  
Old 09-12-2014, 05:23 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
As Dave said, you would use a plugin and use the profile_start hook for the plugin.
I tried this code with the hook "profile_start" , and when I go to "mysite.com/profile.php?do=extrasettings" , it just comes up with a white/blank page. I have no idea what I am doing wrong.

Plugin Code:
Code:
if($_REQUEST['do'] == "extrasettings")
{
  @include('profile_extra.php');

}
I have even tried using the hook "profile_editoptions_start", but it was the same thing, blank white page.

EDIT: Im sorry, when I use the hook "profile_start", I get a "500 - Internal Server Error", when I use the hook "profile_editoptions_start", I get the blank/white page.


I can access the custom setting's page fine with "mysite.com/profile.php?cmd=extrasettings". I just cant get it to work like this: "mysite.com/profile.php?do=extrasettings"
Reply With Quote
  #6  
Old 09-12-2014, 06:23 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We need to see the "extrasettings" code in order to assist. If you are using a proper editor and have not created a BOM, then the problem rests in your included code, not the hook location. The hook as you probably already know selects the point of entry where your code will be eval'ed.

If for some (security reason -- only) you cannot post your code to receive global assistance you can use a private message.

What @Dave suggested is the correct method and there is nothing wrong with the hook locations.
Reply With Quote
  #7  
Old 09-12-2014, 07:34 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
We need to see the "extrasettings" code in order to assist. If you are using a proper editor and have not created a BOM, then the problem rests in your included code, not the hook location. The hook as you probably already know selects the point of entry where your code will be eval'ed.

If for some (security reason -- only) you cannot post your code to receive global assistance you can use a private message.

What @Dave suggested is the correct method and there is nothing wrong with the hook locations.
Ok, I finally got it working correctly. I actually copy and pasted my custom setting page code into Profile.php.

There is one more problem though, after I edit my profile setting and go to "Save", it saves the changes, but it redirects to "profile.php?do=editoptions" and not back to the previous page "profile.php?do=extrasettings"


Should I copy and paste my entire profile.php code?

Edit: I fixed it. I found out that the function "updateoptions" was being used twice, so the code I added, was using the first "updateoptions" function and redirecting the extra settings page to the EditOptions page on Submit. I simply just had to use a different function, such as "do=updatesettings", and of course add the redirect code " exec_header_redirect('profile.php?do=extrasettings '); " . All seems to be working correctly now. Thank you all for helping me out, I really do appreciate it.
Reply With Quote
Благодарность от:
Lynne
  #8  
Old 09-12-2014, 08:41 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just paste your addon code and let us know where you pasted it the profile.php.

Either method is fine:
------------------------
1. Provide us with a unique search string where you placed your code.
2. If profile.php was previously unmodified, then provide us with the vbulletin version you are using and a line number where you placed the code.

If it is off a few lines, don't worry, we will figure it out.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04425 seconds
  • Memory Usage 2,249KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (3)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete